ctr_mcu/trunk/i2c_mcu.h
n2232 5a9a3eeb2f 2.07(デバッグ中)
加速度センサセカンドベンダのI2C不具合ワークアラウンド追加


git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_mcu@378 013db118-44a6-b54f-8bf7-843cb86687b1
2011-08-25 04:14:13 +00:00

41 lines
967 B
C

#ifndef __ic2_mcu__
#define __ic2_mcu__
// ========================================================
typedef enum{
I2C_ERR_OK = 0,
I2C_ERR_NAK,
I2C_ERR_NOSLAVE,
I2C_ERR_TIMEOUT,
I2C_ERR_UNDEF = 0xFF
}i2c_err;
// ========================================================
extern volatile bit iic_mcu_busy;
extern bit iic_mcu_wo_dma;
extern i2c_err iic_mcu_result;
// ========================================================
i2c_err iic_mcu_read( u8 SLA, u8 adrs, u8 len, u8 * dest );
u8 iic_mcu_read_a_byte( u8 SLA, u8 adrs );
i2c_err iic_mcu_write( u8 SLA, u8 adrs, u8 len, void * src );
i2c_err iic_mcu_write_a_byte( u8 SLA, u8 adrs, u8 dat );
i2c_err iic_mcu_write_a_byte_codec( u8 adrs, u8 dat ); // codecバグ回避機能付き
// ↓その通信が完了したら解除されます。
#define iic_mcu_set_wo_dma() { while( iic_mcu_busy ){;} iic_mcu_wo_dma = true; }
void iic_mcu_start( );
void iic_mcu_stop( );
#endif