From 741453729e848d1774e28af3723fad347c517de7 Mon Sep 17 00:00:00 2001 From: Jack Rubacha Date: Fri, 21 Jun 2024 16:45:03 -0400 Subject: [PATCH] change naming syntax --- Core/Inc/can_handler.h | 2 +- Core/Inc/msb.h | 22 +++++++++++----------- Core/Src/can_handler.c | 2 +- Core/Src/controller.c | 16 ++++++++-------- Core/Src/main.c | 6 +++--- Core/Src/monitor.c | 14 +++++++------- Core/Src/msb.c | 24 ++++++++++++------------ 7 files changed, 43 insertions(+), 43 deletions(-) diff --git a/Core/Inc/can_handler.h b/Core/Inc/can_handler.h index 9d4c751..7d97fe4 100644 --- a/Core/Inc/can_handler.h +++ b/Core/Inc/can_handler.h @@ -24,6 +24,6 @@ extern osThreadId_t can_dispatch_handle; extern const osThreadAttr_t can_dispatch_attributes; int8_t queue_can_msg(can_msg_t msg); -void init_can1(); +void can1_init(); #endif diff --git a/Core/Inc/msb.h b/Core/Inc/msb.h index 449f408..8ed335e 100644 --- a/Core/Inc/msb.h +++ b/Core/Inc/msb.h @@ -16,35 +16,35 @@ typedef enum { DEVICE_BACK_LEFT, } device_loc_t; -int8_t init_msb(); +int8_t msb_init(); #ifdef SENSOR_TEMP -int8_t measure_central_temp(uint16_t *temp, uint16_t *humidity); +int8_t central_temp_measure(uint16_t *temp, uint16_t *humidity); #endif #ifdef SENSOR_IMU -int8_t read_accel(uint16_t accel[3]); +int8_t accel_read(uint16_t accel[3]); -int8_t read_gyro(uint16_t gyro[3]); +int8_t gyro_read(uint16_t gyro[3]); #endif #ifdef SENSOR_TOF -int8_t read_distance(int32_t *range_mm); +int8_t distance_read(int32_t *range_mm); #endif -int8_t write_debug1(bool status); +int8_t debug1_write(bool status); -int8_t write_debug2(bool status); +int8_t debug2_write(bool status); -int8_t write_vcc5_en(bool status); +int8_t vcc5_en_write(bool status); #ifdef SENSOR_SHOCKPOT -void read_shockpot(uint32_t shockpot_sense); +void shockpot_read(uint32_t shockpot_sense); #endif #ifdef SENSOR_STRAIN -void read_strain1(uint32_t strain1); -void read_strain2(uint32_t strain2); +void strain1_read(uint32_t strain1); +void strain2_read(uint32_t strain2); #endif #endif diff --git a/Core/Src/can_handler.c b/Core/Src/can_handler.c index c90fad9..9c5680b 100644 --- a/Core/Src/can_handler.c +++ b/Core/Src/can_handler.c @@ -26,7 +26,7 @@ extern CAN_HandleTypeDef hcan1; can_t *can1; -void init_can1() +void can1_init() { can1 = malloc(sizeof(can_t)); assert(can1); diff --git a/Core/Src/controller.c b/Core/Src/controller.c index e41362e..6029ffa 100644 --- a/Core/Src/controller.c +++ b/Core/Src/controller.c @@ -15,20 +15,20 @@ void vLedController(void *pv_params) { switch (device_loc) { case DEVICE_FRONT_LEFT: - write_debug1(true); - write_debug2(true); + debug1_write(true); + debug2_write(true); break; case DEVICE_FRONT_RIGHT: - write_debug1(true); - write_debug2(false); + debug1_write(true); + debug2_write(false); break; case DEVICE_BACK_LEFT: - write_debug1(false); - write_debug2(true); + debug1_write(false); + debug2_write(true); break; case DEVICE_BACK_RIGHT: - write_debug1(false); - write_debug2(false); + debug1_write(false); + debug2_write(false); break; } diff --git a/Core/Src/main.c b/Core/Src/main.c index 7630cdf..2fbf4f3 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -186,8 +186,8 @@ int main(void) // determine the configuration of the device - init_msb(); - init_can1(); + msb_init(); + can1_init(); /* USER CODE END RTOS_MUTEX */ @@ -414,7 +414,7 @@ static void MX_CAN1_Init(void) Error_Handler(); } /* USER CODE BEGIN CAN1_Init 2 */ - init_can1(&hcan1); + can1_init(&hcan1); /* USER CODE END CAN1_Init 2 */ diff --git a/Core/Src/monitor.c b/Core/Src/monitor.c index 06d5f88..bd16067 100644 --- a/Core/Src/monitor.c +++ b/Core/Src/monitor.c @@ -55,7 +55,7 @@ void vTempMonitor(void *pv_params) uint16_t humidity_dat = 0; for (;;) { - if (measure_central_temp(&temp_dat, &humidity_dat)) { + if (central_temp_measure(&temp_dat, &humidity_dat)) { printf("Failed to get temp"); } @@ -125,11 +125,11 @@ void vIMUMonitor(void *pv_params) for (;;) { /* Take measurement */ - if (read_accel(accel_data_temp)) { + if (accel_read(accel_data_temp)) { serial_print("Failed to get IMU acceleration"); } - if (read_gyro(gyro_data_temp)) { + if (gyro_read(gyro_data_temp)) { serial_print("Failed to get IMU gyroscope"); } @@ -198,7 +198,7 @@ void vTOFMonitor(void *pv_params) int32_t range; for (;;) { - if (read_distance(&range)) { + if (distance_read(&range)) { serial_print("failed to read distance!"); continue; } @@ -238,7 +238,7 @@ void vShockpotMonitor(void *pv_params) uint32_t shock_value = 0; for (;;) { - read_shockpot(shock_value); + shockpot_read(shock_value); #ifdef LOG_VERBOSE serial_print("Shock value:\t%d\r\n", shock_value); @@ -281,8 +281,8 @@ void vStrainMonitor(void *pv_params) uint32_t strain1_dat = 0; uint32_t strain2_dat = 0; for (;;) { - read_strain1(strain1_dat); - read_strain2(strain2_dat); + strain1_read(strain1_dat); + strain2_read(strain2_dat); #ifdef LOG_VERBOSE serial_print("Strain 1: %d 2: %d \r\n", strain1_dat, diff --git a/Core/Src/msb.c b/Core/Src/msb.c index 85e9cae..31ff2e6 100644 --- a/Core/Src/msb.c +++ b/Core/Src/msb.c @@ -30,7 +30,7 @@ VL6180xDev_t tof; uint32_t adc1_buf[3]; #endif -int8_t init_msb() +int8_t msb_init() { #ifdef SENSOR_TEMP /* Initialize the Onboard Temperature Sensor */ @@ -73,7 +73,7 @@ int8_t init_msb() /// @brief Measure the temperature and humidity of central MSB SHT30 /// @param out /// @return error code -int8_t measure_central_temp(uint16_t *temp, uint16_t *humidity) +int8_t central_temp_measure(uint16_t *temp, uint16_t *humidity) { osStatus_t mut_stat = osMutexAcquire(i2c_mutex, osWaitForever); if (mut_stat) @@ -93,33 +93,33 @@ int8_t measure_central_temp(uint16_t *temp, uint16_t *humidity) #endif #if defined SENSOR_SHOCKPOT || defined SENSOR_STRAIN -void read_adc1(uint32_t result_buf[3]) +void adc1_read(uint32_t result_buf[3]) { memcpy(result_buf, adc1_buf, sizeof(adc1_buf)); } #endif #ifdef SENSOR_SHOCKPOT -void read_shockpot(uint32_t shockpot_sense) +void shockpot_read(uint32_t shockpot_sense) { memcpy((uint32_t *)shockpot_sense, adc1_buf, sizeof(shockpot_sense)); } #endif #ifdef SENSOR_STRAIN -void read_strain1(uint32_t strain1) +void strain1_read(uint32_t strain1) { memcpy((uint32_t *)strain1, adc1_buf + 1, sizeof(strain1)); } -void read_strain2(uint32_t strain2) +void strain2_read(uint32_t strain2) { memcpy((uint32_t *)strain2, adc1_buf + 2, sizeof(strain2)); } #endif #ifdef SENSOR_IMU -int8_t read_accel(uint16_t accel[3]) +int8_t accel_read(uint16_t accel[3]) { osStatus_t mut_stat = osMutexAcquire(i2c_mutex, osWaitForever); if (mut_stat) @@ -135,7 +135,7 @@ int8_t read_accel(uint16_t accel[3]) return 0; } -int8_t read_gyro(uint16_t gyro[3]) +int8_t gyro_read(uint16_t gyro[3]) { osStatus_t mut_stat = osMutexAcquire(i2c_mutex, osWaitForever); if (mut_stat) @@ -154,7 +154,7 @@ int8_t read_gyro(uint16_t gyro[3]) #ifdef SENSOR_TOF VL6180x_RangeData_t *range; -int8_t read_distance(int32_t *range_mm) +int8_t distance_read(int32_t *range_mm) { osStatus_t mut_stat = osMutexAcquire(i2c_mutex, osWaitForever); if (mut_stat) @@ -175,19 +175,19 @@ int8_t read_distance(int32_t *range_mm) } #endif -int8_t write_debug1(bool status) +int8_t debug1_write(bool status) { HAL_GPIO_WritePin(Debug_LED_1_GPIO_Port, Debug_LED_1_Pin, status); return 0; } -int8_t write_debug2(bool status) +int8_t debug2_write(bool status) { HAL_GPIO_WritePin(Debug_LED_2_GPIO_Port, Debug_LED_2_Pin, status); return 0; } -int8_t write_vcc5_en(bool status) +int8_t vcc5_en_write(bool status) { HAL_GPIO_WritePin(VCC5_En_GPIO_Port, VCC5_En_Pin, status); return 0;