![]() |
Da Vinci Firmware 1
Firmware for the DaVinci-M rocket avionics board.
|
Implementation of low-level hardware drivers and utility functions. More...

Go to the source code of this file.
Functions | |
| int32_t | imuP_write (void *handle, uint8_t reg_addr, const uint8_t *buf, uint16_t len) |
| SPI write function for the primary IMU (LSM6DSO32). | |
| int32_t | imuP_read (void *handle, uint8_t reg_addr, uint8_t *buf, uint16_t len) |
| SPI read function for the primary IMU (LSM6DSO32). | |
| int32_t | imuP_read_2 (void *handle, uint8_t reg_addr, uint8_t *buf, uint16_t len) |
| SPI read function for the primary IMU (LSM6DSO32). | |
| int8_t | bmp390_P_write (uint8_t reg_addr, const uint8_t *buf, uint32_t len, void *intf_ptr) |
| SPI write function for the primary Barometer (bmp390). | |
| int8_t | bmp390_P_read (uint8_t reg_addr, uint8_t *buf, uint32_t len, void *intf_ptr) |
| SPI read function for the primary Barometer (bmp390). | |
| static void | bmp390_delay_us (uint32_t period, void *intf_ptr) |
| static int8_t | bmp3_P_spi_init (struct bmp3_dev *dev) |
| int8_t | init_imup (stmdev_ctx_t *imu, lsm6dso32_fs_xl_t acc_full_scale, lsm6dso32_fs_g_t gyro_full_scale, lsm6dso32_odr_xl_t acc_output_data_rate, lsm6dso32_odr_g_t gyro_output_data_rate) |
| Initializes the primary IMU (LSM6DSO32). | |
| int8_t | init_bmp390_p (struct bmp3_dev *bmp390) |
| Initializes the primary barometer (BMP390). | |
| uint16_t | compute_air_density (float_t temperature, float_t pressure) |
| int8_t | calibrateIMU (stmdev_ctx_t *imu, uint16_t iterationNum, OFFSET_TYPE type) |
| Calibrates the IMU by calculating sensor offsets. | |
| int32_t | imuB_write (void *handle, uint8_t reg_addr, const uint8_t *buf, uint16_t len) |
| SPI write function for the backup IMU (LSM6DSO32). | |
| int32_t | imuB_read (void *handle, uint8_t reg_addr, uint8_t *buf, uint16_t len) |
| SPI read function for the backup IMU (LSM6DSO32). | |
| int8_t | bmp390_B_write (uint8_t reg_addr, const uint8_t *buf, uint32_t len, void *intf_ptr) |
| SPI write function for the backup Barometer (bmp390). | |
| int8_t | bmp390_B_read (uint8_t reg_addr, uint8_t *buf, uint32_t len, void *intf_ptr) |
| SPI read function for the backup Barometer (bmp390). | |
| static int8_t | bmp3_B_spi_init (struct bmp3_dev *dev) |
| int8_t | init_imuB (stmdev_ctx_t *imu, lsm6dso32_fs_xl_t acc_full_scale, lsm6dso32_fs_g_t gyro_full_scale, lsm6dso32_odr_xl_t acc_output_data_rate, lsm6dso32_odr_g_t gyro_output_data_rate) |
| Initializes the backup IMU (LSM6DSO32). | |
| int8_t | init_bmp390_B (struct bmp3_dev *bmp390) |
| Initializes the backup barometer (BMP390). | |
| float_t | readAltitude (float_t seaLevelPa, float_t seaLevelT, float_t currentPa) |
| Calculates altitude based on the barometric formula. | |
Variables | |
| SPI_HandleTypeDef | hspi1 |
| SPI_HandleTypeDef | hspi2 |
| SPI_HandleTypeDef | hspi3 |
| static uint8_t | bmp390_p_addr = 0 |
| static uint8_t | bmp390_B_addr = 0 |
Implementation of low-level hardware drivers and utility functions.
Definition in file utilities.c.
|
static |
Definition at line 163 of file utilities.c.
Referenced by bmp3_B_spi_init(), and bmp3_P_spi_init().

|
static |
Definition at line 647 of file utilities.c.
References bmp390_B_addr, bmp390_B_read(), bmp390_B_write(), bmp390_delay_us(), BMP3_OK, BMP3_SPI_INTF, and NULL.
Referenced by init_bmp390_B().


|
static |
Definition at line 173 of file utilities.c.
References bmp390_delay_us(), bmp390_p_addr, bmp390_P_read(), bmp390_P_write(), BMP3_OK, BMP3_SPI_INTF, and NULL.
Referenced by init_bmp390_p().


| uint16_t compute_air_density | ( | float_t | temperature, |
| float_t | pressure | ||
| ) |
Definition at line 319 of file utilities.c.
References SPECIFIC_GAS_CONSTANT.
| float_t readAltitude | ( | float_t | seaLevelPa, |
| float_t | seaLevelT, | ||
| float_t | currentPa | ||
| ) |
Calculates altitude based on the barometric formula.
This function estimates the altitude in meters above sea level using the international barometric formula. It requires the current pressure, sea level pressure, and sea level temperature as inputs.
| [in] | seaLevelPa | The reference pressure at sea level in Pascals (Pa). |
| [in] | seaLevelT | The standard temperature at sea level in Kelvin (K). |
| [in] | currentPa | The current atmospheric pressure measured by the sensor in Pascals (Pa). |
GCONST: Standard gravity (~9.80665 m/s^2)RAST: Specific gas constant for dry air (~287.058 J/(kg·K))TAU: Standard temperature lapse rate (~0.0065 K/m) Definition at line 780 of file utilities.c.
References altitude, GCONST, RAST, and TAU.
Referenced by StartSensor_Task().

|
static |
Definition at line 30 of file utilities.c.
Referenced by bmp3_B_spi_init().
|
static |
Definition at line 29 of file utilities.c.
Referenced by bmp3_P_spi_init().
|
extern |
Definition at line 61 of file main.c.
Referenced by MX_SPI1_Init().
|
extern |
Definition at line 62 of file main.c.
Referenced by bmp390_P_read(), bmp390_P_write(), imuP_read(), imuP_read_2(), imuP_write(), and init_imup().
|
extern |
Definition at line 63 of file main.c.
Referenced by bmp390_B_read(), bmp390_B_write(), imuB_read(), imuB_write(), and init_imuB().