You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.8 KiB
48 lines
1.8 KiB
//----------------------------------------------------------------------------------------------------------------------------
|
|
// Project: Uppsense
|
|
// Name: dac101c085.h
|
|
// Author: Maximilian Stiefel
|
|
// Date: 08.08.2017
|
|
//
|
|
// Description:
|
|
//
|
|
//----------------------------------------------------------------------------------------------------------------------------
|
|
|
|
#ifndef APP_DAC101C085_H_
|
|
#define APP_DAC101C085_H_
|
|
|
|
//-------------------------------------Libraries------------------------------------------------------------------------------
|
|
#include <stdint.h>
|
|
|
|
//-------------------------------------Defines--------------------------------------------------------------------------------
|
|
#define DEBUG_LEVEL 1 // 1 a lot debugging output, else rare debugging output
|
|
#define PD_BITS_POS 14 // Position of power down bits
|
|
#define D_BITS_POS 2 // Position of data bits
|
|
|
|
//-------------------------------------Namespaces-----------------------------------------------------------------------------
|
|
namespace rijnfel {
|
|
namespace dac {
|
|
|
|
//-------------------------------------Enums----------------------------------------------------------------------------------
|
|
enum eOpMode {NORMAL, PULL_DOWN_2K5, PULL_DOWN_100K, HIGH_IMPEDANCE};
|
|
|
|
//-------------------------------------cDAC101085-----------------------------------------------------------------------------
|
|
class cDAC101C085
|
|
{
|
|
public:
|
|
cDAC101C085(uint8_t number, uint8_t i_address); // Constructor
|
|
~cDAC101C085(); // Destructor
|
|
void checkDev(); // Check if device is available and alive
|
|
uint16_t ReadSettings(void);
|
|
uint8_t WriteSettings(uint16_t settings);
|
|
uint8_t changeSettings(enum eOpMode mode, uint16_t val);
|
|
|
|
private:
|
|
uint8_t m_number; // Which of the dacs is it?
|
|
uint8_t m_address;
|
|
uint8_t I2CError(uint8_t error);
|
|
};
|
|
|
|
}
|
|
}
|
|
#endif /* APP_DAC101C085_H_ */
|
|
|