root / scout_avr / bom / test.c @ 502da1a1
History | View | Annotate | Download (358 Bytes)
1 | 502da1a1 | Aaron Perley | #include <stdint.h> |
---|---|---|---|
2 | #include <avr/io.h> |
||
3 | #include <avr/interrupt.h> |
||
4 | #include <util/delay.h> |
||
5 | #include "tiny-twi-sync.h" |
||
6 | |||
7 | |||
8 | static void slave_rx(uint8_t *buf, int len) { |
||
9 | if (len >= 3) { |
||
10 | switch (buf[0]) { |
||
11 | case BOM_I2C_SEND:
|
||
12 | smb_send_data(buf, len); |
||
13 | } |
||
14 | } |
||
15 | } |
||
16 | |||
17 | int main(void) { |
||
18 | smb_init(slave_rx); |
||
19 | smb_set_address(3);
|
||
20 | twi_run(); |
||
21 | } |