9 #include "poppy-com/inc/i2c_master.h"
10 #include "poppy-com/inc/i2c_slave.h"
11 #include "poppy-com/inc/context.h"
36 ctx.
type = MODULETYPE;
40 .master_write = FALSE,
41 .unexpected_state = FALSE,
45 unsigned char poppyNetwork_read(
unsigned char addr,
msg_t *msg,
46 unsigned char reply_size) {
50 if (i2cAddr(addr,
TX)) {
54 if (i2cWrite(msg->
reg)) {
58 if (i2cWrite(msg->
size)) {
62 for (i = 0; i < msg->
size; i++) {
63 if (i2cWrite(msg->
data[i])) {
70 if (i2cAddr(addr,
RX)) {
74 msg->
size = reply_size;
75 for (i = 0; i < msg->
size; i++) {
76 if (i2cRead(FALSE, &msg->
data[i])) {
86 if (i2cAddr(addr,
TX)) {
93 for (
unsigned char i = 0; i < msg->
size; i++) {
94 i2cWrite(msg->
data[i]);
96 i2cWrite(crc(&msg->
data[0], msg->
size));
unsigned char poppyNetwork_write(unsigned char addr, msg_t *msg)
Master mode write function.
void tx_cb(msg_t *msg)
Callback function for Slave mode messages transmission.
void poppyNetwork_init(TX_CB tx_cb, RX_CB rx_cb, RX_CB rxgc_cb)
Initialisation of the Poppy communication lib.
void rxgc_cb(msg_dir_t dir, msg_t *msg)
Callback function for Slave mode messages reception with general call.
Poppy communication main include file.
void rx_cb(msg_dir_t dir, msg_t *msg)
Callback function for Slave mode messages reception.