Init power outputs to zero on startup
This commit is contained in:
parent
3d40582b39
commit
a2cccbde71
1 changed files with 12 additions and 2 deletions
|
@ -8,11 +8,21 @@
|
|||
|
||||
static bool report_change = false;
|
||||
|
||||
uint16_t bang(uint16_t data);
|
||||
void strobe();
|
||||
void uart_bang(uint8_t data);
|
||||
|
||||
static void init() {
|
||||
// Enable GPIO: PB2, PB3, PB4 output, low; PB5 input, pull-up on
|
||||
PORTB = (PORTB & ~(_BV(PB2) | _BV(PB3) | _BV(PB4))) | _BV(PB5);
|
||||
DDRB = (DDRB & ~_BV(PB5)) | (_BV(PB2) | _BV(PB3) | _BV(PB4));
|
||||
|
||||
// Important: Before we do anything else, reset all outputs
|
||||
// The shift registers have an undefined state at startup,
|
||||
// and there are no pull-downs on the outputs.
|
||||
bang(0x0000);
|
||||
strobe();
|
||||
|
||||
// Initialize CAN interface
|
||||
can_init(BITRATE_125_KBPS);
|
||||
// Regular receive/transmit mode
|
||||
|
|
Loading…
Reference in a new issue