41 #ifndef __I2CMASTER_H__
42 #define __I2CMASTER_H__
51 void i2c_enable(
void);
53 void i2c_receiveinit(u8_t slave_address);
54 u8_t i2c_receive_n(u8_t byte_ctr, u8_t *rx_buf);
56 void i2c_transmitinit(u8_t slave_address);
57 void i2c_transmit_n(u8_t byte_ctr, u8_t *tx_buf);
64 #define P5SEL2_ 0x0045
65 sfrb(P5SEL2, P5SEL2_);
68 #ifdef __IAR_SYSTEMS_ICC__
69 #define P5SEL2_ (0x0045u)
70 DEFC( P5SEL2 , P5SEL2_)
74 #define I2C_PxDIR P5DIR
76 #define I2C_PxOUT P5OUT
77 #define I2C_PxSEL P5SEL
78 #define I2C_PxSEL2 P5SEL2
79 #define I2C_PxREN P5REN
82 #define I2C_SDA (1 << 1) //SDA == P5.1
83 #define I2C_SCL (1 << 2) //SCL == P5.2
84 #define I2C_PRESC_1KHZ_LSB 0x00
85 #define I2C_PRESC_1KHZ_MSB 0x20
86 #define I2C_PRESC_100KHZ_LSB 0x50
87 #define I2C_PRESC_100KHZ_MSB 0x00
88 #define I2C_PRESC_400KHZ_LSB 0x14
89 #define I2C_PRESC_400KHZ_MSB 0x00
92 #ifdef I2C_CONF_RX_WITH_INTERRUPT
93 #define I2C_RX_WITH_INTERRUPT I2C_CONF_RX_WITH_INTERRUPT // XXX Move I2C_CONF_RX_WITH_INTERRUPT to contiki-conf.h or platform-conf.h
95 #define I2C_RX_WITH_INTERRUPT 1
100 #define PRINTFDEBUG(...) printf(__VA_ARGS__)
102 #define PRINTFDEBUG(...)