kopia lustrzana https://github.com/RobertGawron/IonizationChamber
update of measurement data type
rodzic
feea93c97e
commit
aaba71a028
|
@ -10,8 +10,10 @@
|
|||
|
||||
#include "CommonDataTypes.h"
|
||||
|
||||
typedef uint16_t Logger_DataFormat_t;
|
||||
|
||||
void Logger_Init();
|
||||
|
||||
void Logger_Print(uint8_t data);
|
||||
void Logger_Print(Logger_DataFormat_t data);
|
||||
|
||||
#endif /* INC_LOGGER_H_ */
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
#include "CommonDataTypes.h"
|
||||
|
||||
typedef uint8_t VoltageSensorActualValue_MeasurementData_t;
|
||||
typedef uint16_t VoltageSensorActualValue_MeasurementData_t;
|
||||
|
||||
void VoltageSensorActualValue_Init();
|
||||
|
||||
|
|
|
@ -41,15 +41,18 @@ void Logger_Init()
|
|||
}
|
||||
|
||||
|
||||
void Logger_Print(uint8_t data)
|
||||
void Logger_Print(Logger_DataFormat_t data)
|
||||
{
|
||||
#if defined USE_PRINTF
|
||||
printf("%d\n\r", data);
|
||||
#else
|
||||
putchar(data);
|
||||
uint8_t msb = (data >> 8);
|
||||
uint8_t lsb = (data & 0xff);
|
||||
|
||||
putchar(msb);
|
||||
putchar(lsb);
|
||||
putchar('\n');
|
||||
putchar('\r');
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ bool VoltageSensorActualValue_MeasureValue(VoltageSensorActualValue_MeasurementD
|
|||
write(0x10);
|
||||
*measurementData = read(0);
|
||||
|
||||
// getRegisterValue should return false on timeout and this should be later propagated to GUI component.
|
||||
// getRegisterValue should return false on timeout and this should be later propagated to GUI component
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -111,16 +111,16 @@ static uint16_t read(uint8_t registerId)
|
|||
I2C_GenerateSTOP(ENABLE);
|
||||
|
||||
I2C_AcknowledgeConfig(ENABLE);
|
||||
|
||||
/*
|
||||
Logger_Print( registerMSB);
|
||||
Logger_Print( registerLSB);
|
||||
Logger_Print( registerLSB1);
|
||||
Logger_Print( registerLSB2);
|
||||
Logger_Print( registerLSB3);
|
||||
|
||||
*/
|
||||
|
||||
// printf("data: %d %d %d %d %d\r\n", registerMSB, registerLSB, registerLSB1, registerLSB2, registerLSB3);
|
||||
uint16_t registerValue = 0;
|
||||
uint16_t registerValue = (registerMSB << 8) + registerLSB;
|
||||
|
||||
return registerValue;
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue