OSDN Git Service

AD7991 I2C ADCの読み取り機能を追加
authortakemasa <suikan@users.sourceforge.jp>
Sun, 16 Sep 2012 06:01:05 +0000 (15:01 +0900)
committertakemasa <suikan@users.sourceforge.jp>
Sun, 16 Sep 2012 06:01:05 +0000 (15:01 +0900)
uzume_prototype/uzume_prototype.c

index 47626d3..0f38932 100644 (file)
@@ -2,6 +2,10 @@
 #include <t_services.h>
 #include "kernel_id.h"
 #include "uzume_prototype.h"
+#include <i2c_subsystem.h>
+
+unsigned char adcbuf[8];
+#define ADCADDR 0x28
 
 
 /*
 void main_task(VP_INT exinf)
 {
     syslog(LOG_NOTICE, "Prototype started ");
-    syslog(LOG_NOTICE, "CODEC Initializaed ");
-    slp_tsk();
+
+    while(1)
+    {
+        i2c_master_read(0, ADCADDR, adcbuf, 2);
+        syslog( LOG_NOTICE, "ADC is : %02x%02x ", adcbuf[0], adcbuf[1]);
+        tslp_tsk(200);
+    }
 }