重构bsp层,bsp层将和HAL的配置一致,修改CubeMX之后不需要修改bsp。重构bmi088。
This commit is contained in:
parent
ab1a9726b1
commit
a3631a5ca5
24
Makefile
24
Makefile
|
@ -101,23 +101,25 @@ HAL_N_Middlewares/Middlewares/Third_Party/FreeRTOS/Source/portable/MemMang/heap_
|
|||
HAL_N_Middlewares/Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c \
|
||||
HAL_N_Middlewares/Middlewares/Third_Party/SEGGER/RTT/SEGGER_RTT_printf.c \
|
||||
HAL_N_Middlewares/Middlewares/Third_Party/SEGGER/RTT/SEGGER_RTT.c \
|
||||
bsp/bsp_dwt.c \
|
||||
bsp/bsp_pwm.c \
|
||||
bsp/dwt/bsp_dwt.c \
|
||||
bsp/pwm/bsp_pwm.c \
|
||||
bsp/bsp_temperature.c \
|
||||
bsp/bsp_led.c \
|
||||
bsp/bsp_spi.c \
|
||||
bsp/bsp_iic.c \
|
||||
bsp/bsp_can.c \
|
||||
bsp/spi/bsp_spi.c \
|
||||
bsp/iic/bsp_iic.c \
|
||||
bsp/can/bsp_can.c \
|
||||
bsp/bsp_buzzer.c \
|
||||
bsp/bsp_usart.c \
|
||||
bsp/bsp_log.c \
|
||||
bsp/usart/bsp_usart.c \
|
||||
bsp/log/bsp_log.c \
|
||||
bsp/bsp_init.c \
|
||||
bsp/gpio/bsp_gpio.c \
|
||||
modules/algorithm/controller.c \
|
||||
modules/algorithm/kalman_filter.c \
|
||||
modules/algorithm/QuaternionEKF.c \
|
||||
modules/algorithm/crc8.c \
|
||||
modules/algorithm/crc16.c \
|
||||
modules/algorithm/user_lib.c \
|
||||
modules/BMI088/bmi088.c \
|
||||
modules/imu/BMI088driver.c \
|
||||
modules/imu/BMI088Middleware.c \
|
||||
modules/imu/ins_task.c \
|
||||
|
@ -225,6 +227,14 @@ C_INCLUDES = \
|
|||
-Iapplication/gimbal \
|
||||
-Iapplication/cmd \
|
||||
-Iapplication \
|
||||
-Ibsp/dwt \
|
||||
-Ibsp/can \
|
||||
-Ibsp/gpio \
|
||||
-Ibsp/usart \
|
||||
-Ibsp/spi \
|
||||
-Ibsp/iic \
|
||||
-Ibsp/log \
|
||||
-Ibsp/pwm \
|
||||
-Ibsp \
|
||||
-Imodules/algorithm \
|
||||
-Imodules/imu \
|
||||
|
|
|
@ -21,135 +21,171 @@ CAN2.CalculateBaudRate=1000000
|
|||
CAN2.CalculateTimeQuantum=71.42857142857143
|
||||
CAN2.IPParameters=CalculateTimeQuantum,BS1,BS2,Prescaler,CalculateBaudRate
|
||||
CAN2.Prescaler=3
|
||||
Dma.MEMTOMEM.5.Direction=DMA_MEMORY_TO_MEMORY
|
||||
Dma.MEMTOMEM.5.FIFOMode=DMA_FIFOMODE_ENABLE
|
||||
Dma.MEMTOMEM.5.FIFOThreshold=DMA_FIFO_THRESHOLD_FULL
|
||||
Dma.MEMTOMEM.5.Instance=DMA2_Stream3
|
||||
Dma.MEMTOMEM.5.MemBurst=DMA_MBURST_SINGLE
|
||||
Dma.MEMTOMEM.5.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
||||
Dma.MEMTOMEM.5.MemInc=DMA_MINC_ENABLE
|
||||
Dma.MEMTOMEM.5.Mode=DMA_NORMAL
|
||||
Dma.MEMTOMEM.5.PeriphBurst=DMA_PBURST_SINGLE
|
||||
Dma.MEMTOMEM.5.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
||||
Dma.MEMTOMEM.5.PeriphInc=DMA_PINC_ENABLE
|
||||
Dma.MEMTOMEM.5.Priority=DMA_PRIORITY_HIGH
|
||||
Dma.MEMTOMEM.5.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode,FIFOThreshold,MemBurst,PeriphBurst
|
||||
Dma.Request0=USART3_RX
|
||||
Dma.Request1=USART6_RX
|
||||
Dma.Request2=USART6_TX
|
||||
Dma.Request3=USART1_TX
|
||||
Dma.Request4=USART1_RX
|
||||
Dma.Request5=MEMTOMEM
|
||||
Dma.Request6=SPI1_RX
|
||||
Dma.Request7=SPI1_TX
|
||||
Dma.Request8=SPI2_RX
|
||||
Dma.Request9=SPI2_TX
|
||||
Dma.RequestsNb=10
|
||||
Dma.SPI1_RX.6.Direction=DMA_PERIPH_TO_MEMORY
|
||||
Dma.SPI1_RX.6.FIFOMode=DMA_FIFOMODE_ENABLE
|
||||
Dma.SPI1_RX.6.FIFOThreshold=DMA_FIFO_THRESHOLD_FULL
|
||||
Dma.SPI1_RX.6.Instance=DMA2_Stream0
|
||||
Dma.SPI1_RX.6.MemBurst=DMA_MBURST_SINGLE
|
||||
Dma.SPI1_RX.6.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
||||
Dma.SPI1_RX.6.MemInc=DMA_MINC_ENABLE
|
||||
Dma.SPI1_RX.6.Mode=DMA_NORMAL
|
||||
Dma.SPI1_RX.6.PeriphBurst=DMA_PBURST_SINGLE
|
||||
Dma.SPI1_RX.6.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
||||
Dma.SPI1_RX.6.PeriphInc=DMA_PINC_DISABLE
|
||||
Dma.SPI1_RX.6.Priority=DMA_PRIORITY_LOW
|
||||
Dma.SPI1_RX.6.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode,FIFOThreshold,MemBurst,PeriphBurst
|
||||
Dma.SPI1_TX.7.Direction=DMA_MEMORY_TO_PERIPH
|
||||
Dma.SPI1_TX.7.FIFOMode=DMA_FIFOMODE_ENABLE
|
||||
Dma.SPI1_TX.7.FIFOThreshold=DMA_FIFO_THRESHOLD_FULL
|
||||
Dma.SPI1_TX.7.Instance=DMA2_Stream5
|
||||
Dma.SPI1_TX.7.MemBurst=DMA_MBURST_SINGLE
|
||||
Dma.SPI1_TX.7.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
||||
Dma.SPI1_TX.7.MemInc=DMA_MINC_ENABLE
|
||||
Dma.SPI1_TX.7.Mode=DMA_NORMAL
|
||||
Dma.SPI1_TX.7.PeriphBurst=DMA_PBURST_SINGLE
|
||||
Dma.SPI1_TX.7.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
||||
Dma.SPI1_TX.7.PeriphInc=DMA_PINC_DISABLE
|
||||
Dma.SPI1_TX.7.Priority=DMA_PRIORITY_LOW
|
||||
Dma.SPI1_TX.7.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode,FIFOThreshold,MemBurst,PeriphBurst
|
||||
Dma.SPI2_RX.8.Direction=DMA_PERIPH_TO_MEMORY
|
||||
Dma.SPI2_RX.8.FIFOMode=DMA_FIFOMODE_ENABLE
|
||||
Dma.SPI2_RX.8.FIFOThreshold=DMA_FIFO_THRESHOLD_FULL
|
||||
Dma.SPI2_RX.8.Instance=DMA1_Stream3
|
||||
Dma.SPI2_RX.8.MemBurst=DMA_MBURST_SINGLE
|
||||
Dma.SPI2_RX.8.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
||||
Dma.SPI2_RX.8.MemInc=DMA_MINC_ENABLE
|
||||
Dma.SPI2_RX.8.Mode=DMA_NORMAL
|
||||
Dma.SPI2_RX.8.PeriphBurst=DMA_PBURST_SINGLE
|
||||
Dma.SPI2_RX.8.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
||||
Dma.SPI2_RX.8.PeriphInc=DMA_PINC_DISABLE
|
||||
Dma.SPI2_RX.8.Priority=DMA_PRIORITY_LOW
|
||||
Dma.SPI2_RX.8.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode,FIFOThreshold,MemBurst,PeriphBurst
|
||||
Dma.SPI2_TX.9.Direction=DMA_MEMORY_TO_PERIPH
|
||||
Dma.SPI2_TX.9.FIFOMode=DMA_FIFOMODE_ENABLE
|
||||
Dma.SPI2_TX.9.FIFOThreshold=DMA_FIFO_THRESHOLD_FULL
|
||||
Dma.SPI2_TX.9.Instance=DMA1_Stream4
|
||||
Dma.SPI2_TX.9.MemBurst=DMA_MBURST_SINGLE
|
||||
Dma.SPI2_TX.9.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
||||
Dma.SPI2_TX.9.MemInc=DMA_MINC_ENABLE
|
||||
Dma.SPI2_TX.9.Mode=DMA_NORMAL
|
||||
Dma.SPI2_TX.9.PeriphBurst=DMA_PBURST_SINGLE
|
||||
Dma.SPI2_TX.9.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
||||
Dma.SPI2_TX.9.PeriphInc=DMA_PINC_DISABLE
|
||||
Dma.SPI2_TX.9.Priority=DMA_PRIORITY_LOW
|
||||
Dma.SPI2_TX.9.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode,FIFOThreshold,MemBurst,PeriphBurst
|
||||
Dma.USART1_RX.4.Direction=DMA_PERIPH_TO_MEMORY
|
||||
Dma.USART1_RX.4.FIFOMode=DMA_FIFOMODE_DISABLE
|
||||
Dma.USART1_RX.4.Instance=DMA2_Stream2
|
||||
Dma.USART1_RX.4.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
||||
Dma.USART1_RX.4.MemInc=DMA_MINC_ENABLE
|
||||
Dma.USART1_RX.4.Mode=DMA_NORMAL
|
||||
Dma.USART1_RX.4.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
||||
Dma.USART1_RX.4.PeriphInc=DMA_PINC_DISABLE
|
||||
Dma.USART1_RX.4.Priority=DMA_PRIORITY_VERY_HIGH
|
||||
Dma.USART1_RX.4.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode
|
||||
Dma.USART1_TX.3.Direction=DMA_MEMORY_TO_PERIPH
|
||||
Dma.USART1_TX.3.FIFOMode=DMA_FIFOMODE_DISABLE
|
||||
Dma.USART1_TX.3.Instance=DMA2_Stream7
|
||||
Dma.USART1_TX.3.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
||||
Dma.USART1_TX.3.MemInc=DMA_MINC_ENABLE
|
||||
Dma.USART1_TX.3.Mode=DMA_NORMAL
|
||||
Dma.USART1_TX.3.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
||||
Dma.USART1_TX.3.PeriphInc=DMA_PINC_DISABLE
|
||||
Dma.USART1_TX.3.Priority=DMA_PRIORITY_VERY_HIGH
|
||||
Dma.USART1_TX.3.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode
|
||||
Dma.USART3_RX.0.Direction=DMA_PERIPH_TO_MEMORY
|
||||
Dma.USART3_RX.0.FIFOMode=DMA_FIFOMODE_DISABLE
|
||||
Dma.USART3_RX.0.Instance=DMA1_Stream1
|
||||
Dma.USART3_RX.0.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
||||
Dma.USART3_RX.0.MemInc=DMA_MINC_ENABLE
|
||||
Dma.USART3_RX.0.Mode=DMA_NORMAL
|
||||
Dma.USART3_RX.0.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
||||
Dma.USART3_RX.0.PeriphInc=DMA_PINC_DISABLE
|
||||
Dma.USART3_RX.0.Priority=DMA_PRIORITY_VERY_HIGH
|
||||
Dma.USART3_RX.0.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode
|
||||
Dma.USART6_RX.1.Direction=DMA_PERIPH_TO_MEMORY
|
||||
Dma.USART6_RX.1.FIFOMode=DMA_FIFOMODE_DISABLE
|
||||
Dma.USART6_RX.1.Instance=DMA2_Stream1
|
||||
Dma.USART6_RX.1.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
||||
Dma.USART6_RX.1.MemInc=DMA_MINC_ENABLE
|
||||
Dma.USART6_RX.1.Mode=DMA_NORMAL
|
||||
Dma.USART6_RX.1.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
||||
Dma.USART6_RX.1.PeriphInc=DMA_PINC_DISABLE
|
||||
Dma.USART6_RX.1.Priority=DMA_PRIORITY_HIGH
|
||||
Dma.USART6_RX.1.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode
|
||||
Dma.USART6_TX.2.Direction=DMA_MEMORY_TO_PERIPH
|
||||
Dma.USART6_TX.2.FIFOMode=DMA_FIFOMODE_DISABLE
|
||||
Dma.USART6_TX.2.Instance=DMA2_Stream6
|
||||
Dma.USART6_TX.2.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
||||
Dma.USART6_TX.2.MemInc=DMA_MINC_ENABLE
|
||||
Dma.USART6_TX.2.Mode=DMA_NORMAL
|
||||
Dma.USART6_TX.2.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
||||
Dma.USART6_TX.2.PeriphInc=DMA_PINC_DISABLE
|
||||
Dma.USART6_TX.2.Priority=DMA_PRIORITY_HIGH
|
||||
Dma.USART6_TX.2.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode
|
||||
FREERTOS.IPParameters=Tasks01,configENABLE_FPU
|
||||
Dma.ADC1.12.Direction=DMA_PERIPH_TO_MEMORY
|
||||
Dma.ADC1.12.FIFOMode=DMA_FIFOMODE_DISABLE
|
||||
Dma.ADC1.12.Instance=DMA2_Stream4
|
||||
Dma.ADC1.12.MemDataAlignment=DMA_MDATAALIGN_HALFWORD
|
||||
Dma.ADC1.12.MemInc=DMA_MINC_ENABLE
|
||||
Dma.ADC1.12.Mode=DMA_NORMAL
|
||||
Dma.ADC1.12.PeriphDataAlignment=DMA_PDATAALIGN_HALFWORD
|
||||
Dma.ADC1.12.PeriphInc=DMA_PINC_DISABLE
|
||||
Dma.ADC1.12.Priority=DMA_PRIORITY_LOW
|
||||
Dma.ADC1.12.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode
|
||||
Dma.I2C2_RX.8.Direction=DMA_PERIPH_TO_MEMORY
|
||||
Dma.I2C2_RX.8.FIFOMode=DMA_FIFOMODE_DISABLE
|
||||
Dma.I2C2_RX.8.Instance=DMA1_Stream2
|
||||
Dma.I2C2_RX.8.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
||||
Dma.I2C2_RX.8.MemInc=DMA_MINC_ENABLE
|
||||
Dma.I2C2_RX.8.Mode=DMA_NORMAL
|
||||
Dma.I2C2_RX.8.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
||||
Dma.I2C2_RX.8.PeriphInc=DMA_PINC_DISABLE
|
||||
Dma.I2C2_RX.8.Priority=DMA_PRIORITY_LOW
|
||||
Dma.I2C2_RX.8.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode
|
||||
Dma.I2C2_TX.9.Direction=DMA_MEMORY_TO_PERIPH
|
||||
Dma.I2C2_TX.9.FIFOMode=DMA_FIFOMODE_DISABLE
|
||||
Dma.I2C2_TX.9.Instance=DMA1_Stream7
|
||||
Dma.I2C2_TX.9.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
||||
Dma.I2C2_TX.9.MemInc=DMA_MINC_ENABLE
|
||||
Dma.I2C2_TX.9.Mode=DMA_NORMAL
|
||||
Dma.I2C2_TX.9.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
||||
Dma.I2C2_TX.9.PeriphInc=DMA_PINC_DISABLE
|
||||
Dma.I2C2_TX.9.Priority=DMA_PRIORITY_LOW
|
||||
Dma.I2C2_TX.9.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode
|
||||
Dma.MEMTOMEM.11.Direction=DMA_MEMORY_TO_MEMORY
|
||||
Dma.MEMTOMEM.11.FIFOMode=DMA_FIFOMODE_ENABLE
|
||||
Dma.MEMTOMEM.11.FIFOThreshold=DMA_FIFO_THRESHOLD_FULL
|
||||
Dma.MEMTOMEM.11.Instance=DMA2_Stream5
|
||||
Dma.MEMTOMEM.11.MemBurst=DMA_MBURST_SINGLE
|
||||
Dma.MEMTOMEM.11.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
||||
Dma.MEMTOMEM.11.MemInc=DMA_MINC_ENABLE
|
||||
Dma.MEMTOMEM.11.Mode=DMA_NORMAL
|
||||
Dma.MEMTOMEM.11.PeriphBurst=DMA_PBURST_SINGLE
|
||||
Dma.MEMTOMEM.11.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
||||
Dma.MEMTOMEM.11.PeriphInc=DMA_PINC_ENABLE
|
||||
Dma.MEMTOMEM.11.Priority=DMA_PRIORITY_LOW
|
||||
Dma.MEMTOMEM.11.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode,FIFOThreshold,MemBurst,PeriphBurst
|
||||
Dma.Request0=USART6_RX
|
||||
Dma.Request1=USART6_TX
|
||||
Dma.Request10=USART3_RX
|
||||
Dma.Request11=MEMTOMEM
|
||||
Dma.Request12=ADC1
|
||||
Dma.Request2=USART1_TX
|
||||
Dma.Request3=USART1_RX
|
||||
Dma.Request4=SPI1_RX
|
||||
Dma.Request5=SPI1_TX
|
||||
Dma.Request6=SPI2_RX
|
||||
Dma.Request7=SPI2_TX
|
||||
Dma.Request8=I2C2_RX
|
||||
Dma.Request9=I2C2_TX
|
||||
Dma.RequestsNb=13
|
||||
Dma.SPI1_RX.4.Direction=DMA_PERIPH_TO_MEMORY
|
||||
Dma.SPI1_RX.4.FIFOMode=DMA_FIFOMODE_ENABLE
|
||||
Dma.SPI1_RX.4.FIFOThreshold=DMA_FIFO_THRESHOLD_FULL
|
||||
Dma.SPI1_RX.4.Instance=DMA2_Stream0
|
||||
Dma.SPI1_RX.4.MemBurst=DMA_MBURST_SINGLE
|
||||
Dma.SPI1_RX.4.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
||||
Dma.SPI1_RX.4.MemInc=DMA_MINC_ENABLE
|
||||
Dma.SPI1_RX.4.Mode=DMA_NORMAL
|
||||
Dma.SPI1_RX.4.PeriphBurst=DMA_PBURST_SINGLE
|
||||
Dma.SPI1_RX.4.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
||||
Dma.SPI1_RX.4.PeriphInc=DMA_PINC_DISABLE
|
||||
Dma.SPI1_RX.4.Priority=DMA_PRIORITY_LOW
|
||||
Dma.SPI1_RX.4.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode,FIFOThreshold,MemBurst,PeriphBurst
|
||||
Dma.SPI1_TX.5.Direction=DMA_MEMORY_TO_PERIPH
|
||||
Dma.SPI1_TX.5.FIFOMode=DMA_FIFOMODE_ENABLE
|
||||
Dma.SPI1_TX.5.FIFOThreshold=DMA_FIFO_THRESHOLD_FULL
|
||||
Dma.SPI1_TX.5.Instance=DMA2_Stream3
|
||||
Dma.SPI1_TX.5.MemBurst=DMA_MBURST_SINGLE
|
||||
Dma.SPI1_TX.5.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
||||
Dma.SPI1_TX.5.MemInc=DMA_MINC_ENABLE
|
||||
Dma.SPI1_TX.5.Mode=DMA_NORMAL
|
||||
Dma.SPI1_TX.5.PeriphBurst=DMA_PBURST_SINGLE
|
||||
Dma.SPI1_TX.5.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
||||
Dma.SPI1_TX.5.PeriphInc=DMA_PINC_DISABLE
|
||||
Dma.SPI1_TX.5.Priority=DMA_PRIORITY_LOW
|
||||
Dma.SPI1_TX.5.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode,FIFOThreshold,MemBurst,PeriphBurst
|
||||
Dma.SPI2_RX.6.Direction=DMA_PERIPH_TO_MEMORY
|
||||
Dma.SPI2_RX.6.FIFOMode=DMA_FIFOMODE_ENABLE
|
||||
Dma.SPI2_RX.6.FIFOThreshold=DMA_FIFO_THRESHOLD_FULL
|
||||
Dma.SPI2_RX.6.Instance=DMA1_Stream3
|
||||
Dma.SPI2_RX.6.MemBurst=DMA_MBURST_SINGLE
|
||||
Dma.SPI2_RX.6.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
||||
Dma.SPI2_RX.6.MemInc=DMA_MINC_ENABLE
|
||||
Dma.SPI2_RX.6.Mode=DMA_NORMAL
|
||||
Dma.SPI2_RX.6.PeriphBurst=DMA_PBURST_SINGLE
|
||||
Dma.SPI2_RX.6.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
||||
Dma.SPI2_RX.6.PeriphInc=DMA_PINC_DISABLE
|
||||
Dma.SPI2_RX.6.Priority=DMA_PRIORITY_LOW
|
||||
Dma.SPI2_RX.6.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode,FIFOThreshold,MemBurst,PeriphBurst
|
||||
Dma.SPI2_TX.7.Direction=DMA_MEMORY_TO_PERIPH
|
||||
Dma.SPI2_TX.7.FIFOMode=DMA_FIFOMODE_ENABLE
|
||||
Dma.SPI2_TX.7.FIFOThreshold=DMA_FIFO_THRESHOLD_FULL
|
||||
Dma.SPI2_TX.7.Instance=DMA1_Stream4
|
||||
Dma.SPI2_TX.7.MemBurst=DMA_MBURST_SINGLE
|
||||
Dma.SPI2_TX.7.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
||||
Dma.SPI2_TX.7.MemInc=DMA_MINC_ENABLE
|
||||
Dma.SPI2_TX.7.Mode=DMA_NORMAL
|
||||
Dma.SPI2_TX.7.PeriphBurst=DMA_PBURST_SINGLE
|
||||
Dma.SPI2_TX.7.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
||||
Dma.SPI2_TX.7.PeriphInc=DMA_PINC_DISABLE
|
||||
Dma.SPI2_TX.7.Priority=DMA_PRIORITY_LOW
|
||||
Dma.SPI2_TX.7.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode,FIFOThreshold,MemBurst,PeriphBurst
|
||||
Dma.USART1_RX.3.Direction=DMA_PERIPH_TO_MEMORY
|
||||
Dma.USART1_RX.3.FIFOMode=DMA_FIFOMODE_DISABLE
|
||||
Dma.USART1_RX.3.Instance=DMA2_Stream2
|
||||
Dma.USART1_RX.3.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
||||
Dma.USART1_RX.3.MemInc=DMA_MINC_ENABLE
|
||||
Dma.USART1_RX.3.Mode=DMA_NORMAL
|
||||
Dma.USART1_RX.3.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
||||
Dma.USART1_RX.3.PeriphInc=DMA_PINC_DISABLE
|
||||
Dma.USART1_RX.3.Priority=DMA_PRIORITY_VERY_HIGH
|
||||
Dma.USART1_RX.3.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode
|
||||
Dma.USART1_TX.2.Direction=DMA_MEMORY_TO_PERIPH
|
||||
Dma.USART1_TX.2.FIFOMode=DMA_FIFOMODE_DISABLE
|
||||
Dma.USART1_TX.2.Instance=DMA2_Stream7
|
||||
Dma.USART1_TX.2.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
||||
Dma.USART1_TX.2.MemInc=DMA_MINC_ENABLE
|
||||
Dma.USART1_TX.2.Mode=DMA_NORMAL
|
||||
Dma.USART1_TX.2.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
||||
Dma.USART1_TX.2.PeriphInc=DMA_PINC_DISABLE
|
||||
Dma.USART1_TX.2.Priority=DMA_PRIORITY_VERY_HIGH
|
||||
Dma.USART1_TX.2.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode
|
||||
Dma.USART3_RX.10.Direction=DMA_PERIPH_TO_MEMORY
|
||||
Dma.USART3_RX.10.FIFOMode=DMA_FIFOMODE_DISABLE
|
||||
Dma.USART3_RX.10.Instance=DMA1_Stream1
|
||||
Dma.USART3_RX.10.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
||||
Dma.USART3_RX.10.MemInc=DMA_MINC_ENABLE
|
||||
Dma.USART3_RX.10.Mode=DMA_NORMAL
|
||||
Dma.USART3_RX.10.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
||||
Dma.USART3_RX.10.PeriphInc=DMA_PINC_DISABLE
|
||||
Dma.USART3_RX.10.Priority=DMA_PRIORITY_LOW
|
||||
Dma.USART3_RX.10.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode
|
||||
Dma.USART6_RX.0.Direction=DMA_PERIPH_TO_MEMORY
|
||||
Dma.USART6_RX.0.FIFOMode=DMA_FIFOMODE_DISABLE
|
||||
Dma.USART6_RX.0.Instance=DMA2_Stream1
|
||||
Dma.USART6_RX.0.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
||||
Dma.USART6_RX.0.MemInc=DMA_MINC_ENABLE
|
||||
Dma.USART6_RX.0.Mode=DMA_NORMAL
|
||||
Dma.USART6_RX.0.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
||||
Dma.USART6_RX.0.PeriphInc=DMA_PINC_DISABLE
|
||||
Dma.USART6_RX.0.Priority=DMA_PRIORITY_HIGH
|
||||
Dma.USART6_RX.0.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode
|
||||
Dma.USART6_TX.1.Direction=DMA_MEMORY_TO_PERIPH
|
||||
Dma.USART6_TX.1.FIFOMode=DMA_FIFOMODE_DISABLE
|
||||
Dma.USART6_TX.1.Instance=DMA2_Stream6
|
||||
Dma.USART6_TX.1.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
||||
Dma.USART6_TX.1.MemInc=DMA_MINC_ENABLE
|
||||
Dma.USART6_TX.1.Mode=DMA_NORMAL
|
||||
Dma.USART6_TX.1.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
||||
Dma.USART6_TX.1.PeriphInc=DMA_PINC_DISABLE
|
||||
Dma.USART6_TX.1.Priority=DMA_PRIORITY_HIGH
|
||||
Dma.USART6_TX.1.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode
|
||||
FREERTOS.IPParameters=Tasks01,configENABLE_FPU,configMAX_TASK_NAME_LEN,configUSE_TIMERS,configUSE_POSIX_ERRNO
|
||||
FREERTOS.Tasks01=defaultTask,0,128,StartDefaultTask,Default,NULL,Dynamic,NULL,NULL
|
||||
FREERTOS.configENABLE_FPU=1
|
||||
FREERTOS.configMAX_TASK_NAME_LEN=32
|
||||
FREERTOS.configUSE_POSIX_ERRNO=0
|
||||
FREERTOS.configUSE_TIMERS=0
|
||||
File.Version=6
|
||||
GPIO.groupedBy=Group By Peripherals
|
||||
I2C2.I2C_Mode=I2C_Fast
|
||||
|
@ -161,29 +197,31 @@ Mcu.CPN=STM32F407IGH6
|
|||
Mcu.Family=STM32F4
|
||||
Mcu.IP0=ADC1
|
||||
Mcu.IP1=CAN1
|
||||
Mcu.IP10=RTC
|
||||
Mcu.IP11=SPI1
|
||||
Mcu.IP12=SPI2
|
||||
Mcu.IP13=SYS
|
||||
Mcu.IP14=TIM1
|
||||
Mcu.IP15=TIM4
|
||||
Mcu.IP16=TIM5
|
||||
Mcu.IP17=TIM8
|
||||
Mcu.IP18=TIM10
|
||||
Mcu.IP19=USART1
|
||||
Mcu.IP10=RCC
|
||||
Mcu.IP11=RNG
|
||||
Mcu.IP12=RTC
|
||||
Mcu.IP13=SPI1
|
||||
Mcu.IP14=SPI2
|
||||
Mcu.IP15=SYS
|
||||
Mcu.IP16=TIM1
|
||||
Mcu.IP17=TIM4
|
||||
Mcu.IP18=TIM5
|
||||
Mcu.IP19=TIM8
|
||||
Mcu.IP2=CAN2
|
||||
Mcu.IP20=USART3
|
||||
Mcu.IP21=USART6
|
||||
Mcu.IP22=USB_DEVICE
|
||||
Mcu.IP23=USB_OTG_FS
|
||||
Mcu.IP3=DMA
|
||||
Mcu.IP4=FREERTOS
|
||||
Mcu.IP5=I2C2
|
||||
Mcu.IP6=I2C3
|
||||
Mcu.IP7=NVIC
|
||||
Mcu.IP8=RCC
|
||||
Mcu.IP9=RNG
|
||||
Mcu.IPNb=24
|
||||
Mcu.IP20=TIM10
|
||||
Mcu.IP21=USART1
|
||||
Mcu.IP22=USART3
|
||||
Mcu.IP23=USART6
|
||||
Mcu.IP24=USB_DEVICE
|
||||
Mcu.IP25=USB_OTG_FS
|
||||
Mcu.IP3=CRC
|
||||
Mcu.IP4=DAC
|
||||
Mcu.IP5=DMA
|
||||
Mcu.IP6=FREERTOS
|
||||
Mcu.IP7=I2C2
|
||||
Mcu.IP8=I2C3
|
||||
Mcu.IP9=NVIC
|
||||
Mcu.IPNb=26
|
||||
Mcu.Name=STM32F407I(E-G)Hx
|
||||
Mcu.Package=UFBGA176
|
||||
Mcu.Pin0=PB8
|
||||
|
@ -214,35 +252,39 @@ Mcu.Pin30=PH10
|
|||
Mcu.Pin31=PD14
|
||||
Mcu.Pin32=PA0-WKUP
|
||||
Mcu.Pin33=PA4
|
||||
Mcu.Pin34=PE13
|
||||
Mcu.Pin35=PE9
|
||||
Mcu.Pin36=PE11
|
||||
Mcu.Pin37=PE14
|
||||
Mcu.Pin38=PB13
|
||||
Mcu.Pin39=PA7
|
||||
Mcu.Pin34=PC4
|
||||
Mcu.Pin35=PE13
|
||||
Mcu.Pin36=PA5
|
||||
Mcu.Pin37=PC5
|
||||
Mcu.Pin38=PE9
|
||||
Mcu.Pin39=PE11
|
||||
Mcu.Pin4=PB3
|
||||
Mcu.Pin40=PB0
|
||||
Mcu.Pin41=PB14
|
||||
Mcu.Pin42=PB15
|
||||
Mcu.Pin43=VP_ADC1_TempSens_Input
|
||||
Mcu.Pin44=VP_ADC1_Vref_Input
|
||||
Mcu.Pin45=VP_FREERTOS_VS_CMSIS_V1
|
||||
Mcu.Pin46=VP_RNG_VS_RNG
|
||||
Mcu.Pin47=VP_RTC_VS_RTC_Activate
|
||||
Mcu.Pin48=VP_SYS_VS_Systick
|
||||
Mcu.Pin49=VP_TIM1_VS_ClockSourceINT
|
||||
Mcu.Pin40=PE14
|
||||
Mcu.Pin41=PB13
|
||||
Mcu.Pin42=PA7
|
||||
Mcu.Pin43=PB0
|
||||
Mcu.Pin44=PB14
|
||||
Mcu.Pin45=PB15
|
||||
Mcu.Pin46=VP_ADC1_TempSens_Input
|
||||
Mcu.Pin47=VP_ADC1_Vref_Input
|
||||
Mcu.Pin48=VP_CRC_VS_CRC
|
||||
Mcu.Pin49=VP_FREERTOS_VS_CMSIS_V1
|
||||
Mcu.Pin5=PA14
|
||||
Mcu.Pin50=VP_TIM4_VS_ClockSourceINT
|
||||
Mcu.Pin51=VP_TIM5_VS_ClockSourceINT
|
||||
Mcu.Pin52=VP_TIM8_VS_ClockSourceINT
|
||||
Mcu.Pin53=VP_TIM10_VS_ClockSourceINT
|
||||
Mcu.Pin54=VP_USB_DEVICE_VS_USB_DEVICE_CDC_FS
|
||||
Mcu.Pin55=VP_STMicroelectronics.X-CUBE-ALGOBUILD_VS_DSPOoLibraryJjLibrary_1.3.0_1.3.0
|
||||
Mcu.Pin50=VP_RNG_VS_RNG
|
||||
Mcu.Pin51=VP_RTC_VS_RTC_Activate
|
||||
Mcu.Pin52=VP_SYS_VS_Systick
|
||||
Mcu.Pin53=VP_TIM1_VS_ClockSourceINT
|
||||
Mcu.Pin54=VP_TIM4_VS_ClockSourceINT
|
||||
Mcu.Pin55=VP_TIM5_VS_ClockSourceINT
|
||||
Mcu.Pin56=VP_TIM8_VS_ClockSourceINT
|
||||
Mcu.Pin57=VP_TIM10_VS_ClockSourceINT
|
||||
Mcu.Pin58=VP_USB_DEVICE_VS_USB_DEVICE_CDC_FS
|
||||
Mcu.Pin59=VP_STMicroelectronics.X-CUBE-ALGOBUILD_VS_DSPOoLibraryJjLibrary_1.3.0_1.3.0
|
||||
Mcu.Pin6=PA13
|
||||
Mcu.Pin7=PB7
|
||||
Mcu.Pin8=PB6
|
||||
Mcu.Pin9=PD0
|
||||
Mcu.PinsNb=56
|
||||
Mcu.PinsNb=60
|
||||
Mcu.ThirdParty0=STMicroelectronics.X-CUBE-ALGOBUILD.1.3.0
|
||||
Mcu.ThirdPartyNb=1
|
||||
Mcu.UserConstants=
|
||||
|
@ -254,18 +296,26 @@ NVIC.CAN1_RX0_IRQn=true\:6\:0\:true\:false\:true\:true\:true\:true\:true
|
|||
NVIC.CAN1_RX1_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true
|
||||
NVIC.CAN2_RX0_IRQn=true\:6\:0\:true\:false\:true\:true\:true\:true\:true
|
||||
NVIC.CAN2_RX1_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true
|
||||
NVIC.DMA1_Stream1_IRQn=true\:5\:0\:true\:false\:true\:true\:false\:true\:true
|
||||
NVIC.DMA1_Stream1_IRQn=true\:5\:0\:false\:false\:true\:true\:false\:true\:true
|
||||
NVIC.DMA1_Stream2_IRQn=true\:5\:0\:false\:false\:true\:true\:false\:true\:true
|
||||
NVIC.DMA1_Stream3_IRQn=true\:5\:0\:false\:false\:true\:true\:false\:true\:true
|
||||
NVIC.DMA1_Stream4_IRQn=true\:5\:0\:false\:false\:true\:true\:false\:true\:true
|
||||
NVIC.DMA1_Stream7_IRQn=true\:5\:0\:false\:false\:true\:true\:false\:true\:true
|
||||
NVIC.DMA2_Stream0_IRQn=true\:5\:0\:false\:false\:true\:true\:false\:true\:true
|
||||
NVIC.DMA2_Stream1_IRQn=true\:5\:0\:true\:false\:true\:true\:false\:true\:true
|
||||
NVIC.DMA2_Stream1_IRQn=true\:5\:0\:false\:false\:true\:false\:false\:true\:true
|
||||
NVIC.DMA2_Stream2_IRQn=true\:5\:0\:false\:false\:true\:true\:false\:true\:true
|
||||
NVIC.DMA2_Stream3_IRQn=true\:5\:0\:false\:false\:true\:false\:false\:true\:true
|
||||
NVIC.DMA2_Stream4_IRQn=true\:5\:0\:false\:false\:true\:true\:false\:true\:true
|
||||
NVIC.DMA2_Stream5_IRQn=true\:5\:0\:false\:false\:true\:true\:false\:true\:true
|
||||
NVIC.DMA2_Stream6_IRQn=true\:5\:0\:true\:false\:true\:true\:false\:true\:true
|
||||
NVIC.DMA2_Stream7_IRQn=true\:5\:0\:true\:false\:true\:true\:false\:true\:true
|
||||
NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false
|
||||
NVIC.ForceEnableDMAVector=true
|
||||
NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false
|
||||
NVIC.I2C2_ER_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true
|
||||
NVIC.I2C2_EV_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true
|
||||
NVIC.I2C3_ER_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true
|
||||
NVIC.I2C3_EV_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true
|
||||
NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false
|
||||
NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false
|
||||
NVIC.OTG_FS_IRQn=true\:5\:0\:false\:false\:true\:true\:false\:true\:true
|
||||
|
@ -302,6 +352,7 @@ PA4.GPIO_Speed=GPIO_SPEED_FREQ_HIGH
|
|||
PA4.Locked=true
|
||||
PA4.PinState=GPIO_PIN_SET
|
||||
PA4.Signal=GPIO_Output
|
||||
PA5.Signal=COMP_DAC2_group
|
||||
PA7.GPIOParameters=GPIO_PuPd
|
||||
PA7.GPIO_PuPd=GPIO_PULLUP
|
||||
PA7.Locked=true
|
||||
|
@ -359,6 +410,16 @@ PC10.Signal=USART3_TX
|
|||
PC11.Locked=true
|
||||
PC11.Mode=Asynchronous
|
||||
PC11.Signal=USART3_RX
|
||||
PC4.GPIOParameters=GPIO_Label,GPIO_ModeDefaultEXTI
|
||||
PC4.GPIO_Label=INT_ACCEL
|
||||
PC4.GPIO_ModeDefaultEXTI=GPIO_MODE_IT_FALLING
|
||||
PC4.Locked=true
|
||||
PC4.Signal=GPXTI4
|
||||
PC5.GPIOParameters=GPIO_Label,GPIO_ModeDefaultEXTI
|
||||
PC5.GPIO_Label=INT_GYRO
|
||||
PC5.GPIO_ModeDefaultEXTI=GPIO_MODE_IT_FALLING
|
||||
PC5.Locked=true
|
||||
PC5.Signal=GPXTI5
|
||||
PC6.Locked=true
|
||||
PC6.Signal=S_TIM8_CH1
|
||||
PC9.Mode=I2C
|
||||
|
@ -379,10 +440,8 @@ PE11.Signal=S_TIM1_CH2
|
|||
PE13.Locked=true
|
||||
PE13.Signal=S_TIM1_CH3
|
||||
PE14.Signal=S_TIM1_CH4
|
||||
PE9.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label
|
||||
PE9.GPIOParameters=GPIO_Label
|
||||
PE9.GPIO_Label=SERVO
|
||||
PE9.GPIO_PuPd=GPIO_PULLUP
|
||||
PE9.GPIO_Speed=GPIO_SPEED_FREQ_HIGH
|
||||
PE9.Locked=true
|
||||
PE9.Signal=S_TIM1_CH1
|
||||
PF0.Mode=I2C
|
||||
|
@ -393,7 +452,7 @@ PG14.Locked=true
|
|||
PG14.Mode=Asynchronous
|
||||
PG14.Signal=USART6_TX
|
||||
PG3.GPIOParameters=GPIO_PuPd,GPIO_Label,GPIO_ModeDefaultEXTI
|
||||
PG3.GPIO_Label=MAG_DR
|
||||
PG3.GPIO_Label=INT_MAG
|
||||
PG3.GPIO_ModeDefaultEXTI=GPIO_MODE_IT_FALLING
|
||||
PG3.GPIO_PuPd=GPIO_PULLUP
|
||||
PG3.Locked=true
|
||||
|
@ -460,7 +519,7 @@ ProjectManager.StackSize=0x4000
|
|||
ProjectManager.TargetToolchain=Makefile
|
||||
ProjectManager.ToolChainLocation=
|
||||
ProjectManager.UnderRoot=false
|
||||
ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-MX_DMA_Init-DMA-false-HAL-true,3-SystemClock_Config-RCC-false-HAL-false,4-MX_ADC1_Init-ADC1-false-HAL-true,5-MX_CAN1_Init-CAN1-false-HAL-true,6-MX_CAN2_Init-CAN2-false-HAL-true,7-MX_SPI1_Init-SPI1-false-HAL-true,8-MX_TIM4_Init-TIM4-false-HAL-true,9-MX_TIM5_Init-TIM5-false-HAL-true,10-MX_USART3_UART_Init-USART3-false-HAL-true,11-MX_RNG_Init-RNG-false-HAL-true,12-MX_RTC_Init-RTC-false-HAL-true,13-MX_TIM1_Init-TIM1-false-HAL-true,14-MX_TIM10_Init-TIM10-false-HAL-true,15-MX_USART1_UART_Init-USART1-false-HAL-true,16-MX_USART6_UART_Init-USART6-false-HAL-true,17-MX_USB_DEVICE_Init-USB_DEVICE-false-HAL-false,18-MX_TIM8_Init-TIM8-false-HAL-true,19-MX_I2C2_Init-I2C2-false-HAL-true,20-MX_I2C3_Init-I2C3-false-HAL-true,21-MX_SPI2_Init-SPI2-false-HAL-true
|
||||
ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-MX_DMA_Init-DMA-false-HAL-true,3-SystemClock_Config-RCC-false-HAL-false,4-MX_ADC1_Init-ADC1-false-HAL-true,5-MX_CAN1_Init-CAN1-false-HAL-true,6-MX_CAN2_Init-CAN2-false-HAL-true,7-MX_SPI1_Init-SPI1-false-HAL-true,8-MX_TIM4_Init-TIM4-false-HAL-true,9-MX_TIM5_Init-TIM5-false-HAL-true,10-MX_USART3_UART_Init-USART3-false-HAL-true,11-MX_RNG_Init-RNG-false-HAL-true,12-MX_RTC_Init-RTC-false-HAL-true,13-MX_TIM1_Init-TIM1-false-HAL-true,14-MX_TIM10_Init-TIM10-false-HAL-true,15-MX_USART1_UART_Init-USART1-false-HAL-true,16-MX_USART6_UART_Init-USART6-false-HAL-true,17-MX_USB_DEVICE_Init-USB_DEVICE-false-HAL-false,18-MX_TIM8_Init-TIM8-false-HAL-true,19-MX_I2C2_Init-I2C2-false-HAL-true,20-MX_I2C3_Init-I2C3-false-HAL-true,21-MX_SPI2_Init-SPI2-false-HAL-true,22-MX_CRC_Init-CRC-false-HAL-true,23-MX_DAC_Init-DAC-false-HAL-true
|
||||
RCC.48MHZClocksFreq_Value=48000000
|
||||
RCC.AHBFreq_Value=168000000
|
||||
RCC.APB1CLKDivider=RCC_HCLK_DIV4
|
||||
|
@ -499,8 +558,14 @@ RCC.VcooutputI2S=192000000
|
|||
RTC.AsynchPrediv=124
|
||||
RTC.IPParameters=SynchPrediv,AsynchPrediv
|
||||
RTC.SynchPrediv=3199
|
||||
SH.COMP_DAC2_group.0=DAC_OUT2,DAC_OUT2
|
||||
SH.COMP_DAC2_group.ConfNb=1
|
||||
SH.GPXTI3.0=GPIO_EXTI3
|
||||
SH.GPXTI3.ConfNb=1
|
||||
SH.GPXTI4.0=GPIO_EXTI4
|
||||
SH.GPXTI4.ConfNb=1
|
||||
SH.GPXTI5.0=GPIO_EXTI5
|
||||
SH.GPXTI5.ConfNb=1
|
||||
SH.S_TIM10_CH1.0=TIM10_CH1,PWM Generation1 CH1
|
||||
SH.S_TIM10_CH1.ConfNb=1
|
||||
SH.S_TIM1_CH1.0=TIM1_CH1,PWM Generation1 CH1
|
||||
|
@ -549,7 +614,7 @@ TIM1.Channel-PWM\ Generation1\ CH1=TIM_CHANNEL_1
|
|||
TIM1.Channel-PWM\ Generation2\ CH2=TIM_CHANNEL_2
|
||||
TIM1.Channel-PWM\ Generation3\ CH3=TIM_CHANNEL_3
|
||||
TIM1.Channel-PWM\ Generation4\ CH4=TIM_CHANNEL_4
|
||||
TIM1.IPParameters=Period,Prescaler,Channel-PWM Generation1 CH1,Channel-PWM Generation2 CH2,Channel-PWM Generation3 CH3,Channel-PWM Generation4 CH4
|
||||
TIM1.IPParameters=Period,Prescaler,Channel-PWM Generation2 CH2,Channel-PWM Generation3 CH3,Channel-PWM Generation4 CH4,Channel-PWM Generation1 CH1
|
||||
TIM1.Period=19999
|
||||
TIM1.Prescaler=167
|
||||
TIM10.Channel=TIM_CHANNEL_1
|
||||
|
@ -591,6 +656,8 @@ VP_ADC1_TempSens_Input.Mode=IN-TempSens
|
|||
VP_ADC1_TempSens_Input.Signal=ADC1_TempSens_Input
|
||||
VP_ADC1_Vref_Input.Mode=IN-Vrefint
|
||||
VP_ADC1_Vref_Input.Signal=ADC1_Vref_Input
|
||||
VP_CRC_VS_CRC.Mode=CRC_Activate
|
||||
VP_CRC_VS_CRC.Signal=CRC_VS_CRC
|
||||
VP_FREERTOS_VS_CMSIS_V1.Mode=CMSIS_V1
|
||||
VP_FREERTOS_VS_CMSIS_V1.Signal=FREERTOS_VS_CMSIS_V1
|
||||
VP_RNG_VS_RNG.Mode=RNG_Activate
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
#include "bsp_iic.h"
|
||||
#include "memory.h"
|
||||
#include "stdlib.h"
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
#include "i2c.h"
|
||||
#include "stdint.h"
|
||||
|
||||
#define IIC_DEVICE_CNT ()
|
||||
|
||||
typedef struct
|
||||
{
|
||||
I2C_HandleTypeDef* handle;
|
||||
|
||||
};
|
||||
|
|
@ -6,6 +6,7 @@
|
|||
/* can instance ptrs storage, used for recv callback */
|
||||
// 在CAN产生接收中断会遍历数组,选出hcan和rxid与发生中断的实例相同的那个,调用其回调函数
|
||||
static CANInstance *instance[MX_REGISTER_DEVICE_CNT] = {NULL};
|
||||
static uint8_t idx; // 全局CAN实例索引,每次有新的模块注册会自增
|
||||
|
||||
/* ----------------two static function called by CANRegister()-------------------- */
|
||||
|
||||
|
@ -62,7 +63,6 @@ static void CANServiceInit()
|
|||
|
||||
CANInstance *CANRegister(CAN_Init_Config_s *config)
|
||||
{
|
||||
static uint8_t idx; // 全局CAN实例索引,每次有新的模块注册会自增
|
||||
if (!idx)
|
||||
{
|
||||
CANServiceInit(); // 第一次注册,先进行硬件初始化
|
||||
|
@ -79,7 +79,7 @@ CANInstance *CANRegister(CAN_Init_Config_s *config)
|
|||
instance[idx]->tx_id = config->tx_id; // 好像没用,可以删掉
|
||||
instance[idx]->rx_id = config->rx_id;
|
||||
instance[idx]->can_module_callback = config->can_module_callback;
|
||||
instance[idx]->id=config->id;
|
||||
instance[idx]->id = config->id;
|
||||
|
||||
CANAddFilter(instance[idx]); // 添加CAN过滤器规则
|
||||
return instance[idx++]; // 返回指针
|
||||
|
@ -96,9 +96,9 @@ void CANTransmit(CANInstance *_instance)
|
|||
|
||||
void CANSetDLC(CANInstance *_instance, uint8_t length)
|
||||
{
|
||||
if (length > 8) // 安全检查
|
||||
if (length > 8 || length < 0) // 安全检查
|
||||
while (1)
|
||||
;
|
||||
; // 发送长度错误!检查调用参数是否出错,或出现野指针/越界访问
|
||||
_instance->txconf.DLC = length;
|
||||
}
|
||||
|
||||
|
@ -113,23 +113,22 @@ void CANSetDLC(CANInstance *_instance, uint8_t length)
|
|||
*/
|
||||
static void CANFIFOxCallback(CAN_HandleTypeDef *_hcan, uint32_t fifox)
|
||||
{
|
||||
uint8_t can_rx_buff[8];
|
||||
CAN_RxHeaderTypeDef rxconf;
|
||||
static uint8_t can_rx_buff[8];
|
||||
static CAN_RxHeaderTypeDef rxconf;
|
||||
HAL_CAN_GetRxMessage(_hcan, fifox, &rxconf, can_rx_buff);
|
||||
for (size_t i = 0; i < MX_REGISTER_DEVICE_CNT; ++i)
|
||||
for (size_t i = 0; i < idx; ++i)
|
||||
{
|
||||
if (instance[i] != NULL) // 碰到NULL说明已经遍历完所有实例
|
||||
{ // 两者相等说明这是要找的实例
|
||||
if (_hcan == instance[i]->can_handle && rxconf.StdId == instance[i]->rx_id)
|
||||
// 两者相等说明这是要找的实例
|
||||
if (_hcan == instance[i]->can_handle && rxconf.StdId == instance[i]->rx_id)
|
||||
{
|
||||
instance[i]->rx_len = rxconf.DLC;
|
||||
memcpy(instance[i]->rx_buff, can_rx_buff, rxconf.DLC); // 消息拷贝到对应实例
|
||||
if (instance[i]->can_module_callback != NULL)
|
||||
{
|
||||
instance[i]->rx_len = rxconf.DLC;
|
||||
memcpy(instance[i]->rx_buff, can_rx_buff, rxconf.DLC); // 消息拷贝到对应实例
|
||||
instance[i]->can_module_callback(instance[i]); // 触发回调进行数据解析和处理
|
||||
break;
|
||||
instance[i]->can_module_callback(instance[i]); // 触发回调进行数据解析和处理
|
||||
}
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -17,13 +17,13 @@ typedef struct _
|
|||
CAN_TxHeaderTypeDef txconf; // CAN报文发送配置
|
||||
uint32_t tx_id; // 发送id
|
||||
uint32_t tx_mailbox; // CAN消息填入的邮箱号
|
||||
uint8_t tx_buff[8]; // 发送缓存,最大为8
|
||||
uint8_t rx_buff[8]; // 接收缓存
|
||||
uint8_t tx_buff[8]; // 发送缓存,发送消息长度可以通过CANSetDLC()设定,最大为8
|
||||
uint8_t rx_buff[8]; // 接收缓存,最大消息长度为8
|
||||
uint32_t rx_id; // 接收id
|
||||
uint8_t rx_len; // 接收长度,可能为0-8
|
||||
// 接收的回调函数,用于解析接收到的数据
|
||||
void (*can_module_callback)(struct _ *); // callback needs an instance to tell among registered ones
|
||||
void* id;
|
||||
void* id; // 使用can外设的
|
||||
} CANInstance;
|
||||
#pragma pack()
|
||||
|
|
@ -0,0 +1,145 @@
|
|||
#include "bsp_iic.h"
|
||||
#include "memory.h"
|
||||
#include "stdlib.h"
|
||||
|
||||
static uint8_t idx = 0; // 配合中断以及初始化
|
||||
static IICInstance *iic_instance[IIC_DEVICE_CNT] = {NULL};
|
||||
|
||||
/**
|
||||
* @brief 接收完成回调函数
|
||||
*
|
||||
* @param hi2c handle
|
||||
*/
|
||||
void HAL_I2C_MasterRxCpltCallback(I2C_HandleTypeDef *hi2c)
|
||||
{
|
||||
// 如果是当前i2c硬件发出的complete,且dev_address和之前发起接收的地址相同,同时回到函数不为空, 则调用回调函数
|
||||
for (uint8_t i = 0; i < idx; i++)
|
||||
{
|
||||
if (iic_instance[i]->handle == hi2c && hi2c->Devaddress == iic_instance[i]->dev_address)
|
||||
{
|
||||
if (iic_instance[i]->callback != NULL)
|
||||
iic_instance[i]->callback(iic_instance[i]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 仅做形式上的封装,仍然使用HAL_I2C_MasterRxCpltCallback
|
||||
*
|
||||
* @param hi2c handle
|
||||
*/
|
||||
void HAL_I2C_MemRxCpltCallback(I2C_HandleTypeDef *hi2c)
|
||||
{
|
||||
HAL_I2C_MasterRxCpltCallback(hi2c);
|
||||
}
|
||||
|
||||
IICInstance *IICRegister(IIC_Init_Config_s *conf)
|
||||
{
|
||||
// 申请到的空间未必是0, 所以需要手动初始化
|
||||
iic_instance[idx] = (IICInstance *)malloc(sizeof(IICInstance));
|
||||
memset(iic_instance[idx], 0, sizeof(IICInstance));
|
||||
|
||||
iic_instance[idx]->dev_address = conf->dev_address;
|
||||
iic_instance[idx]->callback = conf->callback;
|
||||
iic_instance[idx]->work_mode = conf->work_mode;
|
||||
iic_instance[idx]->handle = conf->handle;
|
||||
iic_instance[idx]->id = conf->id;
|
||||
|
||||
return iic_instance[idx++];
|
||||
}
|
||||
|
||||
void IICSetMode(IICInstance *iic, IIC_Work_Mode_e mode)
|
||||
{ // HAL自带重入保护,不需要手动终止或等待传输完成
|
||||
if (iic->work_mode != mode) // 如果不同才需要修改
|
||||
{
|
||||
iic->work_mode = mode;
|
||||
}
|
||||
}
|
||||
|
||||
void IICTransmit(IICInstance *iic, uint8_t *data, uint16_t size, IIC_Seq_Mode_e seq_mode)
|
||||
{
|
||||
if (seq_mode != IIC_RELEASE && seq_mode != IIC_HOLD_ON)
|
||||
while (1)
|
||||
; // 未知传输模式, 程序停止
|
||||
|
||||
switch (iic->work_mode)
|
||||
{
|
||||
case IIC_BLOCK_MODE:
|
||||
if (seq_mode != IIC_RELEASE)
|
||||
while (1)
|
||||
; // 阻塞模式下不支持HOLD ON模式!!!
|
||||
HAL_I2C_Master_Transmit(iic->handle, iic->dev_address, data, size, 100);
|
||||
break;
|
||||
case IIC_IT_MODE:
|
||||
if (seq_mode == IIC_RELEASE)
|
||||
HAL_I2C_Master_Seq_Transmit_IT(iic->handle, iic->dev_address, data, size, I2C_OTHER_AND_LAST_FRAME);
|
||||
else if (seq_mode == IIC_HOLD_ON)
|
||||
HAL_I2C_Master_Seq_Transmit_IT(iic->handle, iic->dev_address, data, size, I2C_OTHER_FRAME);
|
||||
break;
|
||||
case IIC_DMA_MODE:
|
||||
if (seq_mode == IIC_RELEASE)
|
||||
HAL_I2C_Master_Seq_Transmit_DMA(iic->handle, iic->dev_address, data, size, I2C_OTHER_AND_LAST_FRAME);
|
||||
else if (seq_mode == IIC_HOLD_ON)
|
||||
HAL_I2C_Master_Seq_Transmit_DMA(iic->handle, iic->dev_address, data, size, I2C_OTHER_FRAME);
|
||||
break;
|
||||
default:
|
||||
while (1)
|
||||
; // 未知传输模式, 程序停止
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void IICReceive(IICInstance *iic, uint8_t *data, uint16_t size, IIC_Seq_Mode_e seq_mode)
|
||||
{
|
||||
if (seq_mode != IIC_RELEASE && seq_mode != IIC_HOLD_ON)
|
||||
while (1)
|
||||
; // 未知传输模式, 程序停止
|
||||
|
||||
// 初始化接收缓冲区地址以及接受长度, 用于中断回调函数
|
||||
iic->rx_buffer = data;
|
||||
iic->rx_len = size;
|
||||
|
||||
switch (iic->work_mode)
|
||||
{
|
||||
case IIC_BLOCK_MODE:
|
||||
if (seq_mode != IIC_RELEASE)
|
||||
while (1)
|
||||
; // 阻塞模式下不支持HOLD ON模式!!!
|
||||
HAL_I2C_Master_Receive(iic->handle, iic->dev_address, data, size, 100);
|
||||
break;
|
||||
case IIC_IT_MODE:
|
||||
if (seq_mode == IIC_RELEASE)
|
||||
HAL_I2C_Master_Seq_Receive_IT(iic->handle, iic->dev_address, data, size, I2C_OTHER_AND_LAST_FRAME);
|
||||
else if (seq_mode == IIC_HOLD_ON)
|
||||
HAL_I2C_Master_Seq_Receive_IT(iic->handle, iic->dev_address, data, size, I2C_OTHER_FRAME);
|
||||
break;
|
||||
case IIC_DMA_MODE:
|
||||
if (seq_mode == IIC_RELEASE)
|
||||
HAL_I2C_Master_Seq_Receive_DMA(iic->handle, iic->dev_address, data, size, I2C_OTHER_AND_LAST_FRAME);
|
||||
else if (seq_mode == IIC_HOLD_ON)
|
||||
HAL_I2C_Master_Seq_Receive_DMA(iic->handle, iic->dev_address, data, size, I2C_OTHER_FRAME);
|
||||
break;
|
||||
default:
|
||||
while (1)
|
||||
; // 未知传输模式, 程序停止
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void IICAcessMem(IICInstance *iic, uint8_t mem_addr, uint8_t *data, uint16_t size, IIC_Mem_Mode_e mem_mode)
|
||||
{
|
||||
if (mem_mode == IIC_WRITE_MEM)
|
||||
{
|
||||
HAL_I2C_Mem_Write(iic->handle, iic->dev_address, mem_addr, I2C_MEMADD_SIZE_8BIT, data, size, 1000);
|
||||
}
|
||||
else if (mem_mode == IIC_READ_MEM)
|
||||
{
|
||||
HAL_I2C_Mem_Read(iic->handle, iic->dev_address, mem_addr, I2C_MEMADD_SIZE_8BIT, data, size, 1000);
|
||||
}
|
||||
else
|
||||
{
|
||||
while (1)
|
||||
; // 未知模式, 程序停止
|
||||
}
|
||||
}
|
|
@ -0,0 +1,105 @@
|
|||
#include "i2c.h"
|
||||
#include "stdint.h"
|
||||
|
||||
#define IIC_DEVICE_CNT 2 // C板引出了I2C2和I2C3
|
||||
#define MX_IIC_SLAVE_CNT 8 // 最大从机数目,根据需要修改
|
||||
|
||||
/* i2c 工作模式枚举 */
|
||||
typedef enum
|
||||
{
|
||||
// 基本工作模式
|
||||
IIC_BLOCK_MODE = 0, // 阻塞模式
|
||||
IIC_IT_MODE, // 中断模式
|
||||
IIC_DMA_MODE, // DMA模式
|
||||
|
||||
} IIC_Work_Mode_e;
|
||||
|
||||
/* I2C MEM工作模式枚举,这两种方法都是阻塞 */
|
||||
typedef enum
|
||||
{
|
||||
IIC_READ_MEM = 0, // 读取从机内部的寄存器or内存
|
||||
IIC_WRITE_MEM, // 写入从机内部的寄存器or内存
|
||||
} IIC_Mem_Mode_e;
|
||||
|
||||
/* Seq传输工作模式枚举,注意HOLD_ON要在IT或DMA下使用 */
|
||||
// 必须以IIC_RELEASE为最后一次传输,否则会导致总线占有权无法释放
|
||||
typedef enum
|
||||
{
|
||||
IIC_RELEASE, // 完成传输后释放总线占有权,这是默认的传输方式
|
||||
IIC_HOLD_ON = 0, // 保持总线占有权不释放,只支持IT和DMA模式
|
||||
} IIC_Seq_Mode_e;
|
||||
|
||||
/* i2c实例 */
|
||||
typedef struct iic_temp_s
|
||||
{
|
||||
I2C_HandleTypeDef *handle; // i2c handle
|
||||
uint8_t dev_address; // 暂时只支持7位地址(还有一位是读写位)
|
||||
|
||||
IIC_Work_Mode_e work_mode; // 工作模式
|
||||
uint8_t *rx_buffer; // 接收缓冲区指针
|
||||
uint8_t rx_len; // 接收长度
|
||||
void (*callback)(struct iic_temp_s *); // 接收完成后的回调函数
|
||||
|
||||
void *id; // 用于标识i2c instance
|
||||
} IICInstance;
|
||||
|
||||
/* I2C 初始化结构体配置 */
|
||||
typedef struct
|
||||
{
|
||||
I2C_HandleTypeDef *handle; // i2c handle
|
||||
uint8_t dev_address; // 暂时只支持7位地址(还有一位是读写位),注意不需要左移
|
||||
IIC_Work_Mode_e work_mode; // 工作模式
|
||||
void (*callback)(IICInstance *); // 接收完成后的回调函数
|
||||
void *id; // 用于标识i2c instance
|
||||
} IIC_Init_Config_s;
|
||||
|
||||
/**
|
||||
* @brief IIC初始化
|
||||
*
|
||||
* @param conf 初始化配置
|
||||
* @return IICInstance*
|
||||
*/
|
||||
IICInstance *IICRegister(IIC_Init_Config_s *conf);
|
||||
|
||||
/**
|
||||
* @brief IIC设置工作模式
|
||||
*
|
||||
* @param iic 要设置的iic实例
|
||||
* @param mode 工作模式
|
||||
*/
|
||||
void IICSetMode(IICInstance *iic, IIC_Work_Mode_e mode);
|
||||
|
||||
/**
|
||||
* @brief IIC发送数据
|
||||
*
|
||||
* @param iic iic实例
|
||||
* @param data 待发送的数据首地址指针
|
||||
* @param size 发送长度
|
||||
* @param mode 序列传输模式
|
||||
* @note 注意,如果发送结构体,那么该结构体在声明时务必使用#pragma pack(1)进行对齐,并在声明结束后使用#pragma pack()恢复对齐
|
||||
*
|
||||
*/
|
||||
void IICTransmit(IICInstance *iic, uint8_t *data, uint16_t size, IIC_Seq_Mode_e mode);
|
||||
|
||||
/**
|
||||
* @brief IIC接收数据
|
||||
*
|
||||
* @param iic iic实例
|
||||
* @param data 接收数据的首地址指针
|
||||
* @param size 接收长度
|
||||
* @param mode 序列传输模式
|
||||
* @note 注意,如果直接将接收数据memcpy到目标结构体或通过强制类型转换进行逐字节写入,
|
||||
* 那么该结构体在声明时务必使用#pragma pack(1)进行对齐,并在声明结束后使用#pragma pack()恢复对齐
|
||||
*/
|
||||
void IICReceive(IICInstance *iic, uint8_t *data, uint16_t size,IIC_Seq_Mode_e mode);
|
||||
|
||||
/**
|
||||
* @brief IIC读取从机寄存器(内存),只支持阻塞模式,超时默认为1ms
|
||||
*
|
||||
* @param iic iic实例
|
||||
* @param mem_addr 要读取的从机内存地址,目前只支持8位地址
|
||||
* @param data 要读取或写入的数据首地址指针
|
||||
* @param size 要读取或写入的数据长度
|
||||
* @param mode 写入或读取模式: IIC_READ_MEM or IIC_WRITE_MEM
|
||||
*/
|
||||
void IICAcessMem(IICInstance *iic, uint8_t mem_addr, uint8_t *data, uint16_t size, IIC_Mem_Mode_e mode);
|
|
@ -15,11 +15,16 @@ void HAL_SPI_RxCpltCallback(SPI_HandleTypeDef *hspi)
|
|||
{
|
||||
for (size_t i = 0; i < idx; i++)
|
||||
{
|
||||
if (spi_instance[i]->spi_handle == hspi && spi_instance[i]->callback)
|
||||
// 如果是当前spi硬件发出的complete,且cs_pin为低电平(说明正在传输),则尝试调用回调函数
|
||||
if (spi_instance[i]->spi_handle == hspi &&
|
||||
HAL_GPIO_ReadPin(spi_instance[i]->GPIO_cs, spi_instance[i]->cs_pin) == GPIO_PIN_RESET)
|
||||
{
|
||||
// 拉高片选(关闭传输),调用解析回调函数
|
||||
HAL_GPIO_WritePin(spi_instance[i]->GPIO_cs, spi_instance[i]->cs_pin, GPIO_PIN_SET);
|
||||
spi_instance[i]->callback(spi_instance[i]);
|
||||
if (spi_instance[i]->callback) // 回调函数不为空, 则调用回调函数
|
||||
{
|
||||
// 先拉高片选,结束传输
|
||||
HAL_GPIO_WritePin(spi_instance[i]->GPIO_cs, spi_instance[i]->cs_pin, GPIO_PIN_SET);
|
||||
spi_instance[i]->callback(spi_instance[i]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -41,6 +46,9 @@ SPIInstance *SPIRegister(SPI_Init_Config_s *conf)
|
|||
spi_instance[idx]->callback = conf->callback;
|
||||
spi_instance[idx]->spi_work_mode = conf->spi_work_mode;
|
||||
spi_instance[idx]->spi_handle = conf->spi_handle;
|
||||
spi_instance[idx]->GPIO_cs = conf->GPIO_cs;
|
||||
spi_instance[idx]->cs_pin = conf->cs_pin;
|
||||
spi_instance[idx]->id = conf->id;
|
||||
return spi_instance[idx++];
|
||||
}
|
||||
|
||||
|
@ -70,6 +78,9 @@ void SPITransmit(SPIInstance *spi_ins, uint8_t *ptr_data, uint8_t len)
|
|||
|
||||
void SPIRecv(SPIInstance *spi_ins, uint8_t *ptr_data, uint8_t len)
|
||||
{
|
||||
// 用于稍后回调使用
|
||||
spi_ins->rx_size = len;
|
||||
spi_ins->rx_buffer = ptr_data;
|
||||
// 拉低片选,开始传输
|
||||
HAL_GPIO_WritePin(spi_ins->GPIO_cs, spi_ins->cs_pin, GPIO_PIN_RESET);
|
||||
switch (spi_ins->spi_work_mode)
|
||||
|
@ -94,6 +105,9 @@ void SPIRecv(SPIInstance *spi_ins, uint8_t *ptr_data, uint8_t len)
|
|||
|
||||
void SPITransRecv(SPIInstance *spi_ins, uint8_t *ptr_data_rx, uint8_t *ptr_data_tx, uint8_t len)
|
||||
{
|
||||
// 用于稍后回调使用
|
||||
spi_ins->rx_size = len;
|
||||
spi_ins->rx_buffer = ptr_data_rx;
|
||||
// 拉低片选,开始传输
|
||||
HAL_GPIO_WritePin(spi_ins->GPIO_cs, spi_ins->cs_pin, GPIO_PIN_RESET);
|
||||
switch (spi_ins->spi_work_mode)
|
||||
|
@ -118,26 +132,12 @@ void SPITransRecv(SPIInstance *spi_ins, uint8_t *ptr_data_rx, uint8_t *ptr_data_
|
|||
|
||||
void SPISetMode(SPIInstance *spi_ins, SPI_TXRX_MODE_e spi_mode)
|
||||
{
|
||||
if (spi_mode != SPI_DMA_MODE && spi_mode != SPI_IT_MODE && spi_mode != SPI_BLOCK_MODE)
|
||||
while (1)
|
||||
; // error mode! 请查看是否正确设置模式,或出现指针越界导致模式被异常修改的情况
|
||||
|
||||
if (spi_ins->spi_work_mode != spi_mode)
|
||||
{
|
||||
switch (spi_ins->spi_work_mode)
|
||||
{
|
||||
case SPI_IT_MODE:
|
||||
case SPI_DMA_MODE:
|
||||
// IT和DMA处理相同,都是先终止传输,防止传输未完成直接切换导致spi死机
|
||||
HAL_SPI_Abort_IT(spi_ins->spi_handle);
|
||||
HAL_GPIO_WritePin(spi_ins->GPIO_cs, spi_ins->cs_pin, GPIO_PIN_SET); // 关闭后拉高片选
|
||||
break;
|
||||
case SPI_BLOCK_MODE:
|
||||
// 阻塞模式仍然有可能在多线程的情况下出现传输到一半切换,因此先终止
|
||||
HAL_SPI_Abort(spi_ins->spi_handle);
|
||||
HAL_GPIO_WritePin(spi_ins->GPIO_cs, spi_ins->cs_pin, GPIO_PIN_SET); // 关闭后拉高片选
|
||||
break;
|
||||
default:
|
||||
while (1)
|
||||
; // error mode! 请查看是否正确设置模式,或出现指针越界导致模式被异常修改的情况
|
||||
break;
|
||||
}
|
||||
spi_ins->spi_work_mode = spi_mode;
|
||||
}
|
||||
}
|
|
@ -17,24 +17,32 @@ typedef enum
|
|||
/* SPI实例结构体定义 */
|
||||
typedef struct spi_ins_temp
|
||||
{
|
||||
SPI_HandleTypeDef *spi_handle; // SPI外设handle
|
||||
GPIO_TypeDef *GPIO_cs; // 片选信号对应的GPIO,如GPIOA,GPIOB等等
|
||||
uint16_t cs_pin; // 片选信号对应的引脚号,GPIO_PIN_1,GPIO_PIN_2等等
|
||||
SPI_HandleTypeDef *spi_handle; // SPI外设handle
|
||||
GPIO_TypeDef *GPIO_cs; // 片选信号对应的GPIO,如GPIOA,GPIOB等等
|
||||
uint16_t cs_pin; // 片选信号对应的引脚号,GPIO_PIN_1,GPIO_PIN_2等等
|
||||
|
||||
SPI_TXRX_MODE_e spi_work_mode; // 传输工作模式
|
||||
uint8_t rx_size; // 本次接收的数据长度
|
||||
uint8_t *rx_buffer; // 本次接收的数据缓冲区
|
||||
void (*callback)(struct spi_ins_temp *); // 接收回调函数
|
||||
|
||||
void *id; // 模块指针
|
||||
} SPIInstance;
|
||||
|
||||
/* rx data resolve callback*/
|
||||
typedef void (*spi_rx_callback)(SPIInstance *);
|
||||
|
||||
/* SPI初始化配置,其实和SPIIstance一模一样,为了代码风格统一因此再次定义 */
|
||||
/* SPI初始化配置,其实基本和SPIIstance一模一样,为了代码风格统一因此再次定义 */
|
||||
typedef struct
|
||||
{
|
||||
SPI_HandleTypeDef *spi_handle; // SPI外设handle
|
||||
GPIO_TypeDef *GPIO_cs; // 片选信号对应的GPIO,如GPIOA,GPIOB等等
|
||||
uint16_t cs_pin; // 片选信号对应的引脚号,GPIO_PIN_1,GPIO_PIN_2等等
|
||||
|
||||
SPI_TXRX_MODE_e spi_work_mode; // 传输工作模式
|
||||
spi_rx_callback callback; // 接收回调函数
|
||||
|
||||
spi_rx_callback callback; // 接收回调函数
|
||||
void *id; // 模块指针
|
||||
} SPI_Init_Config_s;
|
||||
|
||||
/**
|
||||
|
@ -78,5 +86,8 @@ void SPITransRecv(SPIInstance *spi_ins, uint8_t *ptr_data_rx, uint8_t *ptr_data_
|
|||
*
|
||||
* @param spi_ins spi实例指针
|
||||
* @param spi_mode 工作模式,包括阻塞模式(block),中断模式(IT),DMA模式.详见SPI_TXRX_MODE_e的定义
|
||||
* @param force_set_flag 强制设置标志,当该标志为1时,强制停止当前spi的收发,并切换到新的工作模式;
|
||||
* 当该标志为0时,如果当前spi正在收发,则不会切换工作模式,等待传输完成后切换.
|
||||
* @todo HAL已经提供了防止重入的机制,因此强制设置标志可以去掉,也不需要再判断spi是否正在收发
|
||||
*/
|
||||
void SPISetMode(SPIInstance *spi_ins, SPI_TXRX_MODE_e spi_mode);
|
|
@ -0,0 +1,5 @@
|
|||
#include "bmi088.h"
|
||||
#include "bmi088_regNdef.h"
|
||||
#include "stdlib.h"
|
||||
#include "memory.h"
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
#include "bsp_spi.h"
|
||||
|
||||
/* BMI088实例结构体定义 */
|
||||
typedef struct
|
||||
{
|
||||
SPIInstance *spi_gyro;
|
||||
SPIInstance *spi_acc;
|
||||
|
||||
|
||||
} BMI088Instance;
|
||||
|
||||
/* BMI088初始化配置 */
|
||||
typedef struct
|
||||
{
|
||||
|
||||
}BMI088_Init_Config_s;
|
||||
|
|
@ -0,0 +1,234 @@
|
|||
#ifndef BMI088REG_H
|
||||
#define BMI088REG_H
|
||||
|
||||
/*------- BMI088寄存器地址和内容-------*/
|
||||
|
||||
#define BMI088_ACC_CHIP_ID 0x00 // the register is " Who am I "
|
||||
#define BMI088_ACC_CHIP_ID_VALUE 0x1E
|
||||
|
||||
#define BMI088_ACC_ERR_REG 0x02
|
||||
#define BMI088_ACCEL_CONGIF_ERROR_SHFITS 0x2
|
||||
#define BMI088_ACCEL_CONGIF_ERROR (1 << BMI088_ACCEL_CONGIF_ERROR_SHFITS)
|
||||
#define BMI088_FATAL_ERROR_SHFITS 0x0
|
||||
#define BMI088_FATAL_ERROR (1 << BMI088_FATAL_ERROR)
|
||||
|
||||
#define BMI088_ACC_STATUS 0x03
|
||||
#define BMI088_ACCEL_DRDY_SHFITS 0x7
|
||||
#define BMI088_ACCEL_DRDY (1 << BMI088_ACCEL_DRDY_SHFITS)
|
||||
|
||||
#define BMI088_ACCEL_XOUT_L 0x12
|
||||
#define BMI088_ACCEL_XOUT_M 0x13
|
||||
#define BMI088_ACCEL_YOUT_L 0x14
|
||||
#define BMI088_ACCEL_YOUT_M 0x15
|
||||
#define BMI088_ACCEL_ZOUT_L 0x16
|
||||
#define BMI088_ACCEL_ZOUT_M 0x17
|
||||
|
||||
#define BMI088_SENSORTIME_DATA_L 0x18
|
||||
#define BMI088_SENSORTIME_DATA_M 0x19
|
||||
#define BMI088_SENSORTIME_DATA_H 0x1A
|
||||
|
||||
#define BMI088_ACC_INT_STAT_1 0x1D
|
||||
#define BMI088_ACCEL_DRDY_INTERRUPT_SHFITS 0x7
|
||||
#define BMI088_ACCEL_DRDY_INTERRUPT (1 << BMI088_ACCEL_DRDY_INTERRUPT_SHFITS)
|
||||
|
||||
#define BMI088_TEMP_M 0x22
|
||||
|
||||
#define BMI088_TEMP_L 0x23
|
||||
|
||||
#define BMI088_ACC_CONF 0x40
|
||||
#define BMI088_ACC_CONF_MUST_Set 0x80
|
||||
#define BMI088_ACC_BWP_SHFITS 0x4
|
||||
#define BMI088_ACC_OSR4 (0x0 << BMI088_ACC_BWP_SHFITS)
|
||||
#define BMI088_ACC_OSR2 (0x1 << BMI088_ACC_BWP_SHFITS)
|
||||
#define BMI088_ACC_NORMAL (0x2 << BMI088_ACC_BWP_SHFITS)
|
||||
|
||||
#define BMI088_ACC_ODR_SHFITS 0x0
|
||||
#define BMI088_ACC_12_5_HZ (0x5 << BMI088_ACC_ODR_SHFITS)
|
||||
#define BMI088_ACC_25_HZ (0x6 << BMI088_ACC_ODR_SHFITS)
|
||||
#define BMI088_ACC_50_HZ (0x7 << BMI088_ACC_ODR_SHFITS)
|
||||
#define BMI088_ACC_100_HZ (0x8 << BMI088_ACC_ODR_SHFITS)
|
||||
#define BMI088_ACC_200_HZ (0x9 << BMI088_ACC_ODR_SHFITS)
|
||||
#define BMI088_ACC_400_HZ (0xA << BMI088_ACC_ODR_SHFITS)
|
||||
#define BMI088_ACC_800_HZ (0xB << BMI088_ACC_ODR_SHFITS)
|
||||
#define BMI088_ACC_1600_HZ (0xC << BMI088_ACC_ODR_SHFITS)
|
||||
|
||||
#define BMI088_ACC_RANGE 0x41
|
||||
|
||||
#define BMI088_ACC_RANGE_SHFITS 0x0
|
||||
#define BMI088_ACC_RANGE_3G (0x0 << BMI088_ACC_RANGE_SHFITS)
|
||||
#define BMI088_ACC_RANGE_6G (0x1 << BMI088_ACC_RANGE_SHFITS)
|
||||
#define BMI088_ACC_RANGE_12G (0x2 << BMI088_ACC_RANGE_SHFITS)
|
||||
#define BMI088_ACC_RANGE_24G (0x3 << BMI088_ACC_RANGE_SHFITS)
|
||||
|
||||
#define BMI088_INT1_IO_CTRL 0x53
|
||||
#define BMI088_ACC_INT1_IO_ENABLE_SHFITS 0x3
|
||||
#define BMI088_ACC_INT1_IO_ENABLE (0x1 << BMI088_ACC_INT1_IO_ENABLE_SHFITS)
|
||||
#define BMI088_ACC_INT1_GPIO_MODE_SHFITS 0x2
|
||||
#define BMI088_ACC_INT1_GPIO_PP (0x0 << BMI088_ACC_INT1_GPIO_MODE_SHFITS)
|
||||
#define BMI088_ACC_INT1_GPIO_OD (0x1 << BMI088_ACC_INT1_GPIO_MODE_SHFITS)
|
||||
#define BMI088_ACC_INT1_GPIO_LVL_SHFITS 0x1
|
||||
#define BMI088_ACC_INT1_GPIO_LOW (0x0 << BMI088_ACC_INT1_GPIO_LVL_SHFITS)
|
||||
#define BMI088_ACC_INT1_GPIO_HIGH (0x1 << BMI088_ACC_INT1_GPIO_LVL_SHFITS)
|
||||
|
||||
#define BMI088_INT2_IO_CTRL 0x54
|
||||
#define BMI088_ACC_INT2_IO_ENABLE_SHFITS 0x3
|
||||
#define BMI088_ACC_INT2_IO_ENABLE (0x1 << BMI088_ACC_INT2_IO_ENABLE_SHFITS)
|
||||
#define BMI088_ACC_INT2_GPIO_MODE_SHFITS 0x2
|
||||
#define BMI088_ACC_INT2_GPIO_PP (0x0 << BMI088_ACC_INT2_GPIO_MODE_SHFITS)
|
||||
#define BMI088_ACC_INT2_GPIO_OD (0x1 << BMI088_ACC_INT2_GPIO_MODE_SHFITS)
|
||||
#define BMI088_ACC_INT2_GPIO_LVL_SHFITS 0x1
|
||||
#define BMI088_ACC_INT2_GPIO_LOW (0x0 << BMI088_ACC_INT2_GPIO_LVL_SHFITS)
|
||||
#define BMI088_ACC_INT2_GPIO_HIGH (0x1 << BMI088_ACC_INT2_GPIO_LVL_SHFITS)
|
||||
|
||||
#define BMI088_INT_MAP_DATA 0x58
|
||||
#define BMI088_ACC_INT2_DRDY_INTERRUPT_SHFITS 0x6
|
||||
#define BMI088_ACC_INT2_DRDY_INTERRUPT (0x1 << BMI088_ACC_INT2_DRDY_INTERRUPT_SHFITS)
|
||||
#define BMI088_ACC_INT1_DRDY_INTERRUPT_SHFITS 0x2
|
||||
#define BMI088_ACC_INT1_DRDY_INTERRUPT (0x1 << BMI088_ACC_INT1_DRDY_INTERRUPT_SHFITS)
|
||||
|
||||
#define BMI088_ACC_SELF_TEST 0x6D
|
||||
#define BMI088_ACC_SELF_TEST_OFF 0x00
|
||||
#define BMI088_ACC_SELF_TEST_POSITIVE_SIGNAL 0x0D
|
||||
#define BMI088_ACC_SELF_TEST_NEGATIVE_SIGNAL 0x09
|
||||
|
||||
#define BMI088_ACC_PWR_CONF 0x7C
|
||||
#define BMI088_ACC_PWR_SUSPEND_MODE 0x03
|
||||
#define BMI088_ACC_PWR_ACTIVE_MODE 0x00
|
||||
|
||||
#define BMI088_ACC_PWR_CTRL 0x7D
|
||||
#define BMI088_ACC_ENABLE_ACC_OFF 0x00
|
||||
#define BMI088_ACC_ENABLE_ACC_ON 0x04
|
||||
|
||||
#define BMI088_ACC_SOFTRESET 0x7E
|
||||
#define BMI088_ACC_SOFTRESET_VALUE 0xB6
|
||||
|
||||
#define BMI088_GYRO_CHIP_ID 0x00
|
||||
#define BMI088_GYRO_CHIP_ID_VALUE 0x0F
|
||||
|
||||
#define BMI088_GYRO_X_L 0x02
|
||||
#define BMI088_GYRO_X_H 0x03
|
||||
#define BMI088_GYRO_Y_L 0x04
|
||||
#define BMI088_GYRO_Y_H 0x05
|
||||
#define BMI088_GYRO_Z_L 0x06
|
||||
#define BMI088_GYRO_Z_H 0x07
|
||||
|
||||
#define BMI088_GYRO_INT_STAT_1 0x0A
|
||||
#define BMI088_GYRO_DYDR_SHFITS 0x7
|
||||
#define BMI088_GYRO_DYDR (0x1 << BMI088_GYRO_DYDR_SHFITS)
|
||||
|
||||
#define BMI088_GYRO_RANGE 0x0F
|
||||
#define BMI088_GYRO_RANGE_SHFITS 0x0
|
||||
#define BMI088_GYRO_2000 (0x0 << BMI088_GYRO_RANGE_SHFITS)
|
||||
#define BMI088_GYRO_1000 (0x1 << BMI088_GYRO_RANGE_SHFITS)
|
||||
#define BMI088_GYRO_500 (0x2 << BMI088_GYRO_RANGE_SHFITS)
|
||||
#define BMI088_GYRO_250 (0x3 << BMI088_GYRO_RANGE_SHFITS)
|
||||
#define BMI088_GYRO_125 (0x4 << BMI088_GYRO_RANGE_SHFITS)
|
||||
|
||||
#define BMI088_GYRO_BANDWIDTH 0x10
|
||||
// the first num means Output data rate, the second num means bandwidth
|
||||
#define BMI088_GYRO_BANDWIDTH_MUST_Set 0x80
|
||||
#define BMI088_GYRO_2000_532_HZ 0x00
|
||||
#define BMI088_GYRO_2000_230_HZ 0x01
|
||||
#define BMI088_GYRO_1000_116_HZ 0x02
|
||||
#define BMI088_GYRO_400_47_HZ 0x03
|
||||
#define BMI088_GYRO_200_23_HZ 0x04
|
||||
#define BMI088_GYRO_100_12_HZ 0x05
|
||||
#define BMI088_GYRO_200_64_HZ 0x06
|
||||
#define BMI088_GYRO_100_32_HZ 0x07
|
||||
|
||||
#define BMI088_GYRO_LPM1 0x11
|
||||
#define BMI088_GYRO_NORMAL_MODE 0x00
|
||||
#define BMI088_GYRO_SUSPEND_MODE 0x80
|
||||
#define BMI088_GYRO_DEEP_SUSPEND_MODE 0x20
|
||||
|
||||
#define BMI088_GYRO_SOFTRESET 0x14
|
||||
#define BMI088_GYRO_SOFTRESET_VALUE 0xB6
|
||||
|
||||
#define BMI088_GYRO_CTRL 0x15
|
||||
#define BMI088_DRDY_OFF 0x00
|
||||
#define BMI088_DRDY_ON 0x80
|
||||
|
||||
#define BMI088_GYRO_INT3_INT4_IO_CONF 0x16
|
||||
#define BMI088_GYRO_INT4_GPIO_MODE_SHFITS 0x3
|
||||
#define BMI088_GYRO_INT4_GPIO_PP (0x0 << BMI088_GYRO_INT4_GPIO_MODE_SHFITS)
|
||||
#define BMI088_GYRO_INT4_GPIO_OD (0x1 << BMI088_GYRO_INT4_GPIO_MODE_SHFITS)
|
||||
#define BMI088_GYRO_INT4_GPIO_LVL_SHFITS 0x2
|
||||
#define BMI088_GYRO_INT4_GPIO_LOW (0x0 << BMI088_GYRO_INT4_GPIO_LVL_SHFITS)
|
||||
#define BMI088_GYRO_INT4_GPIO_HIGH (0x1 << BMI088_GYRO_INT4_GPIO_LVL_SHFITS)
|
||||
#define BMI088_GYRO_INT3_GPIO_MODE_SHFITS 0x1
|
||||
#define BMI088_GYRO_INT3_GPIO_PP (0x0 << BMI088_GYRO_INT3_GPIO_MODE_SHFITS)
|
||||
#define BMI088_GYRO_INT3_GPIO_OD (0x1 << BMI088_GYRO_INT3_GPIO_MODE_SHFITS)
|
||||
#define BMI088_GYRO_INT3_GPIO_LVL_SHFITS 0x0
|
||||
#define BMI088_GYRO_INT3_GPIO_LOW (0x0 << BMI088_GYRO_INT3_GPIO_LVL_SHFITS)
|
||||
#define BMI088_GYRO_INT3_GPIO_HIGH (0x1 << BMI088_GYRO_INT3_GPIO_LVL_SHFITS)
|
||||
|
||||
#define BMI088_GYRO_INT3_INT4_IO_MAP 0x18
|
||||
|
||||
#define BMI088_GYRO_DRDY_IO_OFF 0x00
|
||||
#define BMI088_GYRO_DRDY_IO_INT3 0x01
|
||||
#define BMI088_GYRO_DRDY_IO_INT4 0x80
|
||||
#define BMI088_GYRO_DRDY_IO_BOTH (BMI088_GYRO_DRDY_IO_INT3 | BMI088_GYRO_DRDY_IO_INT4)
|
||||
|
||||
#define BMI088_GYRO_SELF_TEST 0x3C
|
||||
#define BMI088_GYRO_RATE_OK_SHFITS 0x4
|
||||
#define BMI088_GYRO_RATE_OK (0x1 << BMI088_GYRO_RATE_OK_SHFITS)
|
||||
#define BMI088_GYRO_BIST_FAIL_SHFITS 0x2
|
||||
#define BMI088_GYRO_BIST_FAIL (0x1 << BMI088_GYRO_BIST_FAIL_SHFITS)
|
||||
#define BMI088_GYRO_BIST_RDY_SHFITS 0x1
|
||||
#define BMI088_GYRO_BIST_RDY (0x1 << BMI088_GYRO_BIST_RDY_SHFITS)
|
||||
#define BMI088_GYRO_TRIG_BIST_SHFITS 0x0
|
||||
#define BMI088_GYRO_TRIG_BIST (0x1 << BMI088_GYRO_TRIG_BIST_SHFITS)
|
||||
|
||||
/* -------BMI088 配置和传感器灵敏度换算系数等------- */
|
||||
|
||||
#define BMI088_TEMP_FACTOR 0.125f
|
||||
#define BMI088_TEMP_OFFSET 23.0f
|
||||
|
||||
#define BMI088_WRITE_ACCEL_REG_NUM 6
|
||||
#define BMI088_WRITE_GYRO_REG_NUM 6
|
||||
|
||||
#define BMI088_GYRO_DATA_READY_BIT 0
|
||||
#define BMI088_ACCEL_DATA_READY_BIT 1
|
||||
#define BMI088_ACCEL_TEMP_DATA_READY_BIT 2
|
||||
|
||||
#define BMI088_LONG_DELAY_TIME 80
|
||||
#define BMI088_COM_WAIT_SENSOR_TIME 150
|
||||
|
||||
#define BMI088_ACCEL_IIC_ADDRESSE (0x18 << 1)
|
||||
#define BMI088_GYRO_IIC_ADDRESSE (0x68 << 1)
|
||||
|
||||
#define BMI088_ACCEL_3G_SEN 0.0008974358974f
|
||||
#define BMI088_ACCEL_6G_SEN 0.00179443359375f
|
||||
#define BMI088_ACCEL_12G_SEN 0.0035888671875f
|
||||
#define BMI088_ACCEL_24G_SEN 0.007177734375f
|
||||
|
||||
#define BMI088_GYRO_2000_SEN 0.00106526443603169529841533860381f
|
||||
#define BMI088_GYRO_1000_SEN 0.00053263221801584764920766930190693f
|
||||
#define BMI088_GYRO_500_SEN 0.00026631610900792382460383465095346f
|
||||
#define BMI088_GYRO_250_SEN 0.00013315805450396191230191732547673f
|
||||
#define BMI088_GYRO_125_SEN 0.000066579027251980956150958662738366f
|
||||
|
||||
/* BMI088错误码枚举 */
|
||||
enum
|
||||
{
|
||||
BMI088_NO_ERROR = 0x00,
|
||||
BMI088_ACC_PWR_CTRL_ERROR = 0x01,
|
||||
BMI088_ACC_PWR_CONF_ERROR = 0x02,
|
||||
BMI088_ACC_CONF_ERROR = 0x03,
|
||||
BMI088_ACC_SELF_TEST_ERROR = 0x04,
|
||||
BMI088_ACC_RANGE_ERROR = 0x05,
|
||||
BMI088_INT1_IO_CTRL_ERROR = 0x06,
|
||||
BMI088_INT_MAP_DATA_ERROR = 0x07,
|
||||
BMI088_GYRO_RANGE_ERROR = 0x08,
|
||||
BMI088_GYRO_BANDWIDTH_ERROR = 0x09,
|
||||
BMI088_GYRO_LPM1_ERROR = 0x0A,
|
||||
BMI088_GYRO_CTRL_ERROR = 0x0B,
|
||||
BMI088_GYRO_INT3_INT4_IO_CONF_ERROR = 0x0C,
|
||||
BMI088_GYRO_INT3_INT4_IO_MAP_ERROR = 0x0D,
|
||||
|
||||
BMI088_SELF_TEST_ACCEL_ERROR = 0x80,
|
||||
BMI088_SELF_TEST_GYRO_ERROR = 0x40,
|
||||
BMI088_NO_SENSOR = 0xFF,
|
||||
};
|
||||
|
||||
#endif
|
|
@ -393,7 +393,6 @@ static void BMI088_read_muli_reg(uint8_t reg, uint8_t *buf, uint8_t len)
|
|||
|
||||
while (len != 0)
|
||||
{
|
||||
|
||||
*buf = BMI088_read_write_byte(0x55);
|
||||
buf++;
|
||||
len--;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#define MOTOR_DEF_H
|
||||
|
||||
#include "controller.h"
|
||||
#include <stdint.h>
|
||||
#include "stdint.h"
|
||||
|
||||
#define LIMIT_MIN_MAX(x, min, max) (x) = (((x) <= (min)) ? (min) : (((x) >= (max)) ? (max) : (x)))
|
||||
|
||||
|
|
|
@ -1,12 +1,25 @@
|
|||
#include "motor_task.h"
|
||||
#include "LK9025.h"
|
||||
#include "HT04.h"
|
||||
#include "dji_motor.h"
|
||||
#include "step_motor.h"
|
||||
#include "servo_motor.h"
|
||||
|
||||
|
||||
void MotorControlTask()
|
||||
{
|
||||
// static uint8_t cnt = 0; 设定任务频率
|
||||
// if(cnt%5==0) //200hz
|
||||
// if(cnt%10==0) //100hz
|
||||
|
||||
DJIMotorControl();
|
||||
|
||||
//LKMotorControl();
|
||||
|
||||
//HTMotorControl();
|
||||
|
||||
//ServeoMotorControl();
|
||||
|
||||
//StepMotorControl();
|
||||
}
|
||||
|
||||
|
|
|
@ -11,14 +11,10 @@
|
|||
#ifndef MOTOR_TASK_H
|
||||
#define MOTOR_TASK_H
|
||||
|
||||
#include "LK9025.h"
|
||||
#include "HT04.h"
|
||||
#include "dji_motor.h"
|
||||
|
||||
// 舵机控制任务的频率设定为20Hz或更低
|
||||
// 开关式的舵机控制不应该放在该函数中
|
||||
/**
|
||||
* @brief
|
||||
* @brief 电机控制闭环任务,在RTOS中应该设定为1Khz运行
|
||||
* 舵机控制任务的频率设定为20Hz或更低
|
||||
*
|
||||
*/
|
||||
void MotorControlTask();
|
||||
|
|
Loading…
Reference in New Issue