Revision e4d78d85
Bugfixes so bom code compiles
scout_avr/bom/Makefile | ||
---|---|---|
8 | 8 |
|
9 | 9 |
F_CPU=1000000 |
10 | 10 |
|
11 |
SRC=bom.c |
|
11 |
SRC=bom.c tiny-twi.c
|
|
12 | 12 |
HDR= |
13 | 13 |
FLAGS=-mmcu=$(MCU) -DF_CPU=$(F_CPU)UL -funsigned-char -Os -fpack-struct -Wall |
14 | 14 |
|
scout_avr/bom/bom.c | ||
---|---|---|
39 | 39 |
////////////////////////////////// Receiving /////////////////////////////////// |
40 | 40 |
|
41 | 41 |
static void init_detect(void) { |
42 |
TCCROA |= _BV(WGM01); // enable reset on compare A
|
|
42 |
TCCR0A |= _BV(WGM01); // enable reset on compare A
|
|
43 | 43 |
TIMSK |= _BV(OCIE0A); // enable timer0 compare match A |
44 | 44 |
|
45 | 45 |
GIMSK |= _BV(PCIE); // Enable pin change interrupt for detection |
... | ... | |
90 | 90 |
|
91 | 91 |
if (count == 15) { |
92 | 92 |
restart_detect(); |
93 |
smb_send_data(&data, sizeof(data)); |
|
93 |
smb_send_data((uint8_t*) &data, sizeof(data));
|
|
94 | 94 |
} |
95 | 95 |
} |
96 | 96 |
|
... | ... | |
100 | 100 |
|
101 | 101 |
static void start_timer1() { |
102 | 102 |
TCNT1 = 0; // Reset timer 1 count to 0 |
103 |
TCCR1 |= _BV(CS12) // Set prescalar to 8 and start timer1 |
|
103 |
TCCR1 |= _BV(CS12); // Set prescalar to 8 and start timer1
|
|
104 | 104 |
} |
105 | 105 |
|
106 | 106 |
static void stop_timer1() { |
scout_avr/bom/bomi2c.h | ||
---|---|---|
3 | 3 |
|
4 | 4 |
#define BOM_I2C_SEND 1 |
5 | 5 |
|
6 |
|
|
7 |
static void bom_init(void); |
|
8 |
static void init_detect(void); |
|
9 |
static void init_timer1(void); |
|
10 |
static void send_next_bit(void); |
|
11 |
|
|
6 | 12 |
#endif |
scout_avr/bom/tiny-twi.c | ||
---|---|---|
25 | 25 |
uint8_t recv_idx; |
26 | 26 |
uint8_t recv_data[RECV_BUF_SIZE]; |
27 | 27 |
slave_rx_t onDataRecieved; |
28 |
struct { |
|
28 |
typedef struct {
|
|
29 | 29 |
uint8_t start; |
30 | 30 |
uint8_t end; |
31 | 31 |
uint8_t data[SEND_BUF_SIZE]; |
32 | 32 |
bool full; |
33 |
} send_queue; |
|
33 |
} queue; |
|
34 |
|
|
35 |
queue send_queue; |
|
34 | 36 |
|
35 | 37 |
static void twi_set_ctr(char n) { |
36 | 38 |
USISR = n; |
Also available in: Unified diff