Mercurial > hg > beaglert
changeset 101:04f894424a8c
Merge
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Mon, 27 Jul 2015 12:46:55 +0100 |
parents | b697e82ebb25 (current diff) c529505203ee (diff) |
children | 31ca45939a0c |
files | |
diffstat | 1 files changed, 45 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/include/Utilities.h Mon Jul 27 12:44:55 2015 +0100 +++ b/include/Utilities.h Mon Jul 27 12:46:55 2015 +0100 @@ -15,12 +15,36 @@ #include "BeagleRT.h" +/** + * \defgroup iofunctions I/O functions and constants + * + * These functions and macros are used for audio, analog and digital I/O. All the + * I/O functions require the BeagleRTContext data structure from render() to be passed + * in. This means that these functions are, by design, \b only usable from within + * the rendering thread. + * + * The naming conventions are loosely derived from the Arduino environment, and the + * syntax is similar. Unlike Arduino, the I/O functions require the frame number at which + * the read or write should take place, since all I/O happens synchronously with the + * audio clock. + * + * @{ + */ + #define HIGH 0x1 #define LOW 0x0 #define INPUT 0x0 #define OUTPUT 0x1 +/** @} */ + +/** + * \ingroup wiring + * + * @{ + */ + /// Set the given bit in \c word to 1. #define setBit(word,bit) ((word) | (1 << (bit))) @@ -33,6 +57,14 @@ /// Set/clear the given bit in \c word to \c value. #define changeBit(word,bit,value) ((clearBit((word),(bit))) | ((value) << (bit))) +/** @} */ + +/** + * \ingroup iofunctions + * + * @{ + */ + #if 1 // Note: pinMode(), analogWrite() and digitalWrite() should be able to be called from setup() // Likewise, thread launch should be able to be called from setup() @@ -182,6 +214,8 @@ */ void pinModeFrameOnce(BeagleRTContext *context, int frame, int channel, int mode); +/** @} */ + #else // Macros for accessing the analog values: usable _only_ within render() @@ -219,6 +253,15 @@ #endif /** + * \defgroup wiring Wiring language support + * + * These are functions found in the Wiring (Arduino) language which are not directly + * related to I/O but are provided as a convenience. + * + * @{ + */ + +/** * \brief Linearly rescale a number from one range of values to another. * * This function linearly scales values of \c x such that the range in_min to @@ -256,4 +299,6 @@ */ float constrain(float x, float min_val, float max_val); +/** @} */ + #endif /* UTILITIES_H_ */