Revision 502da1a1
Sync i2c testing file
scout_avr/bom/test.c | ||
---|---|---|
1 |
#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 |
} |
Also available in: Unified diff