From 2575089632baea41591ffa794914455d35b5d52a Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 15 Jan 2016 18:04:46 +0100 Subject: fix Modem::init (used the wrong DEFINEs in some places), add modem test to main --- src/main.cc | 10 ++-------- src/modem.cc | 10 ++++++---- src/modem.h | 5 ++++- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/main.cc b/src/main.cc index 4ba15aa..eb523ce 100644 --- a/src/main.cc +++ b/src/main.cc @@ -33,14 +33,8 @@ int main (void) // raise timer interrupt on counter overflow (-> interrupt frequency = ~4kHz) TIMSK0 = _BV(TOIE0); - disp[0] = font[8][1]; - disp[1] = font[8][2]; - disp[2] = font[8][3]; - disp[3] = font[8][4]; - disp[4] = font[8][5]; - disp[5] = font[8][6]; - disp[6] = font[8][7]; - disp[7] = font[8][8]; + disp[0] = 0xff; + disp[1] = 0xaa; #if 0 // smile! diff --git a/src/modem.cc b/src/modem.cc index 6020a15..cb3a6ee 100644 --- a/src/modem.cc +++ b/src/modem.cc @@ -7,6 +7,8 @@ * License: LGPLv3, see COPYING, and COPYING.LESSER -files for more info */ +#include +#include #include "modem.h" /* Ring buffer global variables */ @@ -83,12 +85,12 @@ ISR(PCINT3_vect) { */ void Modem::init() { /* Modem pin as input */ - MODEM_DDR &= ~(1 << MODEM_PIN); + MODEM_DDR &= ~_BV(MODEM_PIN); /* Enable Pin Change Interrupts and PCINT for MODEM_PIN */ - PCMSK1 |= _BV(MODEM_PIN); - PCICR |= _BV(PCIE3); + MODEM_PCMSK |= _BV(MODEM_PCINT); + PCICR |= _BV(MODEM_PCIE); /* Timer: TCCR1: CS10 and CS11 bits: 8MHz clock with Prescaler 64 = 125kHz timer clock */ TCCR1B = _BV(CS11) | _BV(CS10); -} +} diff --git a/src/modem.h b/src/modem.h index c02101c..9c629a5 100644 --- a/src/modem.h +++ b/src/modem.h @@ -16,7 +16,10 @@ /* Modem defines */ #define MODEM_SYNC_LEN 42 #define MODEM_TIMER TCNT1L -#define MODEM_PIN PCINT24 +#define MODEM_PCINT PCINT24 +#define MODEM_PCMSK PCMSK3 +#define MODEM_PCIE PCIE3 +#define MODEM_PIN PA0 #define MODEM_DDR DDRA class Modem { -- cgit v1.2.3