OSDN Git Service

I2C統合してビルドまでOK
[uzume/uzume_bfin.git] / uzume_prototype / i2c-test.c
1
2
3
4 #include <t_services.h>
5 #include "kernel_id.h"
6 #include "i2c-test.h"
7 #include "i2c_subsystem.h"
8
9
10 #define I2CADRESS 0x50
11 unsigned char data[3] = {7, 0xDE, 0xAD };
12 unsigned char buf[3] = {0,0,0 };
13
14
15 /*
16  *  メインタスク
17  */
18 void main_task(VP_INT exinf)
19 {
20     int errcode;
21
22     syslog(LOG_NOTICE, "Hello");
23
24     errcode =  i2c_master_write( 0, I2CADRESS, data, 3 );
25
26     syslog(LOG_NOTICE, "i2c_master_write, error code = 0x%04x", errcode );
27
28     errcode =  i2c_master_write_read( 0, I2CADRESS, data, 1, buf, 1 );
29
30     syslog(LOG_NOTICE, "i2c_master_write_read, error code = 0x%04x", errcode );
31     syslog(LOG_NOTICE, "buf[0] = 0x%04x", buf[0] );
32
33     slp_tsk();
34
35
36 }