Skip to content

Commit

Permalink
fixed errors
Browse files Browse the repository at this point in the history
  • Loading branch information
marvin-g-neu committed Oct 20, 2024
1 parent 7ac74c9 commit c482983
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions Core/Src/mpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,15 @@ mpu_t *init_mpu(I2C_HandleTypeDef *hi2c, ADC_HandleTypeDef *pedals_adc,
mpu->led_gpio = led_gpio;
mpu->watchdog_gpio = watchdog_gpio;

/* Initialize the Onboard Temperature Sensor */
// CHANGE: Updated SHT30 initialization
mpu->temp_sensor.i2c_handle = hi2c;
mpu->temp_sensor.write = (Write_ptr)HAL_I2C_Master_Transmit;
mpu->temp_sensor.read = (Read_Ptr)HAL_I2C_Master_Receive;
mpu->temp_sensor.mem_read = (Mem_Read_Ptr)HAL_I2C_Mem_Read;
mpu->temp_sensor.delay = HAL_Delay;
assert(sht30_init(&mpu->temp_sensor) == 0);
/* Initialize the Onboard Temperature Sensor */
// updated the sht30 initialization
mpu->temp_sensor.i2c_handle = hi2c;
mpu->temp_sensor.write = (Write_ptr)HAL_I2C_Master_Transmit;
mpu->temp_sensor.read = (Read_Ptr)HAL_I2C_Master_Receive;
mpu->temp_sensor.mem_read = (Mem_Read_Ptr)HAL_I2C_Mem_Read;
mpu->temp_sensor.delay = HAL_Delay;
assert(sht30_init(&mpu->temp_sensor) == 0);

assert(!HAL_ADC_Start_DMA(mpu->pedals_adc, mpu->pedal_dma_buf,
sizeof(mpu->pedal_dma_buf) /
sizeof(uint32_t)));
Expand Down Expand Up @@ -131,10 +132,10 @@ int8_t read_temp_sensor(mpu_t *mpu, uint16_t *temp, uint16_t *humidity)
if (mut_stat)
return mut_stat;

// updated to use int return type
int status = sht30_get_temp_humid(&mpu->temp_sensor);
if (status != 0)
return status;
// Updated to use int return type
int status = sht30_get_temp_humid(&mpu->temp_sensor);
if (status != 0)
return status;

*temp = mpu->temp_sensor.temp;
*humidity = mpu->temp_sensor.humidity;
Expand Down

0 comments on commit c482983

Please sign in to comment.