概述
这是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 ! "));
+ 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 ! "));
+while(1);
+ return 0;
+}
最后
以上就是眼睛大帆布鞋为你收集整理的Led Blinking 功能驱动设计的全部内容,希望文章能够帮你解决Led Blinking 功能驱动设计所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复