kopia lustrzana https://github.com/RobertGawron/IonizationChamber
bit operations moved to a spearate file
rodzic
aaba71a028
commit
eb1df327f6
|
@ -0,0 +1,8 @@
|
|||
#ifndef SRC_BITHANDLER_H_
|
||||
#define SRC_BITHANDLER_H_
|
||||
|
||||
// TODO a bit of type checking?
|
||||
#define GET_MSB(data) (data >> 8)
|
||||
#define GET_LSB(data) (data & 0xff)
|
||||
|
||||
#endif
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
#include "CommonDataTypes.h"
|
||||
|
||||
typedef uint16_t Logger_DataFormat_t;
|
||||
typedef uint16_t Logger_DataFormat_t;
|
||||
|
||||
void Logger_Init();
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "Logger.h"
|
||||
#include "stm8s_uart1.h"
|
||||
#include "PinoutConfiguration.h"
|
||||
#include "BitHandler.h"
|
||||
|
||||
//#define USE_PRINTF
|
||||
#if defined USE_PRINTF
|
||||
|
@ -46,11 +47,8 @@ void Logger_Print(Logger_DataFormat_t data)
|
|||
#if defined USE_PRINTF
|
||||
printf("%d\n\r", data);
|
||||
#else
|
||||
uint8_t msb = (data >> 8);
|
||||
uint8_t lsb = (data & 0xff);
|
||||
|
||||
putchar(msb);
|
||||
putchar(lsb);
|
||||
putchar(GET_MSB(data));
|
||||
putchar(GET_LSB(data));
|
||||
putchar('\n');
|
||||
putchar('\r');
|
||||
#endif
|
||||
|
|
|
@ -117,7 +117,7 @@ static uint16_t read(uint8_t registerId)
|
|||
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 = (registerMSB << 8) + registerLSB;
|
||||
|
|
Ładowanie…
Reference in New Issue