From: batt Date: Sat, 10 Oct 2009 11:11:54 +0000 (+0000) Subject: Add some documentation. X-Git-Tag: 2.3.0~21 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=ffc60adf95aa2e09cb0013242790c761a0bf594c;p=bertos.git Add some documentation. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3062 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/bertos/net/afsk.c b/bertos/net/afsk.c index 4164fccd..c30cb225 100644 --- a/bertos/net/afsk.c +++ b/bertos/net/afsk.c @@ -254,7 +254,9 @@ void afsk_adc_isr(Afsk *af, int8_t curr_sample) * Determine bit value by reading the last 3 sampled bits. * If the number of ones is two or greater, the bit value is a 1, * otherwise is a 0. + * This algorithm presumes that there are 8 samples per bit. */ + STATIC_ASSERT(SAMPLEPERBIT == 8); uint8_t bits = af->sampled_bits & 0x07; if (bits == 0x07 // 111, 3 bits set to 1 || bits == 0x06 // 110, 2 bits diff --git a/bertos/net/afsk.h b/bertos/net/afsk.h index 902c5b94..4a040fd9 100644 --- a/bertos/net/afsk.h +++ b/bertos/net/afsk.h @@ -52,8 +52,19 @@ #include -// Demodulator constants + +/** + * ADC sample rate. + * The demodulator filters are designed to work at this frequency. + * If you need to change this remember to update afsk_adc_isr(). + */ #define SAMPLERATE 9600 + +/** + * Bitrate of the received/transmitted data. + * The demodulator filters and decoderes are designed to work at this frequency. + * If you need to change this remember to update afsk_adc_isr(). + */ #define BITRATE 1200 #define SAMPLEPERBIT (SAMPLERATE / BITRATE) @@ -182,8 +193,33 @@ INLINE Afsk *AFSK_CAST(KFile *fd) return (Afsk *)fd; } -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. + * \param af Afsk context to operate one (\see Afsk). + * \param sample current sample from the ADC. + */ +void afsk_adc_isr(Afsk *af, int8_t sample); + +/** + * DAC ISR callback. + * This function has to be called by the DAC ISR when a sample of the configured + * channel has been converted out. + * + * \param af Afsk context to operate one (\see Afsk). + * + * \note The next DAC output sample is supplied by the Afsk driver through calling + * the AFSK_DAC_SET() callback. + */ void afsk_dac_isr(Afsk *af); + +/** + * Initialize an AFSK1200 modem. + * \param af Afsk context to operate one (\see Afsk). + * \param adc_ch ADC channel used by the demodulator. + * \param dac_ch DAC channel used by the modulator. + */ void afsk_init(Afsk *af, int adc_ch, int dac_ch);