Mercurial > hg > beaglert
diff include/Utilities.h @ 68:59edd5780fef
Changed d-box code to run cleanly when built on board. Updated Makefile to add ne10 include path on board. Some extra docs in Utilities.h
author | andrewm |
---|---|
date | Fri, 17 Jul 2015 16:57:08 +0100 |
parents | 74a44c3d91f0 |
children | d837fb676977 |
line wrap: on
line diff
--- a/include/Utilities.h Fri Jul 17 15:28:18 2015 +0100 +++ b/include/Utilities.h Fri Jul 17 16:57:08 2015 +0100 @@ -32,8 +32,58 @@ // Likewise, thread launch should be able to be called from setup() // Also, make volume change functions callable from render() thread -- as an aux task? +/** + * \brief Read an analog input, specifying the frame number (when to read) and the channel. + * + * This function returns the value of an analog input, at the time indicated by \c frame. + * The returned value ranges from 0 to 1, corresponding to a voltage range of 0 to 4.096V. + * + * \param context The I/O data structure which is passed by BeagleRT to render(). + * \param frame Which frame (i.e. what time) to read the analog input. Valid values range + * from 0 to (context->analogFrames - 1). + * \param channel Which analog input to read. Valid values are between 0 and + * (context->analogChannels - 1), typically 0 to 7 by default. + * \return Value of the analog input, range 0 to 1. + */ float analogReadFrame(BeagleRTContext *context, int frame, int channel); + +/** + * \brief Write an analog output, specifying the frame number (when to write) and the channel. + * + * This function sets the value of an analog output, at the time indicated by \c frame. Valid + * values are between 0 and 1, corresponding to the range 0 to 5V. + * + * The value written will persist for all future frames if BEAGLERT_FLAG_ANALOG_OUTPUTS_PERSIST + * is set in context->flags. This is the default behaviour. + * + * \param context The I/O data structure which is passed by BeagleRT to render(). + * \param frame Which frame (i.e. what time) to write the analog output. Valid values range + * from 0 to (context->analogFrames - 1). + * \param channel Which analog output to write. Valid values are between 0 and + * (context->analogChannels - 1), typically 0 to 7 by default. + * \param value Value to write to the output, range 0 to 1. + */ void analogWriteFrame(BeagleRTContext *context, int frame, int channel, float value); + +/** + * \brief Write an analog output, specifying the frame number (when to write) and the channel. + * + * This function sets the value of an analog output, at the time indicated by \c frame. Valid + * values are between 0 and 1, corresponding to the range 0 to 5V. + * + * Unlike analogWriteFrame(), the value written will affect \b only the frame specified, with + * future values unchanged. This is more efficient than analogWriteFrame() so is better suited + * to applications where every frame will be written to a different value. If + * BEAGLERT_FLAG_ANALOG_OUTPUTS_PERSIST is not set within context->flags, then + * analogWriteFrameOnce() and analogWriteFrame() are equivalent. + * + * \param context The I/O data structure which is passed by BeagleRT to render(). + * \param frame Which frame (i.e. what time) to write the analog output. Valid values range + * from 0 to (context->analogFrames - 1). + * \param channel Which analog output to write. Valid values are between 0 and + * (context->analogChannels - 1), typically 0 to 7 by default. + * \param value Value to write to the output, range 0 to 1. + */ void analogWriteFrameOnce(BeagleRTContext *context, int frame, int channel, float value); int digitalReadFrame(BeagleRTContext *context, int frame, int channel);