example of i2c slave device supporting block transfers
Dependencies: lib_i2c_slave_block
Tested on nucleo board as slave. Use with i2c_master_block_example on raspberry pi as master.
Master I2C write will print on serial terminal 115200. User button will raise an irq; the RPi test program will service the interrupt.
See lib_i2c_slave_block for explanation of code.
cmds.c@3:0288d257446a, 2019-02-03 (annotated)
- Committer:
- Wayne Roberts
- Date:
- Sun Feb 03 16:56:15 2019 -0800
- Revision:
- 3:0288d257446a
- Parent:
- 2:d7e05c75f240
indicate errors if reported by i2c
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Wayne Roberts |
0:3ccfaf358115 | 1 | #include <stdint.h> |
Wayne Roberts |
0:3ccfaf358115 | 2 | #include "cmds.h" |
Wayne Roberts |
0:3ccfaf358115 | 3 | |
Wayne Roberts |
0:3ccfaf358115 | 4 | const uint8_t cmd_to_length[] = |
Wayne Roberts |
0:3ccfaf358115 | 5 | { |
Wayne Roberts |
0:3ccfaf358115 | 6 | /* 0x00 CMD_TEST3 */ 3, |
Wayne Roberts |
0:3ccfaf358115 | 7 | /* 0x01 CMD_TEST12 */ 12, |
Wayne Roberts |
0:3ccfaf358115 | 8 | /* 0x02 CMD_TEST32 */ 32, |
Wayne Roberts |
2:d7e05c75f240 | 9 | /* 0x03 CMD_IRQ */ sizeof(irq_t), |
Wayne Roberts |
2:d7e05c75f240 | 10 | /* 0x04 CMD_BUFFER */ 32 |
Wayne Roberts |
0:3ccfaf358115 | 11 | }; |