mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-26 09:45:37 +03:00
Merge pull request #9577 from mikeller/cleanup_bmi270_microcode_inclusion
Cleaned up the inclusion of the microcode for BMI270.
This commit is contained in:
commit
e38fd8c6f5
8 changed files with 15 additions and 98 deletions
|
@ -4,10 +4,3 @@ Library download location:
|
||||||
https://github.com/BoschSensortec/BMI270-Sensor-API
|
https://github.com/BoschSensortec/BMI270-Sensor-API
|
||||||
|
|
||||||
The only file that is compiled as part of Betaflight is bmi270.c. This file contains the device microcode that must be uploaded during initialization.
|
The only file that is compiled as part of Betaflight is bmi270.c. This file contains the device microcode that must be uploaded during initialization.
|
||||||
|
|
||||||
When upgrading this library the bmi270.h header must have the following code block added:
|
|
||||||
|
|
||||||
// Betaflight modifications begin
|
|
||||||
#define BMI270_CONFIG_SIZE 8192
|
|
||||||
extern const uint8_t bmi270_config_file[BMI270_CONFIG_SIZE];
|
|
||||||
// Betaflight modifications end
|
|
||||||
|
|
|
@ -130,8 +130,3 @@ int8_t bmi270_init(struct bmi2_dev *dev);
|
||||||
#endif /* End of CPP guard */
|
#endif /* End of CPP guard */
|
||||||
|
|
||||||
#endif /* BMI270_H_ */
|
#endif /* BMI270_H_ */
|
||||||
|
|
||||||
// Betaflight modifications begin
|
|
||||||
#define BMI270_CONFIG_SIZE 8192
|
|
||||||
extern const uint8_t bmi270_config_file[BMI270_CONFIG_SIZE];
|
|
||||||
// Betaflight modifications end
|
|
||||||
|
|
|
@ -189,7 +189,6 @@ COMMON_SRC = \
|
||||||
io/vtx_smartaudio.c \
|
io/vtx_smartaudio.c \
|
||||||
io/vtx_tramp.c \
|
io/vtx_tramp.c \
|
||||||
io/vtx_control.c \
|
io/vtx_control.c \
|
||||||
./lib/main/BoschSensortec/BMI270-Sensor-API/bmi270.c
|
|
||||||
|
|
||||||
COMMON_DEVICE_SRC = \
|
COMMON_DEVICE_SRC = \
|
||||||
$(CMSIS_SRC) \
|
$(CMSIS_SRC) \
|
||||||
|
|
|
@ -35,12 +35,16 @@
|
||||||
#include "drivers/sensor.h"
|
#include "drivers/sensor.h"
|
||||||
#include "drivers/time.h"
|
#include "drivers/time.h"
|
||||||
|
|
||||||
// Include the device config (microcode) that must be uploaded to the sensor
|
|
||||||
#include "../../../../lib/main/BoschSensortec/BMI270-Sensor-API/bmi270.h"
|
|
||||||
|
|
||||||
#define BMI270_SPI_DIVISOR 16
|
#define BMI270_SPI_DIVISOR 16
|
||||||
#define BMI270_FIFO_FRAME_SIZE 6
|
#define BMI270_FIFO_FRAME_SIZE 6
|
||||||
|
|
||||||
|
#define BMI270_CONFIG_SIZE 8192
|
||||||
|
|
||||||
|
// Declaration for the device config (microcode) that must be uploaded to the sensor
|
||||||
|
extern const uint8_t bmi270_config_file[BMI270_CONFIG_SIZE];
|
||||||
|
|
||||||
|
#define BMI270_CHIP_ID 0x24
|
||||||
|
|
||||||
// BMI270 registers (not the complete list)
|
// BMI270 registers (not the complete list)
|
||||||
typedef enum {
|
typedef enum {
|
||||||
BMI270_REG_CHIP_ID = 0x00,
|
BMI270_REG_CHIP_ID = 0x00,
|
||||||
|
@ -168,7 +172,7 @@ static void bmi270UploadConfig(const busDevice_t *bus)
|
||||||
// Transfer the config file
|
// Transfer the config file
|
||||||
IOLo(bus->busdev_u.spi.csnPin);
|
IOLo(bus->busdev_u.spi.csnPin);
|
||||||
spiTransferByte(bus->busdev_u.spi.instance, BMI270_REG_INIT_DATA);
|
spiTransferByte(bus->busdev_u.spi.instance, BMI270_REG_INIT_DATA);
|
||||||
spiTransfer(bus->busdev_u.spi.instance, bmi270_config_file, NULL, BMI270_CONFIG_SIZE);
|
spiTransfer(bus->busdev_u.spi.instance, bmi270_config_file, NULL, sizeof(bmi270_config_file));
|
||||||
IOHi(bus->busdev_u.spi.csnPin);
|
IOHi(bus->busdev_u.spi.csnPin);
|
||||||
|
|
||||||
delay(10);
|
delay(10);
|
||||||
|
|
|
@ -1,55 +0,0 @@
|
||||||
/*
|
|
||||||
* This file is part of Cleanflight and Betaflight.
|
|
||||||
*
|
|
||||||
* Cleanflight and Betaflight are free software. You can redistribute
|
|
||||||
* this software and/or modify this software under the terms of the
|
|
||||||
* GNU General Public License as published by the Free Software
|
|
||||||
* Foundation, either version 3 of the License, or (at your option)
|
|
||||||
* any later version.
|
|
||||||
*
|
|
||||||
* Cleanflight and Betaflight are distributed in the hope that they
|
|
||||||
* will be useful, but WITHOUT ANY WARRANTY; without even the implied
|
|
||||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
* See the GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this software.
|
|
||||||
*
|
|
||||||
* If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "target/common_unified.h"
|
|
||||||
|
|
||||||
#define TARGET_BOARD_IDENTIFIER "S745"
|
|
||||||
|
|
||||||
#define USBD_PRODUCT_STRING "Betaflight STM32F745"
|
|
||||||
|
|
||||||
#define USE_I2C_DEVICE_1
|
|
||||||
#define USE_I2C_DEVICE_2
|
|
||||||
#define USE_I2C_DEVICE_3
|
|
||||||
#define USE_I2C_DEVICE_4
|
|
||||||
|
|
||||||
#define USE_UART1
|
|
||||||
#define USE_UART2
|
|
||||||
#define USE_UART3
|
|
||||||
#define USE_UART4
|
|
||||||
#define USE_UART5
|
|
||||||
#define USE_UART6
|
|
||||||
#define USE_UART7
|
|
||||||
#define USE_UART8
|
|
||||||
|
|
||||||
#define SERIAL_PORT_COUNT (UNIFIED_SERIAL_PORT_COUNT + 8)
|
|
||||||
|
|
||||||
#define USE_SPI_DEVICE_1
|
|
||||||
#define USE_SPI_DEVICE_2
|
|
||||||
#define USE_SPI_DEVICE_3
|
|
||||||
#define USE_SPI_DEVICE_4
|
|
||||||
|
|
||||||
#define TARGET_IO_PORTA 0xffff
|
|
||||||
#define TARGET_IO_PORTB 0xffff
|
|
||||||
#define TARGET_IO_PORTC 0xffff
|
|
||||||
#define TARGET_IO_PORTD 0xffff
|
|
||||||
#define TARGET_IO_PORTE 0xffff
|
|
||||||
#define TARGET_IO_PORTF 0xffff
|
|
|
@ -1,21 +0,0 @@
|
||||||
F7X5XG_TARGETS += $(TARGET)
|
|
||||||
|
|
||||||
FEATURES += VCP SDCARD_SPI SDCARD_SDIO ONBOARDFLASH
|
|
||||||
|
|
||||||
TARGET_SRC = \
|
|
||||||
$(addprefix drivers/accgyro/,$(notdir $(wildcard $(SRC_DIR)/drivers/accgyro/*.c))) \
|
|
||||||
$(addprefix drivers/barometer/,$(notdir $(wildcard $(SRC_DIR)/drivers/barometer/*.c))) \
|
|
||||||
$(addprefix drivers/compass/,$(notdir $(wildcard $(SRC_DIR)/drivers/compass/*.c))) \
|
|
||||||
drivers/max7456.c \
|
|
||||||
drivers/vtx_rtc6705.c \
|
|
||||||
drivers/vtx_rtc6705_soft_spi.c \
|
|
||||||
rx/cc2500_common.c \
|
|
||||||
rx/cc2500_frsky_shared.c \
|
|
||||||
rx/cc2500_frsky_d.c \
|
|
||||||
rx/cc2500_frsky_x.c \
|
|
||||||
rx/cc2500_sfhss.c \
|
|
||||||
rx/a7105_flysky.c \
|
|
||||||
rx/cyrf6936_spektrum.c \
|
|
||||||
drivers/rx/rx_cc2500.c \
|
|
||||||
drivers/rx/rx_a7105.c \
|
|
||||||
drivers/rx/rx_cyrf6936.c
|
|
|
@ -25,6 +25,8 @@
|
||||||
|
|
||||||
#define USBD_PRODUCT_STRING "Betaflight STM32F405"
|
#define USBD_PRODUCT_STRING "Betaflight STM32F405"
|
||||||
|
|
||||||
|
#define USE_ACCGYRO_BMI270
|
||||||
|
|
||||||
#define USE_I2C_DEVICE_1
|
#define USE_I2C_DEVICE_1
|
||||||
#define USE_I2C_DEVICE_2
|
#define USE_I2C_DEVICE_2
|
||||||
#define USE_I2C_DEVICE_3
|
#define USE_I2C_DEVICE_3
|
||||||
|
@ -112,6 +114,8 @@
|
||||||
|
|
||||||
#define USBD_PRODUCT_STRING "Betaflight STM32F745"
|
#define USBD_PRODUCT_STRING "Betaflight STM32F745"
|
||||||
|
|
||||||
|
#define USE_ACCGYRO_BMI270
|
||||||
|
|
||||||
#define USE_I2C_DEVICE_1
|
#define USE_I2C_DEVICE_1
|
||||||
#define USE_I2C_DEVICE_2
|
#define USE_I2C_DEVICE_2
|
||||||
#define USE_I2C_DEVICE_3
|
#define USE_I2C_DEVICE_3
|
||||||
|
@ -166,10 +170,6 @@
|
||||||
#define USE_ACC_SPI_ICM20689
|
#define USE_ACC_SPI_ICM20689
|
||||||
#define USE_GYRO_SPI_ICM20689
|
#define USE_GYRO_SPI_ICM20689
|
||||||
|
|
||||||
#if (TARGET_FLASH_SIZE > 512)
|
|
||||||
#define USE_ACCGYRO_BMI270
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define USE_MAG
|
#define USE_MAG
|
||||||
#define USE_MAG_DATA_READY_SIGNAL
|
#define USE_MAG_DATA_READY_SIGNAL
|
||||||
#define USE_MAG_HMC5883
|
#define USE_MAG_HMC5883
|
||||||
|
|
|
@ -13,8 +13,9 @@ else
|
||||||
ifeq ($(TARGET), STM32F7X2)
|
ifeq ($(TARGET), STM32F7X2)
|
||||||
F7X2RE_TARGETS += $(TARGET)
|
F7X2RE_TARGETS += $(TARGET)
|
||||||
|
|
||||||
else
|
else # STM32F745
|
||||||
F7X5XG_TARGETS += $(TARGET)
|
F7X5XG_TARGETS += $(TARGET)
|
||||||
|
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
@ -23,6 +24,7 @@ FEATURES += VCP SDCARD_SPI SDCARD_SDIO ONBOARDFLASH
|
||||||
|
|
||||||
TARGET_SRC = \
|
TARGET_SRC = \
|
||||||
$(addprefix drivers/accgyro/,$(notdir $(wildcard $(SRC_DIR)/drivers/accgyro/*.c))) \
|
$(addprefix drivers/accgyro/,$(notdir $(wildcard $(SRC_DIR)/drivers/accgyro/*.c))) \
|
||||||
|
$(ROOT)/lib/main/BoschSensortec/BMI270-Sensor-API/bmi270.c \
|
||||||
$(addprefix drivers/barometer/,$(notdir $(wildcard $(SRC_DIR)/drivers/barometer/*.c))) \
|
$(addprefix drivers/barometer/,$(notdir $(wildcard $(SRC_DIR)/drivers/barometer/*.c))) \
|
||||||
$(addprefix drivers/compass/,$(notdir $(wildcard $(SRC_DIR)/drivers/compass/*.c))) \
|
$(addprefix drivers/compass/,$(notdir $(wildcard $(SRC_DIR)/drivers/compass/*.c))) \
|
||||||
drivers/max7456.c \
|
drivers/max7456.c \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue