


#include <t_services.h>
#include "kernel_id.h"
#include "i2c-test.h"
#include "i2c_subsystem.h"


#define I2CADRESS 0x50
unsigned char data[3] = {7, 0xDE, 0xAD };
unsigned char buf[3] = {0,0,0 };


/*
 *  メインタスク
 */
void main_task(VP_INT exinf)
{
    int errcode;

    syslog(LOG_NOTICE, "Hello");

    errcode =  i2c_master_write( 0, I2CADRESS, data, 3 );

    syslog(LOG_NOTICE, "i2c_master_write, error code = 0x%04x", errcode );

    errcode =  i2c_master_write_read( 0, I2CADRESS, data, 1, buf, 1 );

    syslog(LOG_NOTICE, "i2c_master_write_read, error code = 0x%04x", errcode );
    syslog(LOG_NOTICE, "buf[0] = 0x%04x", buf[0] );

    slp_tsk();


}
