Skip to content

Commit

Permalink
change naming syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
jr1221 committed Jun 21, 2024
1 parent ad36f65 commit 7414537
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 43 deletions.
2 changes: 1 addition & 1 deletion Core/Inc/can_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
22 changes: 11 additions & 11 deletions Core/Inc/msb.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion Core/Src/can_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ extern CAN_HandleTypeDef hcan1;

can_t *can1;

void init_can1()
void can1_init()
{
can1 = malloc(sizeof(can_t));
assert(can1);
Expand Down
16 changes: 8 additions & 8 deletions Core/Src/controller.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
6 changes: 3 additions & 3 deletions Core/Src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand Down Expand Up @@ -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 */

Expand Down
14 changes: 7 additions & 7 deletions Core/Src/monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

Expand Down Expand Up @@ -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");
}

Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand Down
24 changes: 12 additions & 12 deletions Core/Src/msb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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;
Expand Down

0 comments on commit 7414537

Please sign in to comment.