Working build

This commit is contained in:
Mark Qvist 2014-12-18 23:45:36 +01:00
parent 4119591f88
commit 35c504703c
10 changed files with 1159 additions and 34 deletions

View file

@ -7,20 +7,37 @@ extern unsigned long custom_preamble;
extern unsigned long custom_tail;
bool hw_afsk_dac_isr = false;
bool hw_5v_ref = false;
Afsk *AFSK_modem;
// Forward declerations
int afsk_getchar(void);
void afsk_putchar(char c);
void AFSK_hw_refDetect(void) {
// This is manual for now
#if ADC_REFERENCE == REF_5V
hw_5v_ref = true;
#else
hw_5v_ref = false;
#endif
}
void AFSK_hw_init(void) {
// Set up ADC
AFSK_hw_refDetect();
TCCR1A = 0;
TCCR1B = _BV(CS10) | _BV(WGM13) | _BV(WGM12);
ICR1 = (((CPU_FREQ+FREQUENCY_CORRECTION)) / 9600) - 1;
// TODO: Implement reference detection
ADMUX = _BV(REFS0) | 0;
if (hw_5v_ref) {
ADMUX = _BV(REFS0) | 0;
} else {
ADMUX = 0;
}
ADC_DDR &= ~_BV(0);
ADC_PORT &= ~_BV(0);
DIDR0 |= _BV(0);