X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fnet%2Fafsk.h;h=b23ba63dde1016e4ed0fb101ddf19066efab4e66;hb=56f2c002c50338f23f1b969ba51a43b0eb24f3da;hp=4a040fd9f4efb68e6cf6b3e951f936abcd848b6e;hpb=ffc60adf95aa2e09cb0013242790c761a0bf594c;p=bertos.git diff --git a/bertos/net/afsk.h b/bertos/net/afsk.h index 4a040fd9..b23ba63d 100644 --- a/bertos/net/afsk.h +++ b/bertos/net/afsk.h @@ -32,8 +32,7 @@ * * \brief AFSK1200 modem. * - * \version $Id$ - * \author Francesco Sacchi + * \author Francesco Sacchi * * $WIZ$ module_name = "afsk" * $WIZ$ module_configuration = "bertos/cfg/cfg_afsk.h" @@ -41,14 +40,16 @@ * $WIZ$ module_hw = "bertos/hw/hw_afsk.h" */ -#ifndef DRV_AFSK_H -#define DRV_AFSK_H +#ifndef NET_AFSK_H +#define NET_AFSK_H #include "cfg/cfg_afsk.h" #include "hw/hw_afsk.h" -#include #include + +#include + #include @@ -81,6 +82,10 @@ typedef struct Hdlc bool rxstart; ///< True if an HDLC_FLAG char has been found in the bitstream. } Hdlc; +/** + * RX FIFO buffer full error. + */ +#define AFSK_RXFIFO_OVERRUN BV(0) /** * AFSK1200 modem context. @@ -165,6 +170,12 @@ typedef struct Afsk /** True while modem sends data */ volatile bool sending; + /** + * AFSK modem status. + * If 0 all is ok, otherwise errors are present. + */ + volatile int status; + /** Hdlc context */ Hdlc hdlc; @@ -177,7 +188,7 @@ typedef struct Afsk uint16_t preamble_len; /** - * Preamble length. + * Trailer length. * After sending the actual data, the AFSK shifts out * trailer_len HDLC_FLAG characters. * This helps to synchronize the demodulator filters on the receiver side. @@ -193,38 +204,14 @@ INLINE Afsk *AFSK_CAST(KFile *fd) return (Afsk *)fd; } -/** - * 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_adc_isr(Afsk *af, int8_t sample); +uint8_t afsk_dac_isr(Afsk *af); void afsk_init(Afsk *af, int adc_ch, int dac_ch); /** - * \name afsk filter type + * \name Afsk filter types. * $WIZ$ afsk_filter_list = "AFSK_BUTTERWORTH", "AFSK_CHEBYSHEV" * \{ */ @@ -236,4 +223,4 @@ int afsk_testSetup(void); int afsk_testRun(void); int afsk_testTearDown(void); -#endif +#endif /* NET_AFSK_H */