Cleaned up port mapping mess
This commit is contained in:
parent
ab4e337a18
commit
b4de1f73ea
12
Modem/afsk.c
12
Modem/afsk.c
|
@ -346,9 +346,8 @@ static void afsk_txStart(Afsk *afsk) {
|
||||||
afsk->bitstuffCount = 0;
|
afsk->bitstuffCount = 0;
|
||||||
afsk->sending = true;
|
afsk->sending = true;
|
||||||
LED_TX_ON();
|
LED_TX_ON();
|
||||||
PTT_ON();
|
|
||||||
afsk->preambleLength = DIV_ROUND(CONFIG_AFSK_PREAMBLE_LEN * BITRATE, 8000);
|
afsk->preambleLength = DIV_ROUND(CONFIG_AFSK_PREAMBLE_LEN * BITRATE, 8000);
|
||||||
AFSK_DAC_IRQ_START(afsk->dacPin);
|
AFSK_DAC_IRQ_START();
|
||||||
}
|
}
|
||||||
ATOMIC(afsk->tailLength = DIV_ROUND(CONFIG_AFSK_TRAILER_LEN * BITRATE, 8000));
|
ATOMIC(afsk->tailLength = DIV_ROUND(CONFIG_AFSK_TRAILER_LEN * BITRATE, 8000));
|
||||||
}
|
}
|
||||||
|
@ -363,10 +362,9 @@ uint8_t afsk_dac_isr(Afsk *afsk) {
|
||||||
// If TX FIFO is empty and tail-length has decremented to 0
|
// If TX FIFO is empty and tail-length has decremented to 0
|
||||||
// we are done, stop the IRQ and reset
|
// we are done, stop the IRQ and reset
|
||||||
if (fifo_isempty(&afsk->txFifo) && afsk->tailLength == 0) {
|
if (fifo_isempty(&afsk->txFifo) && afsk->tailLength == 0) {
|
||||||
AFSK_DAC_IRQ_STOP(afsk->dacPin);
|
AFSK_DAC_IRQ_STOP();
|
||||||
afsk->sending = false;
|
afsk->sending = false;
|
||||||
LED_TX_OFF();
|
LED_TX_OFF();
|
||||||
PTT_OFF();
|
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
// Reset the bitstuff counter if we have just sent
|
// Reset the bitstuff counter if we have just sent
|
||||||
|
@ -394,10 +392,9 @@ uint8_t afsk_dac_isr(Afsk *afsk) {
|
||||||
// Handle escape sequences
|
// Handle escape sequences
|
||||||
if (afsk->currentOutputByte == AX25_ESC) {
|
if (afsk->currentOutputByte == AX25_ESC) {
|
||||||
if (fifo_isempty(&afsk->txFifo)) {
|
if (fifo_isempty(&afsk->txFifo)) {
|
||||||
AFSK_DAC_IRQ_STOP(afsk->dacPin);
|
AFSK_DAC_IRQ_STOP();
|
||||||
afsk->sending = false;
|
afsk->sending = false;
|
||||||
LED_TX_OFF();
|
LED_TX_OFF();
|
||||||
PTT_OFF();
|
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
afsk->currentOutputByte = fifo_pop(&afsk->txFifo);
|
afsk->currentOutputByte = fifo_pop(&afsk->txFifo);
|
||||||
|
@ -543,10 +540,9 @@ void afsk_init(Afsk *afsk, int _adcPin, int _dacPin) {
|
||||||
|
|
||||||
// Init DAC & ADC
|
// Init DAC & ADC
|
||||||
AFSK_ADC_INIT(_adcPin, afsk);
|
AFSK_ADC_INIT(_adcPin, afsk);
|
||||||
AFSK_DAC_INIT(_dacPin, afsk);
|
AFSK_DAC_INIT();
|
||||||
LED_TX_INIT();
|
LED_TX_INIT();
|
||||||
LED_RX_INIT();
|
LED_RX_INIT();
|
||||||
PTT_INIT();
|
|
||||||
|
|
||||||
DB(afsk->fd._type = KFT_AFSK);
|
DB(afsk->fd._type = KFT_AFSK);
|
||||||
afsk->fd.write = afsk_write;
|
afsk->fd.write = afsk_write;
|
||||||
|
|
|
@ -20,11 +20,6 @@ struct Afsk;
|
||||||
void hw_afsk_adcInit(int ch, struct Afsk *_ctx);
|
void hw_afsk_adcInit(int ch, struct Afsk *_ctx);
|
||||||
void hw_afsk_dacInit(int ch, struct Afsk *_ctx);
|
void hw_afsk_dacInit(int ch, struct Afsk *_ctx);
|
||||||
|
|
||||||
// A shorthand macro for initializing the ADC.
|
|
||||||
// It just calls the actual ADC initialization code
|
|
||||||
// in "hardware.c"
|
|
||||||
#define AFSK_ADC_INIT(ch, ctx) hw_afsk_adcInit(ch, ctx)
|
|
||||||
|
|
||||||
// Here's some macros for controlling the RX/TX LEDs
|
// Here's some macros for controlling the RX/TX LEDs
|
||||||
// THE _INIT() functions writes to the DDRB register
|
// THE _INIT() functions writes to the DDRB register
|
||||||
// to configure the pins as output pins, and the _ON()
|
// to configure the pins as output pins, and the _ON()
|
||||||
|
@ -38,26 +33,24 @@ void hw_afsk_dacInit(int ch, struct Afsk *_ctx);
|
||||||
#define LED_RX_ON() do { PORTB |= 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 LED_RX_OFF() do { PORTB &= ~BV(2); } while (0)
|
||||||
|
|
||||||
|
// A shorthand macro for initializing the ADC.
|
||||||
// FIXME: remove these, they're in the DAC writes now
|
// It just calls the actual ADC initialization code
|
||||||
#define PTT_INIT() do { DDRD |= BV(3); } while (0)
|
// in "hardware.c"
|
||||||
#define PTT_ON() do { PORTD |= BV(3); } while (0)
|
#define AFSK_ADC_INIT(ch, ctx) hw_afsk_adcInit(ch, ctx)
|
||||||
#define PTT_OFF() do { PORTD &= ~BV(3); } while (0)
|
|
||||||
|
|
||||||
// Initialization of the DAC pins. The DDRD register
|
// Initialization of the DAC pins. The DDRD register
|
||||||
// configures pins 0 through 7 for input or output.
|
// configures pins 0 through 7 for input or output.
|
||||||
// DDR stands for Data Direction Register. By setting
|
// DDR stands for Data Direction Register. By setting
|
||||||
// it to 0xF8 we set 11111000, which means the pins
|
// it to 0xF8 we set 11111000, which means the pins
|
||||||
// 3, 4, 5, 6 and 7 will be set to output.
|
// 3, 4, 5, 6 and 7 will be set to output.
|
||||||
// FIXME: remove ch and ctx
|
#define AFSK_DAC_INIT() do { DDRD |= 0xF8; } while (0)
|
||||||
#define AFSK_DAC_INIT(ch, ctx) do { (void)ch, (void)ctx; DDRD |= 0xF8; DDRB |= BV(3); } while (0)
|
|
||||||
|
|
||||||
// These two macros start and stop the DAC being
|
// These two macros start and stop the DAC routine
|
||||||
// triggered in our timer interrupt. For starting
|
// being called in our timer interrupt. For starting
|
||||||
// it, we set a boolean flag to true, and false for
|
// it, we set a boolean flag to true, and false for
|
||||||
// stopping it. We also turn on and off pin 3 to trigger
|
// stopping it. We also turn on and off pin 3 to trigger
|
||||||
// the PTT of the radio.
|
// the PTT of the radio.
|
||||||
#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_START() do { extern bool hw_afsk_dac_isr; PORTD |= 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)
|
#define AFSK_DAC_IRQ_STOP() do { extern bool hw_afsk_dac_isr; PORTD &= ~BV(3); hw_afsk_dac_isr = false; } while (0)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
#define VERS_BUILD 361
|
#define VERS_BUILD 371
|
||||||
#define VERS_HOST "vixen"
|
#define VERS_HOST "vixen"
|
||||||
|
|
Loading…
Reference in New Issue