46 void i2c_enable(
void);
47 void i2c_disable(
void);
49 void i2c_receiveinit(uint8_t slave_address);
50 uint8_t i2c_receive_n(uint8_t byte_ctr, uint8_t *rx_buf);
52 void i2c_transmitinit(uint8_t slave_address);
53 void i2c_transmit_n(uint8_t byte_ctr, uint8_t *tx_buf);
55 uint8_t i2c_busy(
void);
58 #define I2C_PxDIR P5DIR
60 #define I2C_PxOUT P5OUT
61 #define I2C_PxSEL P5SEL
62 #define I2C_PxSEL2 P5SEL2
63 #define I2C_PxREN P5REN
66 #define I2C_SDA (1 << 1) //SDA == P5.1
67 #define I2C_SCL (1 << 2) //SCL == P5.2
68 #define I2C_PRESC_1KHZ_LSB 0x00
69 #define I2C_PRESC_1KHZ_MSB 0x20
70 #define I2C_PRESC_100KHZ_LSB 0x50
71 #define I2C_PRESC_100KHZ_MSB 0x00
72 #define I2C_PRESC_400KHZ_LSB 0x14
73 #define I2C_PRESC_400KHZ_MSB 0x00
76 #ifdef I2C_CONF_RX_WITH_INTERRUPT
77 #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
79 #define I2C_RX_WITH_INTERRUPT 1
85 #define PRINTFDEBUG(...) printf(__VA_ARGS__)
87 #define PRINTFDEBUG(...)