![]() |
Da Vinci Firmware 1
Firmware for the DaVinci-M rocket avionics board.
|
Provides low-level hardware drivers, sensor initialization routines, and various utility functions for the flight computer. More...
#include "bmp3.h"#include "lsm6dso32_reg.h"#include "main.h"#include <stdbool.h>#include <math.h>#include "cmsis_os2.h"

Go to the source code of this file.
Macros | |
| #define | AIR_DENSITY_KG_M3 1.293f |
| #define | SPECIFIC_GAS_CONSTANT 287.0f |
Enumerations | |
| enum | OFFSET_TYPE { HWOFFSET = 0 , SWOFFSET = 1 , RESET_HWOFFSET = 2 } |
| Specifies the type of offset compensation to be used. More... | |
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). | |
| 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). | |
| 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). | |
| 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). | |
| 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). | |
| int8_t | calibrateIMU (stmdev_ctx_t *imu, uint16_t iterationNum, OFFSET_TYPE type) |
| Calibrates the IMU by calculating sensor offsets. | |
| 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). | |
| float_t | readAltitude (float_t seaLevelPa, float_t seaLevelT, float_t currentPa) |
| Calculates altitude based on the barometric formula. | |
Provides low-level hardware drivers, sensor initialization routines, and various utility functions for the flight computer.
This file acts as a hardware abstraction layer (HAL) and utility library. It contains SPI communication wrappers for STMicroelectronics sensor drivers, high-level initialization and calibration routines for sensors, and common physics calculations needed by the flight software.
Definition in file utilities.h.
| #define AIR_DENSITY_KG_M3 1.293f |
Definition at line 50 of file utilities.h.
| #define SPECIFIC_GAS_CONSTANT 287.0f |
Definition at line 51 of file utilities.h.
| 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().
