Moved USB detection to IO
Fixed CHEBUZZF3, SPRACINGF3 (EVO, MINI) and F3Discovery targets
This commit is contained in:
parent
9c1c4fef33
commit
78da0fad65
|
@ -115,15 +115,15 @@ int32_t accelSummedSamples500Hz[3];
|
|||
|
||||
void lsm303dlhcAccInit(void)
|
||||
{
|
||||
i2cWrite(LSM303DLHC_ACCEL_ADDRESS, CTRL_REG5_A, BOOT);
|
||||
i2cWrite(MPU_I2C_INSTANCE, LSM303DLHC_ACCEL_ADDRESS, CTRL_REG5_A, BOOT);
|
||||
|
||||
delay(100);
|
||||
|
||||
i2cWrite(LSM303DLHC_ACCEL_ADDRESS, CTRL_REG1_A, ODR_1344_HZ | AXES_ENABLE);
|
||||
i2cWrite(MPU_I2C_INSTANCE, LSM303DLHC_ACCEL_ADDRESS, CTRL_REG1_A, ODR_1344_HZ | AXES_ENABLE);
|
||||
|
||||
delay(10);
|
||||
|
||||
i2cWrite(LSM303DLHC_ACCEL_ADDRESS, CTRL_REG4_A, FULLSCALE_4G);
|
||||
i2cWrite(MPU_I2C_INSTANCE, LSM303DLHC_ACCEL_ADDRESS, CTRL_REG4_A, FULLSCALE_4G);
|
||||
|
||||
delay(100);
|
||||
|
||||
|
@ -135,7 +135,7 @@ static bool lsm303dlhcAccRead(int16_t *gyroADC)
|
|||
{
|
||||
uint8_t buf[6];
|
||||
|
||||
bool ack = i2cRead(LSM303DLHC_ACCEL_ADDRESS, AUTO_INCREMENT_ENABLE | OUT_X_L_A, 6, buf);
|
||||
bool ack = i2cRead(MPU_I2C_INSTANCE, LSM303DLHC_ACCEL_ADDRESS, AUTO_INCREMENT_ENABLE | OUT_X_L_A, 6, buf);
|
||||
|
||||
if (!ack) {
|
||||
return false;
|
||||
|
@ -160,7 +160,7 @@ bool lsm303dlhcAccDetect(acc_t *acc)
|
|||
bool ack;
|
||||
uint8_t status;
|
||||
|
||||
ack = i2cRead(LSM303DLHC_ACCEL_ADDRESS, LSM303DLHC_STATUS_REG_A, 1, &status);
|
||||
ack = i2cRead(MPU_I2C_INSTANCE, LSM303DLHC_ACCEL_ADDRESS, LSM303DLHC_STATUS_REG_A, 1, &status);
|
||||
if (!ack)
|
||||
return false;
|
||||
|
||||
|
|
|
@ -105,11 +105,6 @@ static inline void mma8451ConfigureInterrupt(void)
|
|||
// PA5 - ACC_INT2 output on NAZE rev3/4 hardware
|
||||
// NAZE rev.5 hardware has PA5 (ADC1_IN5) on breakout pad on bottom of board
|
||||
// OLIMEXINO - The PA5 pin is wired up to LED1, if you need to use an mma8452 on an Olimexino use a different pin and provide support in code.
|
||||
|
||||
gpio_config_t gpio;
|
||||
|
||||
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
|
||||
|
||||
IOInit(IOGetByTag(IO_TAG(PA5)), OWNER_SYSTEM, RESOURCE_I2C);
|
||||
IOConfigGPIO(IOGetByTag(IO_TAG(PA5)), IOCFG_IN_FLOATING); // TODO - maybe pullup / pulldown ?
|
||||
#endif
|
||||
|
|
|
@ -47,8 +47,8 @@
|
|||
#define JEDEC_ID_MICRON_N25Q128 0x20ba18
|
||||
#define JEDEC_ID_WINBOND_W25Q128 0xEF4018
|
||||
|
||||
#define DISABLE_M25P16 GPIO_SetBits(M25P16_CS_GPIO, M25P16_CS_PIN)
|
||||
#define ENABLE_M25P16 GPIO_ResetBits(M25P16_CS_GPIO, M25P16_CS_PIN)
|
||||
#define DISABLE_M25P16 IOHi(m25p16CsPin)
|
||||
#define ENABLE_M25P16 IOLo(m25p16CsPin)
|
||||
|
||||
// The timeout we expect between being able to issue page program instructions
|
||||
#define DEFAULT_TIMEOUT_MILLIS 6
|
||||
|
@ -59,6 +59,8 @@
|
|||
|
||||
static flashGeometry_t geometry = {.pageSize = M25P16_PAGESIZE};
|
||||
|
||||
static IO_t m25p16CsPin = IO_NONE;
|
||||
|
||||
/*
|
||||
* Whether we've performed an action that could have made the device busy for writes.
|
||||
*
|
||||
|
@ -195,6 +197,13 @@ static bool m25p16_readIdentification()
|
|||
*/
|
||||
bool m25p16_init()
|
||||
{
|
||||
|
||||
#ifdef M25P16_CS_PIN
|
||||
m25p16CsPin = IOGetByTag(IO_TAG(M25P16_CS_PIN));
|
||||
#endif
|
||||
IOInit(m25p16CsPin, OWNER_FLASH, RESOURCE_SPI);
|
||||
IOConfigGPIO(m25p16CsPin, SPI_IO_CS_CFG);
|
||||
|
||||
//Maximum speed for standard READ command is 20mHz, other commands tolerate 25mHz
|
||||
spiSetDivisor(M25P16_SPI_INSTANCE, SPI_18MHZ_CLOCK_DIVIDER);
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
*
|
||||
* Currently the timings are 0 = 350ns high/800ns and 1 = 700ns high/650ns low.
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
@ -36,6 +37,8 @@
|
|||
#include "drivers/dma.h"
|
||||
#include "drivers/light_ws2811strip.h"
|
||||
|
||||
#ifdef LED_STRIP
|
||||
|
||||
uint8_t ledStripDMABuffer[WS2811_DMA_BUFFER_SIZE];
|
||||
volatile uint8_t ws2811LedDataTransferInProgress = 0;
|
||||
|
||||
|
@ -170,3 +173,4 @@ void ws2811UpdateStrip(void)
|
|||
ws2811LedStripDMAEnable();
|
||||
}
|
||||
|
||||
#endif
|
|
@ -21,21 +21,23 @@ typedef enum {
|
|||
OWNER_TIMER,
|
||||
OWNER_SONAR,
|
||||
OWNER_SYSTEM,
|
||||
OWNER_SDCARD
|
||||
OWNER_SDCARD,
|
||||
OWNER_FLASH,
|
||||
OWNER_USB
|
||||
} resourceOwner_t;
|
||||
|
||||
|
||||
// Currently TIMER should be shared resource (softserial dualtimer and timerqueue needs to allocate timer channel, but pin can be used for other function)
|
||||
// with mode switching (shared serial ports, ...) this will need some improvement
|
||||
typedef enum {
|
||||
RESOURCE_INPUT = 1 << 0,
|
||||
RESOURCE_OUTPUT = 1<< 1,
|
||||
RESOURCE_NONE = 0,
|
||||
RESOURCE_INPUT = 1 << 0,
|
||||
RESOURCE_OUTPUT = 1 << 1,
|
||||
RESOURCE_IO = RESOURCE_INPUT | RESOURCE_OUTPUT,
|
||||
RESOURCE_TIMER = 1 << 2,
|
||||
RESOURCE_TIMER = 1 << 2,
|
||||
RESOURCE_TIMER_DUAL = 1 << 3, // channel used in dual-capture, other channel will be allocated too
|
||||
RESOURCE_USART = 1 << 4,
|
||||
RESOURCE_ADC = 1 << 5,
|
||||
RESOURCE_EXTI = 1 << 6,
|
||||
RESOURCE_USART = 1 << 4,
|
||||
RESOURCE_ADC = 1 << 5,
|
||||
RESOURCE_EXTI = 1 << 6,
|
||||
RESOURCE_I2C = 1 << 7,
|
||||
RESOURCE_SPI = 1 << 8,
|
||||
} resourceType_t;
|
||||
|
|
|
@ -15,39 +15,32 @@
|
|||
* along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "sdcard.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "platform.h"
|
||||
#include "io.h"
|
||||
#include "system.h"
|
||||
|
||||
#include "gpio.h"
|
||||
|
||||
#include "drivers/system.h"
|
||||
static IO_t usbDetectPin = IO_NONE;
|
||||
|
||||
void usbCableDetectDeinit(void)
|
||||
{
|
||||
#ifdef USB_DETECT_PIN
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
|
||||
GPIO_InitStructure.GPIO_Pin = USB_DETECT_PIN;
|
||||
GPIO_Init(USB_DETECT_GPIO_PORT, &GPIO_InitStructure);
|
||||
IOInit(usbDetectPin, OWNER_FREE, RESOURCE_NONE);
|
||||
IOConfigGPIO(usbDetectPin, IOCFG_IN_FLOATING);
|
||||
usbDetectPin = IO_NONE;
|
||||
#endif
|
||||
}
|
||||
|
||||
void usbCableDetectInit(void)
|
||||
{
|
||||
#ifdef USB_DETECT_PIN
|
||||
RCC_AHBPeriphClockCmd(USB_DETECT_GPIO_CLK, ENABLE);
|
||||
usbDetectPin = IOGetByTag(IO_TAG(USB_DETECT_PIN));
|
||||
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
|
||||
GPIO_InitStructure.GPIO_Pin = USB_DETECT_PIN;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
|
||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
|
||||
GPIO_Init(USB_DETECT_GPIO_PORT, &GPIO_InitStructure);
|
||||
IOInit(usbDetectPin, OWNER_USB, RESOURCE_INPUT);
|
||||
IOConfigGPIO(usbDetectPin, IOCFG_OUT_PP);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -56,7 +49,7 @@ bool usbCableIsInserted(void)
|
|||
bool result = false;
|
||||
|
||||
#ifdef USB_DETECT_PIN
|
||||
result = (GPIO_ReadInputData(USB_DETECT_GPIO_PORT) & USB_DETECT_PIN) != 0;
|
||||
result = IORead(usbDetectPin) != 0;
|
||||
#endif
|
||||
|
||||
return result;
|
||||
|
|
|
@ -23,35 +23,30 @@
|
|||
|
||||
#include "platform.h"
|
||||
|
||||
#include "gpio.h"
|
||||
|
||||
#include "drivers/system.h"
|
||||
|
||||
#include "drivers/usb_io.h"
|
||||
#include "io.h"
|
||||
#include "system.h"
|
||||
#include "usb_io.h"
|
||||
|
||||
#ifdef USB_IO
|
||||
|
||||
static IO_t usbDetectPin = IO_NONE;
|
||||
|
||||
void usbCableDetectDeinit(void)
|
||||
{
|
||||
#ifdef USB_CABLE_DETECTION
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
|
||||
GPIO_InitStructure.GPIO_Pin = USB_DETECT_PIN;
|
||||
GPIO_Init(USB_DETECT_GPIO_PORT, &GPIO_InitStructure);
|
||||
#ifdef USB_DETECT_PIN
|
||||
IOInit(usbDetectPin, OWNER_FREE, RESOURCE_NONE);
|
||||
IOConfigGPIO(usbDetectPin, IOCFG_IN_FLOATING);
|
||||
usbDetectPin = IO_NONE;
|
||||
#endif
|
||||
}
|
||||
|
||||
void usbCableDetectInit(void)
|
||||
{
|
||||
#ifdef USB_CABLE_DETECTION
|
||||
RCC_AHBPeriphClockCmd(USB_DETECT_GPIO_CLK, ENABLE);
|
||||
#ifdef USB_DETECT_PIN
|
||||
usbDetectPin = IOGetByTag(IO_TAG(USB_DETECT_PIN));
|
||||
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
|
||||
GPIO_InitStructure.GPIO_Pin = USB_DETECT_PIN;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
|
||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
|
||||
GPIO_Init(USB_DETECT_GPIO_PORT, &GPIO_InitStructure);
|
||||
IOInit(usbDetectPin, OWNER_USB, RESOURCE_INPUT);
|
||||
IOConfigGPIO(usbDetectPin, IOCFG_OUT_PP);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -59,8 +54,8 @@ bool usbCableIsInserted(void)
|
|||
{
|
||||
bool result = false;
|
||||
|
||||
#ifdef USB_CABLE_DETECTION
|
||||
result = (GPIO_ReadInputData(USB_DETECT_GPIO_PORT) & USB_DETECT_PIN) != 0;
|
||||
#ifdef USB_DETECT_PIN
|
||||
result = IORead(usbDetectPin) != 0;
|
||||
#endif
|
||||
|
||||
return result;
|
||||
|
@ -68,32 +63,15 @@ bool usbCableIsInserted(void)
|
|||
|
||||
void usbGenerateDisconnectPulse(void)
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
|
||||
/* Pull down PA12 to create USB disconnect pulse */
|
||||
#if defined(STM32F303xC)
|
||||
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE);
|
||||
IO_t usbPin = IOGetByTag(IO_TAG(PA12));
|
||||
IOConfigGPIO(usbPin, IOCFG_OUT_OD);
|
||||
|
||||
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
|
||||
GPIO_InitStructure.GPIO_OType = GPIO_OType_OD;
|
||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
|
||||
#else
|
||||
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
|
||||
|
||||
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_OD;
|
||||
#endif
|
||||
|
||||
GPIO_Init(GPIOA, &GPIO_InitStructure);
|
||||
|
||||
GPIO_ResetBits(GPIOA, GPIO_Pin_12);
|
||||
IOHi(usbPin);
|
||||
|
||||
delay(200);
|
||||
|
||||
GPIO_SetBits(GPIOA, GPIO_Pin_12);
|
||||
IOLo(usbPin);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -41,16 +41,8 @@
|
|||
#define USE_SDCARD
|
||||
#define USE_SDCARD_SPI2
|
||||
|
||||
#define SDCARD_DETECT_PIN GPIO_Pin_14
|
||||
#define SDCARD_DETECT_EXTI_LINE EXTI_Line14
|
||||
#define SDCARD_DETECT_EXTI_PIN_SOURCE EXTI_PinSource14
|
||||
#define SDCARD_DETECT_GPIO_PORT GPIOC
|
||||
#define SDCARD_DETECT_GPIO_CLK RCC_AHBPeriph_GPIOC
|
||||
#define SDCARD_DETECT_EXTI_PORT_SOURCE EXTI_PortSourceGPIOC
|
||||
#define SDCARD_DETECT_EXTI_IRQn EXTI15_10_IRQn
|
||||
|
||||
#define SDCARD_DETECT_PIN PC14
|
||||
#define SDCARD_SPI_INSTANCE SPI2
|
||||
#define SDCARD_SPI_CS_GPIO SPI2_GPIO
|
||||
#define SDCARD_SPI_CS_PIN SPI2_NSS_PIN
|
||||
|
||||
// SPI2 is on the APB1 bus whose clock runs at 36MHz. Divide to under 400kHz for init:
|
||||
|
@ -126,27 +118,9 @@
|
|||
#define EXTERNAL1_ADC_CHANNEL ADC_Channel_9
|
||||
|
||||
#define GPS
|
||||
#define LED_STRIP
|
||||
#if 1
|
||||
#define LED_STRIP_TIMER TIM16
|
||||
#else
|
||||
// alternative LED strip configuration, tested working.
|
||||
#define LED_STRIP_TIMER TIM1
|
||||
|
||||
#define USE_LED_STRIP_ON_DMA1_CHANNEL2
|
||||
#define WS2811_GPIO GPIOA
|
||||
#define WS2811_GPIO_AHB_PERIPHERAL RCC_AHBPeriph_GPIOA
|
||||
#define WS2811_GPIO_AF GPIO_AF_6
|
||||
#define WS2811_PIN GPIO_Pin_8
|
||||
#define WS2811_PIN_SOURCE GPIO_PinSource8
|
||||
#define WS2811_TIMER TIM1
|
||||
#define WS2811_TIMER_APB2_PERIPHERAL RCC_APB2Periph_TIM1
|
||||
#define WS2811_DMA_CHANNEL DMA1_Channel2
|
||||
#define WS2811_IRQ DMA1_Channel2_IRQn
|
||||
#endif
|
||||
|
||||
#define BLACKBOX
|
||||
#define GTUNE
|
||||
//#define GTUNE
|
||||
#define TELEMETRY
|
||||
#define SERIAL_RX
|
||||
#define USE_SERVOS
|
||||
|
|
|
@ -52,8 +52,8 @@ void detectHardwareRevision(void)
|
|||
|
||||
#ifdef USE_SPI
|
||||
|
||||
#define DISABLE_SPI_CS GPIO_SetBits(NAZE_SPI_CS_GPIO, NAZE_SPI_CS_PIN)
|
||||
#define ENABLE_SPI_CS GPIO_ResetBits(NAZE_SPI_CS_GPIO, NAZE_SPI_CS_PIN)
|
||||
#define DISABLE_SPI_CS IOLo(nazeSpiCsPin)
|
||||
#define ENABLE_SPI_CS IOHi(nazeSpiCsPin)
|
||||
|
||||
#define SPI_DEVICE_NONE (0)
|
||||
#define SPI_DEVICE_FLASH (1)
|
||||
|
@ -62,8 +62,14 @@ void detectHardwareRevision(void)
|
|||
#define M25P16_INSTRUCTION_RDID 0x9F
|
||||
#define FLASH_M25P16_ID (0x202015)
|
||||
|
||||
static IO_t nazeSpiCsPin = IO_NONE;
|
||||
|
||||
uint8_t detectSpiDevice(void)
|
||||
{
|
||||
#ifdef NAZE_SPI_CS_PIN
|
||||
nazeSpiCsPin = IOGetByTag(IO_TAG(NAZE_SPI_CS_PIN));
|
||||
#endif
|
||||
|
||||
uint8_t out[] = { M25P16_INSTRUCTION_RDID, 0, 0, 0 };
|
||||
uint8_t in[4];
|
||||
uint32_t flash_id;
|
||||
|
|
|
@ -116,15 +116,7 @@
|
|||
#define SDCARD_DETECT_INVERTED
|
||||
|
||||
#define SDCARD_DETECT_PIN PC14
|
||||
#define SDCARD_DETECT_EXTI_LINE EXTI_Line14
|
||||
#define SDCARD_DETECT_EXTI_PIN_SOURCE EXTI_PinSource14
|
||||
#define SDCARD_DETECT_GPIO_PORT GPIOC
|
||||
#define SDCARD_DETECT_GPIO_CLK RCC_AHBPeriph_GPIOC
|
||||
#define SDCARD_DETECT_EXTI_PORT_SOURCE EXTI_PortSourceGPIOC
|
||||
#define SDCARD_DETECT_EXTI_IRQn EXTI15_10_IRQn
|
||||
|
||||
#define SDCARD_SPI_INSTANCE SPI2
|
||||
#define SDCARD_SPI_CS_GPIO SPI2_GPIO
|
||||
#define SDCARD_SPI_CS_PIN SPI2_NSS_PIN
|
||||
|
||||
// SPI2 is on the APB1 bus whose clock runs at 36MHz. Divide to under 400kHz for init:
|
||||
|
|
|
@ -66,9 +66,7 @@
|
|||
#define USB_IO
|
||||
#define USB_CABLE_DETECTION
|
||||
|
||||
#define USB_DETECT_PIN GPIO_Pin_5
|
||||
#define USB_DETECT_GPIO_PORT GPIOB
|
||||
#define USB_DETECT_GPIO_CLK RCC_AHBPeriph_GPIOC
|
||||
#define USB_DETECT_PIN PB5
|
||||
|
||||
#define USE_VCP
|
||||
#define USE_USART1
|
||||
|
@ -112,32 +110,18 @@
|
|||
#define USE_SPI
|
||||
#define USE_SPI_DEVICE_2 // PB12,13,14,15 on AF5
|
||||
|
||||
#define SPI2_GPIO GPIOB
|
||||
#define SPI2_GPIO_PERIPHERAL RCC_AHBPeriph_GPIOB
|
||||
#define SPI2_NSS_PIN Pin_12
|
||||
#define SPI2_NSS_PIN_SOURCE GPIO_PinSource12
|
||||
#define SPI2_SCK_PIN Pin_13
|
||||
#define SPI2_SCK_PIN_SOURCE GPIO_PinSource13
|
||||
#define SPI2_MISO_PIN Pin_14
|
||||
#define SPI2_MISO_PIN_SOURCE GPIO_PinSource14
|
||||
#define SPI2_MOSI_PIN Pin_15
|
||||
#define SPI2_MOSI_PIN_SOURCE GPIO_PinSource15
|
||||
#define SPI2_NSS_PIN PB12
|
||||
#define SPI2_SCK_PIN PB13
|
||||
#define SPI2_MISO_PIN PB14
|
||||
#define SPI2_MOSI_PIN PB15
|
||||
|
||||
#define USE_SDCARD
|
||||
#define USE_SDCARD_SPI2
|
||||
|
||||
#define SDCARD_DETECT_INVERTED
|
||||
|
||||
#define SDCARD_DETECT_PIN GPIO_Pin_14
|
||||
#define SDCARD_DETECT_EXTI_LINE EXTI_Line14
|
||||
#define SDCARD_DETECT_EXTI_PIN_SOURCE EXTI_PinSource14
|
||||
#define SDCARD_DETECT_GPIO_PORT GPIOC
|
||||
#define SDCARD_DETECT_GPIO_CLK RCC_AHBPeriph_GPIOC
|
||||
#define SDCARD_DETECT_EXTI_PORT_SOURCE EXTI_PortSourceGPIOC
|
||||
#define SDCARD_DETECT_EXTI_IRQn EXTI15_10_IRQn
|
||||
|
||||
#define SDCARD_DETECT_PIN PC14
|
||||
#define SDCARD_SPI_INSTANCE SPI2
|
||||
#define SDCARD_SPI_CS_GPIO SPI2_GPIO
|
||||
#define SDCARD_SPI_CS_PIN SPI2_NSS_PIN
|
||||
|
||||
// SPI2 is on the APB1 bus whose clock runs at 36MHz. Divide to under 400kHz for init:
|
||||
|
@ -231,4 +215,4 @@
|
|||
#define TARGET_IO_PORTA 0xffff
|
||||
#define TARGET_IO_PORTB 0xffff
|
||||
#define TARGET_IO_PORTC (BIT(13)|BIT(14)|BIT(15))
|
||||
#define TARGET_IO_PORTF (BIT(0)|BIT(1))
|
||||
#define TARGET_IO_PORTF (BIT(0)|BIT(1)|BIT(4))
|
||||
|
|
|
@ -44,16 +44,8 @@
|
|||
|
||||
#define USE_SD_CARD
|
||||
|
||||
#define SD_DETECT_PIN GPIO_Pin_14
|
||||
#define SD_DETECT_EXTI_LINE EXTI_Line14
|
||||
#define SD_DETECT_EXTI_PIN_SOURCE EXTI_PinSource14
|
||||
#define SD_DETECT_GPIO_PORT GPIOC
|
||||
#define SD_DETECT_GPIO_CLK RCC_AHBPeriph_GPIOC
|
||||
#define SD_DETECT_EXTI_PORT_SOURCE EXTI_PortSourceGPIOC
|
||||
#define SD_DETECT_EXTI_IRQn EXTI15_10_IRQn
|
||||
|
||||
#define SD_CS_GPIO GPIOB
|
||||
#define SD_CS_PIN GPIO_Pin_12
|
||||
#define SD_DETECT_PIN PC14
|
||||
#define SD_CS_PIN PB12
|
||||
#define SD_SPI_INSTANCE SPI2
|
||||
|
||||
//#define USE_FLASHFS
|
||||
|
@ -78,9 +70,7 @@
|
|||
#define USE_GYRO_L3GD20
|
||||
|
||||
#define L3GD20_SPI SPI1
|
||||
#define L3GD20_CS_GPIO_CLK_PERIPHERAL RCC_AHBPeriph_GPIOE
|
||||
#define L3GD20_CS_GPIO GPIOE
|
||||
#define L3GD20_CS_PIN GPIO_Pin_3
|
||||
#define L3GD20_CS_PIN PE3
|
||||
|
||||
#define GYRO_L3GD20_ALIGN CW270_DEG
|
||||
|
||||
|
@ -88,9 +78,7 @@
|
|||
#define USE_SDCARD_SPI2
|
||||
|
||||
#define SDCARD_SPI_INSTANCE SPI2
|
||||
#define SDCARD_SPI_CS_GPIO GPIOB
|
||||
#define SDCARD_SPI_CS_PIN GPIO_Pin_12
|
||||
#define SDCARD_SPI_CS_GPIO_CLK_PERIPHERAL RCC_APB2Periph_GPIOB
|
||||
#define SDCARD_SPI_CS_PIN PB12
|
||||
// SPI2 is on the APB1 bus whose clock runs at 36MHz. Divide to under 400kHz for init:
|
||||
#define SDCARD_SPI_INITIALIZATION_CLOCK_DIVIDER 128
|
||||
// Divide to under 25MHz for normal operation:
|
||||
|
|
Loading…
Reference in New Issue