OpenModem/Modem/hardware.h

35 lines
1.2 KiB
C
Raw Normal View History

2014-04-03 14:21:37 -06:00
2014-04-03 14:29:26 -06:00
#ifndef FSK_MODEM_HW
#define FSK_MODEM_HW
2014-04-03 14:21:37 -06:00
#include "cfg/cfg_arch.h"
#include <avr/io.h>
struct Afsk;
void hw_afsk_adcInit(int ch, struct Afsk *_ctx);
void hw_afsk_dacInit(int ch, struct Afsk *_ctx);
2014-04-03 14:54:34 -06:00
// ADC initialization
2014-04-03 14:21:37 -06:00
#define AFSK_ADC_INIT(ch, ctx) hw_afsk_adcInit(ch, ctx)
2014-04-06 09:17:13 -06:00
// LED TX/RX on/off (pin 9/10)
#define LED_TX_INIT() do { DDRB |= BV(1); } while (0)
#define LED_TX_ON() do { PORTB |= BV(1); } while (0)
#define LED_TX_OFF() do { PORTB &= ~BV(1); } while (0)
#define LED_RX_INIT() do { DDRB |= BV(2); } while (0)
#define LED_RX_ON() do { PORTB |= BV(2); } while (0)
#define LED_RX_OFF() do { PORTB &= ~BV(2); } while (0)
#define PTT_INIT() do { DDRD |= BV(3); } while (0)
#define PTT_ON() do { PORTD |= BV(3); } while (0)
#define PTT_OFF() do { PORTD &= ~BV(3); } while (0)
2014-04-03 14:21:37 -06:00
2014-04-03 14:29:26 -06:00
// Initialization, start and stop for DAC
2014-04-06 09:17:13 -06:00
#define AFSK_DAC_INIT(ch, ctx) do { (void)ch, (void)ctx; DDRD |= 0xF4; DDRB |= BV(3); } while (0)
2014-04-03 14:21:37 -06:00
#define AFSK_DAC_IRQ_START(ch) do { (void)ch; extern bool hw_afsk_dac_isr; PORTB |= BV(3); hw_afsk_dac_isr = true; } while (0)
#define AFSK_DAC_IRQ_STOP(ch) do { (void)ch; extern bool hw_afsk_dac_isr; PORTB &= ~BV(3); hw_afsk_dac_isr = false; } while (0)
2014-04-03 14:29:26 -06:00
#endif