diff --git a/device.h b/device.h index c26447a..92d3a63 100644 --- a/device.h +++ b/device.h @@ -5,7 +5,7 @@ // CPU settings #define TARGET_CPU m328p -#define F_CPU 16000000 +#define F_CPU 8000000 #define FREQUENCY_CORRECTION 0 // ADC settings @@ -18,9 +18,9 @@ #define CONFIG_AFSK_DAC_SAMPLERATE 9600 // Serial protocol settings -#define SERIAL_PROTOCOL PROTOCOL_KISS +//#define SERIAL_PROTOCOL PROTOCOL_KISS // OR -//#define SERIAL_PROTOCOL PROTOCOL_SIMPLE_SERIAL +#define SERIAL_PROTOCOL PROTOCOL_SIMPLE_SERIAL // AX25 settings #if SERIAL_PROTOCOL == PROTOCOL_SIMPLE_SERIAL @@ -42,4 +42,4 @@ #define ADC_DDR DDRC #endif -#endif \ No newline at end of file +#endif diff --git a/hardware/AFSK.c b/hardware/AFSK.c index c8c5f90..799db33 100644 --- a/hardware/AFSK.c +++ b/hardware/AFSK.c @@ -495,13 +495,17 @@ void AFSK_adc_isr(Afsk *afsk, int8_t currentSample) { } +// Set the DAC pins to their output, and clear the PTT pin (which is +// hardware pin 3 on PORT D) when transmitting. Set the DAC pins to +// "zero" (i.e. half of full potential) and set the PTT pin when not +// transmitting. ISR(ADC_vect) { TIFR1 = _BV(ICF1); AFSK_adc_isr(AFSK_modem, ((int16_t)((ADC) >> 2) - 128)); if (hw_afsk_dac_isr) { - DAC_PORT = (AFSK_dac_isr(AFSK_modem) & 0xF0) | _BV(3); + DAC_PORT = (AFSK_dac_isr(AFSK_modem) & 0xF0) & ~_BV(3); } else { - DAC_PORT = 128; + DAC_PORT = 128 | _BV(3); } ++_clock; -} \ No newline at end of file +} diff --git a/hardware/AFSK.h b/hardware/AFSK.h index aecce47..74890a2 100644 --- a/hardware/AFSK.h +++ b/hardware/AFSK.h @@ -137,23 +137,23 @@ typedef struct Afsk #define AFSK_DAC_IRQ_START() do { extern bool hw_afsk_dac_isr; hw_afsk_dac_isr = true; } while (0) #define AFSK_DAC_IRQ_STOP() do { extern bool hw_afsk_dac_isr; hw_afsk_dac_isr = false; } while (0) -#define AFSK_DAC_INIT() do { DAC_DDR |= 0xF8; } while (0) +#define AFSK_DAC_INIT() do { DAC_DDR |= 0xF8; DAC_PORT |= _BV(3); } while (0) // Here's some macros for controlling the RX/TX LEDs // THE _INIT() functions writes to the DDRB register // to configure the pins as output pins, and the _ON() // and _OFF() functions writes to the PORT registers // to turn the pins on or off. -#define LED_TX_INIT() do { LED_DDR |= _BV(1); } while (0) -#define LED_TX_ON() do { LED_PORT |= _BV(1); } while (0) -#define LED_TX_OFF() do { LED_PORT &= ~_BV(1); } while (0) +#define LED_TX_INIT() do { LED_DDR |= _BV(2); } while (0) +#define LED_TX_ON() do { LED_PORT |= _BV(2); } while (0) +#define LED_TX_OFF() do { LED_PORT &= ~_BV(2); } while (0) -#define LED_RX_INIT() do { LED_DDR |= _BV(2); } while (0) -#define LED_RX_ON() do { LED_PORT |= _BV(2); } while (0) -#define LED_RX_OFF() do { LED_PORT &= ~_BV(2); } while (0) +#define LED_RX_INIT() do { LED_DDR |= _BV(1); } while (0) +#define LED_RX_ON() do { LED_PORT |= _BV(1); } while (0) +#define LED_RX_OFF() do { LED_PORT &= ~_BV(1); } while (0) void AFSK_init(Afsk *afsk); void AFSK_transmit(char *buffer, size_t size); void AFSK_poll(Afsk *afsk); -#endif \ No newline at end of file +#endif diff --git a/main.c b/main.c index 9ff480b..ff23377 100644 --- a/main.c +++ b/main.c @@ -77,6 +77,7 @@ int main (void) { if (!sertx && serial_available(0)) { sbyte = uart0_getchar_nowait(); + // uart0_putchar(sbyte); // echo it back #if SERIAL_DEBUG if ((serialLen < AX25_MAX_FRAME_LEN) && (sbyte != 10)) { @@ -113,4 +114,4 @@ int main (void) { #endif return(0); -} \ No newline at end of file +}