From dc2285233b07d730ba25e0191648fbe3015b072f Mon Sep 17 00:00:00 2001 From: Elmar van Rijnswou Date: Wed, 23 Aug 2017 11:11:31 +0200 Subject: [PATCH] Something always has to go wrong --- software/app/excitation_light.h | 64 +++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 software/app/excitation_light.h diff --git a/software/app/excitation_light.h b/software/app/excitation_light.h new file mode 100644 index 0000000..2df0514 --- /dev/null +++ b/software/app/excitation_light.h @@ -0,0 +1,64 @@ +//---------------------------------------------------------------------------------------------------------------------------- +// Project: Uppsense +// Name: excitation_light.h +// Author: Maximilian Stiefel +// Date: 09.08.2017 +// +// Description: Class to use the excitation light in an advanced way with the help of a DAC. +// +//---------------------------------------------------------------------------------------------------------------------------- + +#ifndef APP_EXCITATION_LIGHT_H_ +#define APP_EXCITATION_LIGHT_H_ + +//-------------------------------------Libraries------------------------------------------------------------------------------ +#include +#include "dac101c085.h" +#include "hardware.h" + +//-------------------------------------Defines-------------------------------------------------------------------------------- + +//-------------------------------------Namespaces----------------------------------------------------------------------------- +namespace rijnfel { +namespace light { + +//-------------------------------------Enums---------------------------------------------------------------------------------- + +//-------------------------------------cExcitationLight----------------------------------------------------------------------- +/** Class to use the excitation light in an advanced way with the help of a DAC. + */ +class cExcitationLight +{ +public: + /** Construct object, allocate space for DAC. + */ + cExcitationLight(); // Constructor + + /** Destruct object, free space for DAC. + */ + ~cExcitationLight(); // Destructor + + /** Set the desired current through excitation light. + * @param microamp Current in uA. + * @retval uint8_t Returns 1 on success, 0 when failing. + */ + uint8_t SetCurrent(uint16_t microamp); + + /** Function to be hooked up to a timer to generate rectangular signal. + * @retval uint8_t Returns 1 on success, 0 when failing. + */ + uint8_t RectangleUpdate(); + + /** Use 2K5 pull-down resistor to turn LED completely off. + * @retval uint8_t Returns 1 on success, 0 when failing. + */ + uint8_t DeactivateLED(); +private: + dac::cDAC101C085 *m_DAC; + uint8_t m_rectangleStatus; + uint16_t m_DACRectHigh; +}; + +} +} +#endif /* APP_EXCITATION_LIGHT_H_ */