wayne roberts / Mbed OS i2c_slave_block_example

Dependencies:   lib_i2c_slave_block

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers cmds.h Source File

cmds.h

00001 
00002 #define CMD_TEST3               0x00
00003 #define CMD_TEST12              0x01
00004 #define CMD_TEST32              0x02
00005 #define CMD_IRQ                 0x03
00006 #define CMD_BUFFER              0x04
00007 
00008 #define CMD_TIMEOUT             0xfd    // indication of smbus timeout
00009 #define CMD_ARLO                0xfe    // indication of arbitration lost
00010 #define CMD_BUSERR              0xff    // indication of start or stop during transfer
00011 
00012 typedef union {
00013     struct __attribute__((packed)) {
00014         struct {
00015             uint8_t button  : 1;    // 0
00016             uint8_t xyz     : 1;    // 1
00017             uint8_t res     : 6;    // 2,3,4,5,6,7
00018         } flags;
00019         uint8_t cnt;     // if flags.button
00020         uint8_t a;
00021         int8_t b;
00022         int8_t c;
00023     } fields;
00024     uint8_t buf[5];
00025 } irq_t;
00026 
00027 extern const uint8_t cmd_to_length[];