Skip to content

Commit

Permalink
apply clang format
Browse files Browse the repository at this point in the history
  • Loading branch information
pkotamnives committed Nov 21, 2023
1 parent 1732199 commit ae0dada
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions projects/cm_mcu/ZynqMonTask.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,16 @@
// Register List
// See Google Docs, 'CM uC Sensor register map'

#define SENSOR_MESSAGE_START_OF_FRAME_NIB 2
#define SENSOR_MESSAGE_START_OF_FRAME_NIB 2
#define SENSOR_MESSAGE_START_OF_FRAME_NIB_V2 3
#define RESERVED_DATA_V2 0x9 // 0b1001
#define SENSOR_MESSAGE_DATA_FRAME_NIB 0
#define SENSOR_MESSAGE_HEADER_OFFSET 6
#define SENSOR_SIX_BITS 0x3F
#define DATA_FOUR_BITS 0xF
#define DATA_TWO_BITS_MASK0 0x3 // a mask for 0b11
#define DATA_TWO_BITS_MASK1 0xC // a mask for 0b1100
#define DATA_TWO_BITS_MASK2 0x30 // a mask for 0b110000
#define RESERVED_DATA_V2 0x9 // 0b1001
#define SENSOR_MESSAGE_DATA_FRAME_NIB 0
#define SENSOR_MESSAGE_HEADER_OFFSET 6
#define SENSOR_SIX_BITS 0x3F
#define DATA_FOUR_BITS 0xF
#define DATA_TWO_BITS_MASK0 0x3 // a mask for 0b11
#define DATA_TWO_BITS_MASK1 0xC // a mask for 0b1100
#define DATA_TWO_BITS_MASK2 0x30 // a mask for 0b110000
#define SENSOR_MESSAGE_START_OF_FRAME \
(SENSOR_MESSAGE_START_OF_FRAME_NIB << SENSOR_MESSAGE_HEADER_OFFSET)
#define SENSOR_MESSAGE_START_OF_FRAME_V2 \
Expand All @@ -72,11 +72,11 @@ static void format_data(const uint8_t sensor, const uint16_t data, uint8_t messa
// version1 data frame : rest of sensor[1:0] (2 bits) and start of data[15:12] (4 bits)
message[1] = SENSOR_MESSAGE_DATA_FRAME;
tmp_message_1 = ((sensor & 0x3) << 4) | ((data >> 12) & 0xF);
message[1] |= (tmp_message_0 & DATA_TWO_BITS_MASK0) << 4 | ((tmp_message_1 & DATA_TWO_BITS_MASK2) >> 2) | ((RESERVED_DATA_V2 & DATA_TWO_BITS_MASK1)>>2);
message[1] |= (tmp_message_0 & DATA_TWO_BITS_MASK0) << 4 | ((tmp_message_1 & DATA_TWO_BITS_MASK2) >> 2) | ((RESERVED_DATA_V2 & DATA_TWO_BITS_MASK1) >> 2);

// modified version1 data frame with a reserved-data byte
message[2] = SENSOR_MESSAGE_DATA_FRAME;
message[2] |= ((RESERVED_DATA_V2 & DATA_TWO_BITS_MASK0 ) << 4) | (tmp_message_1 & DATA_FOUR_BITS);
message[2] |= ((RESERVED_DATA_V2 & DATA_TWO_BITS_MASK0) << 4) | (tmp_message_1 & DATA_FOUR_BITS);

// take version1 data frame 2, data[11:6] (6 bits)
message[3] = SENSOR_MESSAGE_DATA_FRAME;
Expand Down

0 comments on commit ae0dada

Please sign in to comment.