scara_engineering/modules/imu/BMI088Middleware.c

30 lines
650 B
C
Raw Normal View History

2024-12-22 16:15:37 +08:00
#include "BMI088Middleware.h"
#include "main.h"
SPI_HandleTypeDef *BMI088_SPI;
void BMI088_ACCEL_NS_L(void)
{
2024-12-23 18:13:22 +08:00
HAL_GPIO_WritePin(ACC_CS_GPIO_Port, ACC_CS_Pin, GPIO_PIN_RESET);
2024-12-22 16:15:37 +08:00
}
void BMI088_ACCEL_NS_H(void)
{
2024-12-23 18:13:22 +08:00
HAL_GPIO_WritePin(ACC_CS_GPIO_Port, ACC_CS_Pin, GPIO_PIN_SET);
2024-12-22 16:15:37 +08:00
}
void BMI088_GYRO_NS_L(void)
{
2024-12-23 18:13:22 +08:00
HAL_GPIO_WritePin(GYRO_CS_GPIO_Port, GYRO_CS_Pin, GPIO_PIN_RESET);
2024-12-22 16:15:37 +08:00
}
void BMI088_GYRO_NS_H(void)
{
2024-12-23 18:13:22 +08:00
HAL_GPIO_WritePin(GYRO_CS_GPIO_Port, GYRO_CS_Pin, GPIO_PIN_SET);
2024-12-22 16:15:37 +08:00
}
uint8_t BMI088_read_write_byte(uint8_t txdata)
{
uint8_t rx_data;
HAL_SPI_TransmitReceive(BMI088_SPI, &txdata, &rx_data, 1, 1000);
return rx_data;
}