28 #define VLED_DAC_MAX ( LTC2631_MAX / 2 )
35 #define _ADC0_COUNT 11
37 #define _ADC_COUNT (_ADC0_COUNT + _ADC1_COUNT)
40 static const uint8_t _COUNTS[] = { _ADC0_COUNT, _ADC1_COUNT };
42 static const uint32_t _SCALING[_ADC_COUNT] = {
80 uint16_t tmp[_ADC_COUNT];
83 for (i = 0; i < _ADC_COUNT; ++i) {
84 results[i] = (uint16_t)( ( _SCALING[i] * tmp[i] ) / MAX123X_MAX_VALUE );
This module provides access to the peripherals on the power board.
#define POWER_I2C_DEV
Power board I2C device.
bool ltc2631Write(I2C_Device *dev, uint8_t addr, uint16_t value, bool update)
Sets the DAC value on the input register.
Driver of the LTC2631 DAC as found on the power board.
#define POWER_DAC_I2C_ADDR
The address of the Power Board DAC (LTC2631)
#define POWER_ADC0_I2C_ADDR
The address of the Power Board ADC (LTC2499) - deprecated, no longer used.
bool max123xSetup(I2C_Device *dev, i2cAddr addr, int ref, bool extclk, bool bipolar)
Writes the setup register of the MAX123x.
#define E_INVARGUMENT
Generic error: invalid argument.
bool pwrMeasureAll(uint16_t *results)
Initiates a conversion for the given channel.
bool max123xScanUpTo(I2C_Device *dev, i2cAddr addr, int upToCh, uint16_t *results)
Scan from analog input up to a given channel.
Manages the global system error.
MAX123x multichannel ADC driver.
bool pwrInit()
Initializes the powerboard.
bool errSet(uint32_t code, const char *error, const char *name)
Sets an error.
#define ERROR(CODE,...)
Expands an error code to an error code with a description (if ERROR_W_DESCR is declared).
bool pwrSetLED(uint32_t mv)
Set the LED output in millivolts.
Configures the board-specific peripherals, like I2C, SPI etc...
#define POWER_VLED_MAX_MV
Maximum power which can be supplied to the LED.