aboutsummaryrefslogtreecommitdiffstats
path: root/src/gadc
diff options
context:
space:
mode:
authorTectu <joel@unormal.org>2013-02-28 15:09:13 -0800
committerTectu <joel@unormal.org>2013-02-28 15:09:13 -0800
commit1802c5d6aca67b2c20c00a18aa3e568fe02f9d0f (patch)
tree2ea08726aae7357443420ce45100c8118923dfdd /src/gadc
parent778cfcd928211246b45ce67c373280fe6adceb11 (diff)
parent6ee8b005ae3ee2bc48ea6ac972b0d3b2a2949608 (diff)
downloaduGFX-1802c5d6aca67b2c20c00a18aa3e568fe02f9d0f.tar.gz
uGFX-1802c5d6aca67b2c20c00a18aa3e568fe02f9d0f.tar.bz2
uGFX-1802c5d6aca67b2c20c00a18aa3e568fe02f9d0f.zip
Merge pull request #34 from inmarket/master
GAUDIN module implemented with a GADC driver
Diffstat (limited to 'src/gadc')
-rw-r--r--src/gadc/gadc.c11
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();