Revision a692ef82
ID | a692ef825c88391fec80991dc68b7c357578353c |
Parent | a75b176a |
Set last_bit to 0 to get first bit properly
scout_avr/bom/bom.c | ||
---|---|---|
32 | 32 |
static void bom_init(void) { |
33 | 33 |
|
34 | 34 |
SET_BIT(DDRB, EMIT); |
35 |
SET_BIT(DDRB, PB1); |
|
36 | 35 |
|
37 | 36 |
init_detect(); |
38 | 37 |
|
... | ... | |
67 | 66 |
disable_detect_interrupt(); |
68 | 67 |
data = 0; |
69 | 68 |
count = 0; |
70 |
last_bit = 1; |
|
71 |
_delay_us(160); |
|
69 |
last_bit = 0; |
|
72 | 70 |
start_timer0(); |
73 | 71 |
} |
74 | 72 |
|
... | ... | |
84 | 82 |
ISR(TIMER0_COMPA_vect) { |
85 | 83 |
|
86 | 84 |
char this_bit = READ_BIT(PINB, DETECT); |
87 |
SET_BIT(PINB, PB1); // TOGGLE THE PIN MOFOS |
|
88 |
smb_send_data((uint8_t*)&this_bit, 1); |
|
89 | 85 |
|
90 | 86 |
if (this_bit == 1) { |
91 | 87 |
if (last_bit == 1) { |
... | ... | |
135 | 131 |
|
136 | 132 |
static void send_next_bit() { |
137 | 133 |
char next_bit = sending_data >> (14 - sending_counter) & 1; |
138 |
char ocr_temp = next_bit ? TIME_US(2000-40) : TIME_US(1000-20);
|
|
134 |
char ocr_temp = next_bit ? TIME_US(2000) : TIME_US(1000);
|
|
139 | 135 |
OCR1A = ocr_temp; // Compare A - Turns on transmitter |
140 | 136 |
OCR1C = ocr_temp; // Reset the timer when match a fires |
141 | 137 |
} |
Also available in: Unified diff