Skip to content

Commit 11527dc

Browse files
include hw files in CMakeList
1 parent b983bad commit 11527dc

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

stm32-modules/vacuum-module/firmware/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ set(${TARGET_MODULE_NAME}_FW_NONLINTABLE_SRCS
4242
${COMMS_DIR}/usbd_conf.c
4343
${COMMS_DIR}/usbd_desc.c
4444
${COMMS_DIR}/usb_hardware.c
45+
${VACUUM_PS_DIR}/vacuum_pressure_sensor_hardware.c
4546
)
4647

4748
add_executable(${TARGET_MODULE_NAME}

stm32-modules/vacuum-module/firmware/vacuum-pressure-sensor/vacuum_pressure_sensor_hardware.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1+
#include <stdbool.h>
2+
3+
#include "stm32g4xx_hal.h"
4+
#include "stm32g4xx_hal_conf.h"
5+
#include "stm32g4xx_hal_gpio.h"
6+
#include "stm32g4xx_hal_def.h"
17
#include "systemwide.h"
8+
#include "main.h"
29

310
void vacuum_pressure_sensor_hardware_init(void) {
411
GPIO_InitTypeDef GPIO_InitStruct = {0};
@@ -37,17 +44,18 @@ void vacuum_pressure_sensor_hardware_init(void) {
3744

3845

3946
bool sensor_hardware_read_eoc_pin(VacuumPressureSensorId sensor_id) {
40-
if (sensor_id == VacuumPressureSensorId::SensorA) {
41-
uint8_t pin_val = HAL_GPIO_ReadPin(SENSOR_A_EOC_PORT, SENSOR_A_EOC_PIN);
47+
uint8_t pin_val;
48+
if (sensor_id == SensorA) {
49+
pin_val = HAL_GPIO_ReadPin(SENSOR_A_EOC_PORT, SENSOR_A_EOC_PIN);
4250
}
4351
else {
44-
uint8_t pin_val = HAL_GPIO_ReadPin(SENSOR_B_EOC_PORT, SENSOR_B_EOC_PIN);
52+
pin_val = HAL_GPIO_ReadPin(SENSOR_B_EOC_PORT, SENSOR_B_EOC_PIN);
4553
}
4654
return pin_val == GPIO_PIN_SET ? true : false;
4755
}
4856

4957
void sensor_hardware_sensor_reset(VacuumPressureSensorId sensor_id) {
50-
if (sensor_id == VacuumPressureSensorId::SensorA) {
58+
if (sensor_id == SensorA) {
5159
HAL_GPIO_WritePin(SENSOR_A_RESET_PORT, SENSOR_A_RESET_PIN, GPIO_PIN_RESET);
5260
}
5361
else {

0 commit comments

Comments
 (0)