kopia lustrzana https://github.com/RobertGawron/IonizationChamber
removed magic numbers
rodzic
efd3b0d947
commit
fc175b8af7
|
@ -24,7 +24,10 @@
|
|||
#define MCP3425_REG_BIT_GAIN_UPPER (1 << 1)
|
||||
#define MCP3425_REG_BIT_GAIN_LOWER (1 << 0)
|
||||
|
||||
#define MCP3425_CONFIGURATION (MCP3425_REG_BIT_READY | MCP3425_REG_BIT_SAMPLE_RATE_UPPER)
|
||||
//#define MCP3425_CONFIGURATION (MCP3425_REG_BIT_READY | MCP3425_REG_BIT_SAMPLE_RATE_UPPER)
|
||||
#define MCP3425_CONFIGURATION (MCP3425_REG_BIT_READY | MCP3425_REG_BIT_SAMPLE_RATE_LOWER)
|
||||
|
||||
#define MCP3425_READ_MEASSUREMENT 0x10
|
||||
|
||||
static void GPIO_setup(void);
|
||||
static void I2C_setup(void);
|
||||
|
@ -44,7 +47,7 @@ bool VoltageSensorActualValue_MeasureValue(VoltageSensorActualValue_MeasurementD
|
|||
// select adc configuration and start measurement
|
||||
write(MCP3425_CONFIGURATION);
|
||||
|
||||
write(0x10);
|
||||
write(MCP3425_READ_MEASSUREMENT);
|
||||
*measurementData = read(0);
|
||||
|
||||
// getRegisterValue should return false on timeout and this should be later propagated to GUI component
|
||||
|
@ -61,6 +64,7 @@ void GPIO_setup(void)
|
|||
|
||||
void I2C_setup(void)
|
||||
{
|
||||
// TODO magic numbers
|
||||
I2C_DeInit();
|
||||
I2C_Init(100000,
|
||||
I2C_MASTER_ADDRESS,
|
||||
|
|
Ładowanie…
Reference in New Issue