Skip to content

Commit 9df98b3

Browse files
committed
Add function to read hardware version from pins
1 parent 91058cd commit 9df98b3

File tree

1 file changed

+5
-0
lines changed
  • AxxSolder_firmware/Core/Src

1 file changed

+5
-0
lines changed

AxxSolder_firmware/Core/Src/main.c

+5
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,11 @@ void get_mcu_temp(){
333333
sensor_values.mcu_temperature = Moving_Average_Compute((((get_mean_ADC_reading_indexed(2) * VSENSE) - V30) / Avg_Slope + 25), &mcu_temperature_filter_struct);
334334
}
335335

336+
/* Function to get the hardware version based on version bit pins */
337+
uint8_t get_hw_version(){
338+
return (HAL_GPIO_ReadPin(GPIOC, VERSION_BIT_3_Pin) << 2) + (HAL_GPIO_ReadPin(GPIOC, VERSION_BIT_2_Pin) << 1) + (HAL_GPIO_ReadPin(GPIOC, VERSION_BIT_1_Pin));
339+
}
340+
336341
uint16_t RGB_to_BRG(uint16_t color){
337342
//return ((color & 0b0000000000011111) << 11) | ((color & 0b1111100000000000) >> 5) | ((color & 0b0000011111100000) >> 6);
338343
return ((((color & 0b0000000000011111) << 11) & 0b1111100000000000) | ((color & 0b1111111111100000) >> 5));

0 commit comments

Comments
 (0)