From: batt Date: Sat, 10 Oct 2009 12:53:46 +0000 (+0000) Subject: Simplify DAC ISR interface: now afsk_dac_isr() return the next sample. X-Git-Tag: 2.3.0~14 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=84970fa56eb2168c2d564ac17b1fa21b9e4daef4;p=bertos.git Simplify DAC ISR interface: now afsk_dac_isr() return the next sample. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3069 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/bertos/net/afsk.c b/bertos/net/afsk.c index 4a195891..5efce302 100644 --- a/bertos/net/afsk.c +++ b/bertos/net/afsk.c @@ -342,10 +342,9 @@ static void afsk_txStart(Afsk *af) * * \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. + * \return The next DAC output sample. */ -void afsk_dac_isr(Afsk *af) +uint8_t afsk_dac_isr(Afsk *af) { /* Check if we are at a start of a sample cycle */ if (af->sample_count == 0) @@ -357,7 +356,7 @@ void afsk_dac_isr(Afsk *af) { AFSK_DAC_IRQ_STOP(af->dac_ch); af->sending = false; - return; + return 0; } else { @@ -396,7 +395,7 @@ void afsk_dac_isr(Afsk *af) { AFSK_DAC_IRQ_STOP(af->dac_ch); af->sending = false; - return; + return 0; } else af->curr_out = fifo_pop(&af->tx_fifo); @@ -453,8 +452,8 @@ void afsk_dac_isr(Afsk *af) af->phase_acc += af->phase_inc; af->phase_acc %= SIN_LEN; - AFSK_DAC_SET(af->dac_ch, sin_sample(af->phase_acc)); af->sample_count--; + return sin_sample(af->phase_acc); } diff --git a/bertos/net/afsk.h b/bertos/net/afsk.h index 5f75b3e3..bd82e660 100644 --- a/bertos/net/afsk.h +++ b/bertos/net/afsk.h @@ -205,7 +205,7 @@ INLINE Afsk *AFSK_CAST(KFile *fd) void afsk_adc_isr(Afsk *af, int8_t sample); -void afsk_dac_isr(Afsk *af); +uint8_t afsk_dac_isr(Afsk *af); void afsk_init(Afsk *af, int adc_ch, int dac_ch); diff --git a/bertos/net/afsk_test.c b/bertos/net/afsk_test.c index 7ce7b4c6..09c1ffdb 100644 --- a/bertos/net/afsk_test.c +++ b/bertos/net/afsk_test.c @@ -184,8 +184,11 @@ int afsk_testRun(void) ax25_send(&ax25, AX25_CALL("abcdef", 0), AX25_CALL("123456", 1), buf, sizeof(buf)); while (afsk_tx_test) - afsk_dac_isr(&afsk_fd); - + { + int8_t val = afsk_dac_isr(&afsk_fd) - 128; + ASSERT(fwrite(&val, 1, sizeof(val), fp_dac) == sizeof(val)); + data_written++; + } #define SND_DATASIZE_OFF 8 #if CPU_AVR