Revision 201
- Setup bootloader to initialize pins to a known safe state
- Pulled pindefs for the toolbox out of the toolbox into common/toolbox_pindefs.h
- Shared toolbox pindefs with the bootloader
- Replaced all raw pin names with the #defined names
- Optimizied out some bytes out of the bootloader by sharing variables
main.c | ||
---|---|---|
28 | 28 |
#include <stdint.h> |
29 | 29 |
#include <util/delay.h> |
30 | 30 |
#include <avr/wdt.h> |
31 |
#include <avr/eeprom.h> |
|
31 | 32 |
|
32 | 33 |
#define RELAY _BV(PORTD4) |
33 | 34 |
#define VAC_SENSE _BV(PIND3) |
... | ... | |
54 | 55 |
#define TWARN 1 |
55 | 56 |
#define TMAX 2 |
56 | 57 |
|
58 |
|
|
57 | 59 |
uint8_t sec; |
58 | 60 |
uint8_t min; |
59 | 61 |
|
... | ... | |
98 | 100 |
uint8_t packet[3]; |
99 | 101 |
uint8_t ms_timer=0; |
100 | 102 |
|
103 |
uint8_t myaddr; |
|
101 | 104 |
/***** Start Start-up Sequence *****/ |
102 | 105 |
init_pins(); //Set pin directions |
103 | 106 |
// init_uart(51); //Set registers for uart |
104 | 107 |
/***** End Start-up Sequence *****/ |
105 | 108 |
|
106 | 109 |
uint8_t r; |
107 |
|
|
108 |
PORTB &= ~_BV(PORTB0); |
|
109 | 110 |
|
110 |
_delay_ms(1000); |
|
111 |
PORTB |= _BV(PORTB0); |
|
112 |
_delay_ms(1000); |
|
113 |
reset(); |
|
111 |
//eeprom_write_byte(1, 18); |
|
114 | 112 |
|
113 |
PORTB = 0x7; |
|
114 |
|
|
115 |
//myaddr = eeprom_read_byte(1); |
|
116 |
//if (myaddr == 18) { |
|
117 |
// PORTB = 0x7; |
|
118 |
//} |
|
119 |
//_delay_ms(1000); |
|
120 |
//PORTB |= _BV(PORTB0); |
|
121 |
//_delay_ms(1000); |
|
122 |
//reset(); |
|
123 |
|
|
115 | 124 |
while(1) { |
125 |
_delay_ms(1000); |
|
126 |
PORTB |= _BV(PORTB0); |
|
127 |
_delay_ms(1000); |
|
128 |
PORTB &= ~_BV(PORTB0); |
|
116 | 129 |
} |
117 | 130 |
|
118 | 131 |
return 0; |
Also available in: Unified diff