mirror of
https://github.com/rvtr/ctr_mcu.git
synced 2025-06-19 09:05:48 -04:00
35 lines
809 B
C
35 lines
809 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_bus_status;
|
|
|
|
|
|
|
|
// ========================================================
|
|
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 );
|
|
|
|
// ↓その通信が完了したら解除されます。
|
|
#define iic_mcu_set_wo_dma() { while( iic_mcu_busy ){;} iic_mcu_wo_dma = 1; }
|
|
|
|
void iic_mcu_start( );
|
|
void iic_mcu_stop( );
|
|
|
|
|
|
#endif
|