diff options
Diffstat (limited to 'drivers/gaudio/gadc/gaudio_record_lld.c')
-rw-r--r-- | drivers/gaudio/gadc/gaudio_record_lld.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/drivers/gaudio/gadc/gaudio_record_lld.c b/drivers/gaudio/gadc/gaudio_record_lld.c index ee994dc1..6f4cb2de 100644 --- a/drivers/gaudio/gadc/gaudio_record_lld.c +++ b/drivers/gaudio/gadc/gaudio_record_lld.c @@ -8,10 +8,6 @@ /** * @file drivers/gaudio/gadc/gaudio_record_lld.c * @brief GAUDIO - Record Driver file for using the cpu ADC (via GADC). - * - * @addtogroup GAUDIO - * - * @{ */ /** @@ -19,8 +15,6 @@ * from the board definitions. */ #define GAUDIO_RECORD_IMPLEMENTATION - - #include "gfx.h" #if GFX_USE_GAUDIO && GAUDIO_NEED_RECORD @@ -33,30 +27,38 @@ /* Include the driver defines */ #include "src/gaudio/driver_record.h" +static void gadcCallbackI(void) { + GDataBuffer *pd; + + pd = gadcHighSpeedGetDataI(); + if (pd) + gaudioRecordSaveDataBlockI(pd); +} + /*===========================================================================*/ /* External declarations. */ /*===========================================================================*/ -void gaudin_lld_init(const gaudin_params *paud) { +bool_t gaudio_record_lld_init(uint16_t channel, uint32_t frequency, ArrayDataFormat format) { + /* Check the parameters */ + if (channel >= GAUDIO_RECORD_NUM_CHANNELS || frequency > GAUDIO_RECORD_MAX_SAMPLE_FREQUENCY || format != GAUDIO_RECORD_FORMAT1) + return FALSE; + /* Setup the high speed GADC */ - gadcHighSpeedInit(gaudin_lld_physdevs[paud->channel], paud->frequency, paud->buffer, paud->bufcount, paud->samplesPerEvent); + gadcHighSpeedInit(gaudio_gadc_physdevs[channel], frequency); /* Register ourselves for ISR callbacks */ - gadcHighSpeedSetISRCallback(GAUDIN_ISR_CompleteI); + gadcHighSpeedSetISRCallback(gadcCallbackI); - /** - * The gadc driver handles any errors for us by restarting the transaction so there is - * no need for us to setup anything for GAUDIN_ISR_ErrorI() - */ + return TRUE; } -void gaudin_lld_start(void) { +void gaudio_record_lld_start(void) { gadcHighSpeedStart(); } -void gaudin_lld_stop(void) { +void gaudio_record_lld_stop(void) { gadcHighSpeedStop(); } #endif /* GFX_USE_GAUDIO && GAUDIO_NEED_RECORD */ -/** @} */ |