Led Blinking 功能驱动设计

这是OBM里的一段代码,实现了LED 闪烁的功能,下面是LED原理图:

Led blinking 

The LEDR, LEDG, LEDB, controlled by the 8806, can be programed to blinking by set the 8806 internal regs. Such as 0x0c,0x0d,0x0e,0x0f.

the difference between the 2 circuit is the resister value ,1 use 1k,and 2 use 0.

now I can only debug out the first blinking . maybe the second circuit has problems .

 

static int enable_led()
+{
+ char val = 0,count;
+
+ portofino_write(0x15, 0x02);
+ portofino_read(0x15,&count);
+ printf(NULL, "0x15 count = 0x%x.", count);
+
+ portofino_write(0x16, 0x10);
+ portofino_read(0x16,&count);
+ printf(NULL, "0x16 count = 0x%x.", count);
+
+
+ portofino_write(0x00, 0x0f);
+ portofino_write(0x01, 0x02);
+ portofino_read(0x01,&count);
+ printf(NULL, "0x01 count = 0x%x.", count);
+
+#if 1
+ AddMessage((UINT8_T*) ("Run Led Enable !\0"));
+ portofino_write(PORTOFINO_WLED2B, 0x2);
+
+ portofino_read(PORTOFINO_WLED2B,&count);
+ printf(NULL, "0x05 count = 0x%x.", count);
+
+ portofino_write(PORTOFINO_WLED3A, 0x35);
+ portofino_read(PORTOFINO_WLED3A,&count);
+ printf(NULL, "0x06 count = 0x%x.", count);
+#endif
+ portofino_read(PORTOFINO_WLED3B, &val);
+
+ portofino_write(PORTOFINO_WLED3B, val | 0x02); //RGB1 LED enable

+ portofino_read(PORTOFINO_WLED3B,&count);
+ printf(NULL, "0x07 count = 0x%x.", count);
+
+// portofino_write(PORTOFINO_RGB1_CON, 0x11); //RGB

+ portofino_write(PORTOFINO_RGB1_CON, 0x07); //RGB control

+ portofino_read(PORTOFINO_RGB1_CON,&count);
+ printf(NULL, "0x0c count = 0x%x.", count);
+
+ portofino_write(PORTOFINO_R_RGB1, 0x00); //Red

+ portofino_read(PORTOFINO_R_RGB1,&count);
+ printf(NULL, "0x0d count = 0x%x.", count);
+
+ portofino_write(PORTOFINO_G_RGB1, 0x00); //Green

+ portofino_read(PORTOFINO_G_RGB1,&count);
+ printf(NULL, "0x0E count = 0x%x.", count);
+
+ portofino_write(PORTOFINO_B_RGB1, 0xFF); //Blue

+ portofino_read(PORTOFINO_B_RGB1,&count);
+ printf(NULL, "0x0F count = 0x%x.", count);
+ AddMessage((UINT8_T*) ("Led Enable Complete !\0"));
+while(1);
+ return 0;
+}


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值