aboutsummaryrefslogtreecommitdiffstats
path: root/include/gadc/gadc.h
diff options
context:
space:
mode:
authorAndrew Hannam <andrewh@inmarket.com.au>2013-03-01 09:04:52 +1000
committerAndrew Hannam <andrewh@inmarket.com.au>2013-03-01 09:04:52 +1000
commit6ee8b005ae3ee2bc48ea6ac972b0d3b2a2949608 (patch)
tree2ea08726aae7357443420ce45100c8118923dfdd /include/gadc/gadc.h
parent9bec5967b293d6c23c9d7e9338d8ece4873f6eac (diff)
downloaduGFX-6ee8b005ae3ee2bc48ea6ac972b0d3b2a2949608.tar.gz
uGFX-6ee8b005ae3ee2bc48ea6ac972b0d3b2a2949608.tar.bz2
uGFX-6ee8b005ae3ee2bc48ea6ac972b0d3b2a2949608.zip
GAUDIN implemented with GADC driver
Diffstat (limited to 'include/gadc/gadc.h')
-rw-r--r--include/gadc/gadc.h34
1 files changed, 26 insertions, 8 deletions
diff --git a/include/gadc/gadc.h b/include/gadc/gadc.h
index be7af516..bd35b30c 100644
--- a/include/gadc/gadc.h
+++ b/include/gadc/gadc.h
@@ -96,10 +96,15 @@ typedef struct GEventADC_t {
} GEventADC;
/**
- * @brief A callback function (executed in a thread context)
+ * @brief A callback function (executed in a thread context) for a low speed conversion
*/
typedef void (*GADCCallbackFunction)(adcsample_t *buffer, void *param);
+/**
+ * @brief A callback function (executed in an ISR context) for a high speed conversion
+ */
+typedef void (*GADCISRCallbackFunction)(adcsample_t *buffer, size_t size);
+
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/
@@ -121,9 +126,9 @@ extern "C" {
* @note If the high speed ADC is running it will be stopped. The Event subsystem is
* disconnected from the high speed ADC and any binary semaphore event is forgotten.
* @note bufcount must be greater than countPerEvent (usually 2 or more times) otherwise
- * the buffer will be overwitten with new data while the application is still trying
+ * the buffer will be overwritten with new data while the application is still trying
* to process the old data.
- * @note Due to a bug in Chibi-OS countPerEvent must be even. If bufcount is not
+ * @note Due to a bug/feature in Chibi-OS countPerEvent must be even. If bufcount is not
* evenly divisable by countPerEvent, the remainder must also be even.
* @note The physdev parameter may be used to turn on more than one ADC channel.
* Each channel is then interleaved into the provided buffer. Note 'bufcount'
@@ -143,8 +148,7 @@ extern "C" {
* @note While the high speed ADC is running, low speed conversions can only occur at
* the frequency of the high speed events. Thus if high speed events are
* being created at 50Hz (eg countPerEvent = 100, frequency = 5kHz) then the maximum
- * frequency for low speed conversions is likely to be 50Hz (although it might be
- * 100Hz on some hardware).
+ * frequency for low speed conversions will be 50Hz.
*
* @api
*/
@@ -159,8 +163,8 @@ void gadcHighSpeedInit(uint32_t physdev, uint32_t frequency, adcsample_t *buffer
* called first. This saves processing time if the application does
* not want to use the GEVENT sub-system for the high speed ADC.
* Once turned on it can only be turned off by calling @p gadcHighSpeedInit() again.
- * @note The high speed ADC is capable of signalling via this method and a binary semaphore
- * at the same time.
+ * @note The high speed ADC is capable of signalling via this method, an ISR callback and a
+ * binary semaphore at the same time.
*
* @api
*/
@@ -168,6 +172,20 @@ void gadcHighSpeedInit(uint32_t physdev, uint32_t frequency, adcsample_t *buffer
#endif
/**
+ * @brief Allow retrieving of results from the high speed ADC using an ISR callback.
+ *
+ * @param[in] isrfn The callback function (called in an ISR context).
+ *
+ * @note Passing a NULL for isrfn will turn off signalling via this method as will calling
+ * @p gadcHighSpeedInit().
+ * @note The high speed ADC is capable of signalling via this method, a binary semaphore and the GEVENT
+ * sub-system at the same time.
+ *
+ * @api
+ */
+void gadcHighSpeedSetISRCallback(GADCISRCallbackFunction isrfn);
+
+/**
* @brief Allow retrieving of results from the high speed ADC using a Binary Semaphore and a static event buffer.
*
* @param[in] pbsem The binary semaphore is signaled when data is available.
@@ -175,7 +193,7 @@ void gadcHighSpeedInit(uint32_t physdev, uint32_t frequency, adcsample_t *buffer
*
* @note Passing a NULL for pbsem or pEvent will turn off signalling via this method as will calling
* @p gadcHighSpeedInit().
- * @note The high speed ADC is capable of signalling via this method and the GEVENT
+ * @note The high speed ADC is capable of signalling via this method, an ISR callback and the GEVENT
* sub-system at the same time.
*
* @api