BeRTOS
Defines | Functions | Variables
afsk.c File Reference

AFSK1200 modem. More...

#include "afsk.h"
#include <net/ax25.h>
#include "cfg/cfg_afsk.h"
#include "hw/hw_afsk.h"
#include <drv/timer.h>
#include <cfg/module.h>
#include <cfg/log.h>
#include <cpu/power.h>
#include <cpu/pgm.h>
#include <struct/fifobuf.h>
#include <string.h>

Go to the source code of this file.

Defines

#define SIN_LEN   512
 Full wave length.

Functions

uint8_t sin_sample (uint16_t idx)
 Given the index, this function computes the correct sine sample based only on the first quarter of wave.
static bool hdlc_parse (Hdlc *hdlc, bool bit, FIFOBuffer *fifo)
 High-Level Data Link Control parsing function.
void afsk_adc_isr (Afsk *af, int8_t curr_sample)
 ADC ISR callback.
uint8_t afsk_dac_isr (Afsk *af)
 DAC ISR callback.
void afsk_init (Afsk *af, int adc_ch, int dac_ch)
 Initialize an AFSK1200 modem.

Variables

static const uint8_t PROGMEM sin_table []
 Sine table for the first quarter of wave.

Detailed Description

AFSK1200 modem.

Author:
Francesco Sacchi <batt@develer.com>

Definition in file afsk.c.


Function Documentation

void afsk_adc_isr ( Afsk af,
int8_t  curr_sample 
)

ADC ISR callback.

This function has to be called by the ADC ISR when a sample of the configured channel is available.

Parameters:
afAfsk context to operate on.
curr_samplecurrent sample from the ADC.

Definition at line 210 of file afsk.c.

uint8_t afsk_dac_isr ( Afsk af)

DAC ISR callback.

This function has to be called by the DAC ISR when a sample of the configured channel has been converted out.

Parameters:
afAfsk context to operate on.
Returns:
The next DAC output sample.

Definition at line 342 of file afsk.c.

void afsk_init ( Afsk af,
int  adc_ch,
int  dac_ch 
)

Initialize an AFSK1200 modem.

Parameters:
afAfsk context to operate on.
adc_chADC channel used by the demodulator.
dac_chDAC channel used by the modulator.

Definition at line 537 of file afsk.c.

static bool hdlc_parse ( Hdlc hdlc,
bool  bit,
FIFOBuffer *  fifo 
) [static]

High-Level Data Link Control parsing function.

Parse bitstream in order to find characters.

Parameters:
hdlcHDLC context.
bitcurrent bit to be parsed.
fifoFIFO buffer used to push characters.
Returns:
true if all is ok, false if the fifo is full.

Definition at line 127 of file afsk.c.


Variable Documentation

const uint8_t PROGMEM sin_table[] [static]
Initial value:
{
    128, 129, 131, 132, 134, 135, 137, 138, 140, 142, 143, 145, 146, 148, 149, 151,
    152, 154, 155, 157, 158, 160, 162, 163, 165, 166, 167, 169, 170, 172, 173, 175,
    176, 178, 179, 181, 182, 183, 185, 186, 188, 189, 190, 192, 193, 194, 196, 197,
    198, 200, 201, 202, 203, 205, 206, 207, 208, 210, 211, 212, 213, 214, 215, 217,
    218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233,
    234, 234, 235, 236, 237, 238, 238, 239, 240, 241, 241, 242, 243, 243, 244, 245,
    245, 246, 246, 247, 248, 248, 249, 249, 250, 250, 250, 251, 251, 252, 252, 252,
    253, 253, 253, 253, 254, 254, 254, 254, 254, 255, 255, 255, 255, 255, 255, 255,
}

Sine table for the first quarter of wave.

The rest of the wave is computed from this first quarter. This table is used to generate the modulated data.

Definition at line 81 of file afsk.c.