#ifndef USER_TWIM_H__ #define USER_TWIM_H__ #include #include #include "sdk_config.h" #include "define.h" #include "nrf_drv_twi.h" #ifdef __cplusplus extern "C" { #endif typedef void (*twim_xfer_func)(void); typedef struct{ twim_xfer_func twim_xfer_done; //TWI传输完成标志 twim_xfer_func twim_xfer_timeout; //TWI超时标志 }user_twim_s; #if NRF_MODULE_ENABLED(NRFX_TWIM_0) void twim0_init(twim_xfer_func done,twim_xfer_func timeout); void twim0_uinit(void); ret_code_t nrf_drv_twim0_tx(uint8_t address,uint8_t const * p_data,uint8_t length,bool no_stop); ret_code_t nrf_drv_twim0_rx(uint8_t address,uint8_t * p_data,uint8_t length); #endif #if NRF_MODULE_ENABLED(NRFX_TWIM_1) void twim1_init(twim_xfer_func done,twim_xfer_func timeout); void twim1_uinit(void); ret_code_t nrf_drv_twim1_tx(uint8_t address,uint8_t const * p_data,uint8_t length,bool no_stop); ret_code_t nrf_drv_twim1_rx(uint8_t address,uint8_t * p_data,uint8_t length); #endif #ifdef __cplusplus } #endif #endif // USER_TWIM_H__ /** @} */