This commit is contained in:
Mark Qvist 2014-04-04 08:58:18 +02:00
parent 2dc4e73d38
commit 6b496c35eb
3 changed files with 6 additions and 13 deletions

View File

@ -5,12 +5,9 @@
#include <drv/timer.h> #include <drv/timer.h>
#include <cfg/module.h> #include <cfg/module.h>
#include <cfg/log.h>
#include <cpu/power.h> #include <cpu/power.h>
#include <cpu/pgm.h> #include <cpu/pgm.h>
#include <struct/fifobuf.h> #include <struct/fifobuf.h>
#include <string.h> #include <string.h>
// Sine table for DAC DDS // Sine table for DAC DDS
@ -28,7 +25,7 @@ static const uint8_t PROGMEM sin_table[] =
}; STATIC_ASSERT(sizeof(sin_table) == SIN_LEN / 4); }; STATIC_ASSERT(sizeof(sin_table) == SIN_LEN / 4);
// Calculate Sine value from quarter sine table // Calculate any sine value from quarter wave sine table
INLINE uint8_t sinSample(uint16_t i) { INLINE uint8_t sinSample(uint16_t i) {
ASSERT(i < SIN_LEN); ASSERT(i < SIN_LEN);
uint16_t newI = i % (SIN_LEN/2); uint16_t newI = i % (SIN_LEN/2);
@ -147,7 +144,7 @@ void afsk_adc_isr(Afsk *afsk, int8_t currentSample) {
// the bit of the sample, we multiply the sample by // the bit of the sample, we multiply the sample by
// a sample delayed by (samples per bit / 2). // a sample delayed by (samples per bit / 2).
// We then lowpass-filter the sample with a first // We then lowpass-filter the sample with a first
// order 600Hz filter // order 600Hz filter. This is a Chebyshev filter.
afsk->iirX[0] = afsk->iirX[1]; afsk->iirX[0] = afsk->iirX[1];
afsk->iirX[1] = ((int8_t)fifo_pop(&afsk->delayFifo) * currentSample) >> 2; afsk->iirX[1] = ((int8_t)fifo_pop(&afsk->delayFifo) * currentSample) >> 2;

View File

@ -10,9 +10,9 @@
#include <struct/fifobuf.h> #include <struct/fifobuf.h>
#define SAMPLERATE 9600 #define SAMPLERATE 9600 // The rate at which we are sampling and synthesizing
#define BITRATE 1200 #define BITRATE 1200 // The actual bitrate at baseband. This is the baudrate.
#define SAMPLESPERBIT (SAMPLERATE / BITRATE) #define SAMPLESPERBIT (SAMPLERATE / BITRATE) // How many DAC/ADC samples constitute on bit (8).
typedef struct Hdlc typedef struct Hdlc
{ {
@ -99,8 +99,4 @@ void afsk_adc_isr(Afsk *af, int8_t sample);
uint8_t afsk_dac_isr(Afsk *af); uint8_t afsk_dac_isr(Afsk *af);
void afsk_init(Afsk *af, int adc_ch, int dac_ch); void afsk_init(Afsk *af, int adc_ch, int dac_ch);
//int afsk_testSetup(void);
//int afsk_testRun(void);
//int afsk_testTearDown(void);
#endif #endif

View File

@ -1,2 +1,2 @@
#define VERS_BUILD 123 #define VERS_BUILD 126
#define VERS_HOST "vixen" #define VERS_HOST "vixen"