mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-19 06:15:16 +03:00
Move bst related defs to bst.h plus some cleanup
This commit is contained in:
parent
f814459497
commit
73edcf313c
5 changed files with 81 additions and 27 deletions
28
src/main/target/COLIBRI_RACE/bst.h
Normal file
28
src/main/target/COLIBRI_RACE/bst.h
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
/*
|
||||||
|
* 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
|
||||||
|
|
||||||
|
#define BST_DEVICE_NAME "COLIBRI RACE"
|
||||||
|
#define BST_DEVICE_NAME_LENGTH 12
|
||||||
|
#define BST_DEVICE (BSTDEV_1)
|
||||||
|
/* Configure the CRC peripheral to use the polynomial x8 + x7 + x6 + x4 + x2 + 1 */
|
||||||
|
#define BST_CRC_POLYNOM 0xD5
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
|
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
|
|
||||||
|
#ifdef USE_BST
|
||||||
|
|
||||||
#include "build/build_config.h"
|
#include "build/build_config.h"
|
||||||
|
|
||||||
#include "drivers/nvic.h"
|
#include "drivers/nvic.h"
|
||||||
|
@ -17,10 +19,9 @@
|
||||||
#include "drivers/io_impl.h"
|
#include "drivers/io_impl.h"
|
||||||
#include "drivers/rcc.h"
|
#include "drivers/rcc.h"
|
||||||
|
|
||||||
|
#include "bst.h"
|
||||||
#include "bus_bst.h"
|
#include "bus_bst.h"
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_BST
|
|
||||||
#define NVIC_PRIO_BST_READ_DATA NVIC_BUILD_PRIORITY(1, 1)
|
#define NVIC_PRIO_BST_READ_DATA NVIC_BUILD_PRIORITY(1, 1)
|
||||||
|
|
||||||
#define BST_SHORT_TIMEOUT ((uint32_t)0x1000)
|
#define BST_SHORT_TIMEOUT ((uint32_t)0x1000)
|
||||||
|
|
49
src/main/target/COLIBRI_RACE/config.c
Normal file
49
src/main/target/COLIBRI_RACE/config.c
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
/*
|
||||||
|
* 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#include "platform.h"
|
||||||
|
|
||||||
|
#ifdef USE_BST
|
||||||
|
|
||||||
|
#include "bst.h"
|
||||||
|
#include "bus_bst.h"
|
||||||
|
#include "pg/bus_i2c.h"
|
||||||
|
#include "pg/bus_spi.h"
|
||||||
|
|
||||||
|
// XXX Requires some additional work here.
|
||||||
|
// XXX Can't do this now without proper semantics about I2C on this target.
|
||||||
|
void targetBusInit(void)
|
||||||
|
{
|
||||||
|
#ifdef USE_SPI
|
||||||
|
spiPinConfigure(spiPinConfig(0));
|
||||||
|
#ifdef USE_SPI_DEVICE_1
|
||||||
|
spiInit(SPIDEV_1);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
i2cHardwareConfigure(i2cConfig(0));
|
||||||
|
i2cInit(I2CDEV_2);
|
||||||
|
|
||||||
|
bstInit(BST_DEVICE);
|
||||||
|
}
|
||||||
|
#endif
|
|
@ -52,22 +52,3 @@ const timerHardware_t timerHardware[USABLE_TIMER_CHANNEL_COUNT] = {
|
||||||
DEF_TIM(TIM16, CH1, PA6, TIM_USE_LED, 0), // PWM11 - PB15
|
DEF_TIM(TIM16, CH1, PA6, TIM_USE_LED, 0), // PWM11 - PB15
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// XXX Requires some additional work here.
|
|
||||||
// XXX Can't do this now without proper semantics about I2C on this target.
|
|
||||||
#ifdef USE_BST
|
|
||||||
void targetBusInit(void)
|
|
||||||
{
|
|
||||||
#ifdef USE_SPI
|
|
||||||
spiPinConfigure(spiPinConfig(0));
|
|
||||||
#ifdef USE_SPI_DEVICE_1
|
|
||||||
spiInit(SPIDEV_1);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
i2cHardwareConfigure(i2cConfig(0));
|
|
||||||
i2cInit(I2CDEV_2);
|
|
||||||
|
|
||||||
bstInit(BST_DEVICE);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -25,10 +25,8 @@
|
||||||
#undef USE_RTC_TIME
|
#undef USE_RTC_TIME
|
||||||
|
|
||||||
#define TARGET_BOARD_IDENTIFIER "CLBR"
|
#define TARGET_BOARD_IDENTIFIER "CLBR"
|
||||||
#define BST_DEVICE_NAME "COLIBRI RACE"
|
|
||||||
#define BST_DEVICE_NAME_LENGTH 12
|
|
||||||
#define TARGET_BUS_INIT
|
|
||||||
|
|
||||||
|
#define TARGET_BUS_INIT
|
||||||
|
|
||||||
#define LED0_PIN PC15
|
#define LED0_PIN PC15
|
||||||
#define LED1_PIN PC14
|
#define LED1_PIN PC14
|
||||||
|
@ -106,9 +104,6 @@
|
||||||
#define I2C2_SDA_PIN PA10
|
#define I2C2_SDA_PIN PA10
|
||||||
|
|
||||||
#define USE_BST
|
#define USE_BST
|
||||||
#define BST_DEVICE (BSTDEV_1)
|
|
||||||
/* Configure the CRC peripheral to use the polynomial x8 + x7 + x6 + x4 + x2 + 1 */
|
|
||||||
#define BST_CRC_POLYNOM 0xD5
|
|
||||||
|
|
||||||
#define USE_ADC
|
#define USE_ADC
|
||||||
#define ADC_INSTANCE ADC1
|
#define ADC_INSTANCE ADC1
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue