Skip to content

Commit

Permalink
Move UART pins initialization later
Browse files Browse the repository at this point in the history
Fixes #37
  • Loading branch information
facchinm committed Jun 28, 2019
1 parent daa9b77 commit ca37340
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions cores/arduino/UART.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,6 @@ void UartClass::begin(unsigned long baud, uint16_t config)

_written = false;

//Set up the rx pin
pinMode(_hwserial_rx_pin, INPUT_PULLUP);

//Set up the tx pin
digitalWrite(_hwserial_tx_pin, HIGH);
pinMode(_hwserial_tx_pin, OUTPUT);

int8_t sigrow_val = SIGROW.OSC16ERR5V;
baud_setting *= (1024 + sigrow_val);
baud_setting /= (1024 - abs(sigrow_val));
Expand All @@ -169,6 +162,13 @@ void UartClass::begin(unsigned long baud, uint16_t config)

(*_hwserial_module).CTRLA |= USART_RXCIE_bm;

//Set up the rx pin
pinMode(_hwserial_rx_pin, INPUT_PULLUP);

//Set up the tx pin
digitalWrite(_hwserial_tx_pin, HIGH);
pinMode(_hwserial_tx_pin, OUTPUT);

// Restore SREG content
SREG = oldSREG;
}
Expand Down

0 comments on commit ca37340

Please sign in to comment.