41 #ifndef __UART1I2CMASTER_H__
42 #define __UART1I2CMASTER_H__
48 #define PRINTFDEBUG(...) printf(__VA_ARGS__)
50 #define PRINTFDEBUG(...)
56 void i2c_receiveinit(uint8_t slave_address);
57 uint8_t i2c_receive_n(uint8_t byte_ctr, uint8_t *rx_buf);
59 void i2c_transmitinit(uint8_t slave_address);
60 void i2c_transmit_n(uint8_t byte_ctr, uint8_t *tx_buf);
62 uint8_t i2c_busy(
void);
64 void uart1_writearray(
unsigned char* c,
int length);
68 #define I2C_PxDIR P5DIR
70 #define I2C_PxOUT P5OUT
71 #define I2C_PxSEL P5SEL
72 #define I2C_PxSEL2 P5SEL2
73 #define I2C_PxREN P5REN
76 #define I2C_SDA (1 << 1) //SDA == P5.1
77 #define I2C_SCL (1 << 2) //SCL == P5.2
78 #define I2C_PRESC_1KHZ_LSB 0x00
79 #define I2C_PRESC_1KHZ_MSB 0x20
80 #define I2C_PRESC_100KHZ_LSB 0x50
81 #define I2C_PRESC_100KHZ_MSB 0x00
82 #define I2C_PRESC_400KHZ_LSB 0x14
83 #define I2C_PRESC_400KHZ_MSB 0x00
86 #ifdef I2C_CONF_RX_WITH_INTERRUPT
87 #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
89 #define I2C_RX_WITH_INTERRUPT 1
95 #define UART1_BAUD2UBR(baud) ((MSP430_CPU_SPEED)/(baud))
97 void uart1_set_input(
int (*
input)(
unsigned char c));
98 void uart1_writeb(
unsigned char c);
101 uint8_t uart1_active(
void);
void i2c_enable(void)
Configure serial controller in I2C mode and set I2C speed.
void uart1_init(unsigned long ubr)
Initalize the RS232 port.
static void input(void)
Process a received 6lowpan packet.
void i2c_disable(void)
Configure serial controller in disabled mode.
void uart1_pin_init(void)
Configure pins for RS232 port.