diff options
Diffstat (limited to 'src/modem.cc')
-rw-r--r-- | src/modem.cc | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/modem.cc b/src/modem.cc index cb3a6ee..2eae685 100644 --- a/src/modem.cc +++ b/src/modem.cc @@ -28,7 +28,7 @@ uint8_t Modem::buffer_available() { * Store 1 byte in ringbuffer */ static inline void modem_buffer_put(const uint8_t c) { - if (modem.buffer_available() != MODEM_BUFFER_SIZE) { + if (modem.buffer_available() != MODEM_BUFFER_SIZE) { modem_buffer[modem_buffer_head++ % MODEM_BUFFER_SIZE] = c; } } @@ -83,7 +83,11 @@ ISR(PCINT3_vect) { /* * Start the modem by enabling Pin Change Interrupts & Timer */ -void Modem::init() { +void Modem::enable() { + /* Enable R1 */ + DDRA |= _BV(PA3); + PORTA |= _BV(PA3); + /* Modem pin as input */ MODEM_DDR &= ~_BV(MODEM_PIN); @@ -94,3 +98,9 @@ void Modem::init() { /* Timer: TCCR1: CS10 and CS11 bits: 8MHz clock with Prescaler 64 = 125kHz timer clock */ TCCR1B = _BV(CS11) | _BV(CS10); } + +void Modem::disable() +{ + PORTA &= ~_BV(PA3); + DDRA &= ~_BV(PA3); +} |