|
|
@ -24,20 +24,43 @@ namespace rijnfel { |
|
|
|
namespace dac { |
|
|
|
|
|
|
|
//-------------------------------------Enums----------------------------------------------------------------------------------
|
|
|
|
/** Represents the operational mode of the DAC.
|
|
|
|
*/ |
|
|
|
enum eOpMode {NORMAL, PULL_DOWN_2K5, PULL_DOWN_100K, HIGH_IMPEDANCE}; |
|
|
|
|
|
|
|
//-------------------------------------cDAC101085-----------------------------------------------------------------------------
|
|
|
|
/** Small simple driver for the TI DAC101C085.
|
|
|
|
*/ |
|
|
|
class cDAC101C085 |
|
|
|
{ |
|
|
|
public: |
|
|
|
cDAC101C085(uint8_t number, uint8_t i_address); // Constructor
|
|
|
|
/** @brief Instantiate DAC, assign a number and an address.
|
|
|
|
* @param i_dac_number Number of the DAC. |
|
|
|
* @param i_address I2C address of this DAC. |
|
|
|
*/ |
|
|
|
cDAC101C085(uint8_t i_dac_number, uint8_t i_address); // Constructor
|
|
|
|
|
|
|
|
/** @brief Free DAC, is currently doing nothing.
|
|
|
|
*/ |
|
|
|
~cDAC101C085(); // Destructor
|
|
|
|
void CheckDev(); // Check if device is available and alive
|
|
|
|
|
|
|
|
/** @brief Check if the device is answering on the bus.
|
|
|
|
* @retval uint8_t Returns 1 on success, 0 when failing. |
|
|
|
*/ |
|
|
|
uint8_t CheckDev(); // Check if device is available and alive
|
|
|
|
|
|
|
|
/** @brief Read out 16 bit register of the DAC.
|
|
|
|
* @retval uint16_t 16 bit read from the DAC. |
|
|
|
*/ |
|
|
|
uint16_t ReadSettings(void); |
|
|
|
|
|
|
|
/** @brief Write new setting to DAC register.
|
|
|
|
* @retval uint8_t Returns 1 on success, 0 when failing. |
|
|
|
*/ |
|
|
|
uint8_t ChangeSettings(enum eOpMode mode, uint16_t val); |
|
|
|
|
|
|
|
private: |
|
|
|
uint8_t m_number; // Which of the dacs is it?
|
|
|
|
uint8_t m_dac_number; // Which of the dacs is it?
|
|
|
|
uint8_t m_address; |
|
|
|
uint8_t WriteSettings(uint16_t settings); |
|
|
|
uint8_t I2CError(uint8_t error); |
|
|
@ -45,4 +68,5 @@ private: |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#endif /* APP_DAC101C085_H_ */ |
|
|
|