diff options
Diffstat (limited to 'src/gadc/gadc.c')
-rw-r--r-- | src/gadc/gadc.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/gadc/gadc.c b/src/gadc/gadc.c index 509557d3..8a3cfb8d 100644 --- a/src/gadc/gadc.c +++ b/src/gadc/gadc.c @@ -83,6 +83,7 @@ static struct hsdev { size_t remaining; BinarySemaphore *bsem; GEventADC *pEvent; + GADCISRCallbackFunction isrfn; } hs; static struct lsdev { @@ -181,6 +182,11 @@ void GADC_ISR_CompleteI(ADCDriver *adcp, adcsample_t *buffer, size_t n) { hs.pEvent->buffer = hs.lastbuffer; hs.pEvent->flags = hs.lastflags; } + + /* Our three signalling mechanisms */ + if (hs.isrfn) + hs.isrfn(buffer, n); + if (hs.bsem) chBSemSignalI(hs.bsem); @@ -344,6 +350,7 @@ void gadcHighSpeedInit(uint32_t physdev, uint32_t frequency, adcsample_t *buffer hs.remaining = bufcount; hs.bsem = 0; hs.pEvent = 0; + hs.isrfn = 0; } #if GFX_USE_GEVENT @@ -356,6 +363,10 @@ void gadcHighSpeedInit(uint32_t physdev, uint32_t frequency, adcsample_t *buffer } #endif +void gadcHighSpeedSetISRCallback(GADCISRCallbackFunction isrfn) { + hs.isrfn = isrfn; +} + void gadcHighSpeedSetBSem(BinarySemaphore *pbsem, GEventADC *pEvent) { DoInit(); |