ctr_mcu/branches/SDK2.0_1NUP/i2c_mcu.h

37 lines
859 B
C

#ifndef __ic2_mcu__
#define __ic2_mcu__
// ========================================================
#define ERR_OK 0
#define ERR_NAK 1
#define ERR_NOSLAVE 2
// ========================================================
extern volatile bit iic_mcu_busy;
extern bit iic_mcu_wo_dma;
extern u8 iic_mcu_result;
// ========================================================
err iic_mcu_read( u8 SLA, u8 adrs, u8 len, u8 * dest );
u8 iic_mcu_read_a_byte( u8 SLA, u8 adrs );
err iic_mcu_write( u8 SLA, u8 adrs, u8 len, void * src );
err iic_mcu_write_a_byte( u8 SLA, u8 adrs, u8 dat );
err iic_mcu_write_a_byte_codec( u8 adrs, u8 dat );
// ↓その通信が完了したら解除されます。
#define iic_mcu_set_wo_dma() { while( iic_mcu_busy ){;} iic_mcu_wo_dma = 1; }
void iic_mcu_start( );
void iic_mcu_stop( );
#endif