From 5c20fdf1c52281fc330dccb959fc4f90a009c5e1 Mon Sep 17 00:00:00 2001 From: nathan Date: Fri, 31 Jul 2015 20:04:04 -0700 Subject: [PATCH] SPRACINGF3 support for serial1wire passthrough --- docs/1wire.md | 2 +- src/main/io/serial_1wire.c | 17 +++++++++++------ src/main/target/SPRACINGF3/target.h | 7 +++++++ 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/docs/1wire.md b/docs/1wire.md index 1778a65b51..e3190f2ddc 100644 --- a/docs/1wire.md +++ b/docs/1wire.md @@ -8,7 +8,7 @@ This is the option you need to select for the bootloader: ![Flashing BlHeli Bootloader](assets/images/blheli-bootloader.png) -Currently supported on the STM32F3DISCOVERY, NAZE32 (including clones such as the FLIP32) and CC3D. +Currently supported on the SPRACINGF3, STM32F3DISCOVERY, NAZE32 (including clones such as the FLIP32) and CC3D. ## Wiring diff --git a/src/main/io/serial_1wire.c b/src/main/io/serial_1wire.c index 407033e846..10e8547e58 100644 --- a/src/main/io/serial_1wire.c +++ b/src/main/io/serial_1wire.c @@ -30,36 +30,41 @@ #include "drivers/system.h" #include "io/serial_1wire.h" +const escHardware_t escHardware[ESC_COUNT] = { // Figure out esc clocks and pins, extrapolated from timer.c // Periphs could be pulled progmatically... but I'll leave that for another exercise #if defined(STM32F3DISCOVERY) && !(defined(CHEBUZZF3)) -const escHardware_t escHardware[ESC_COUNT] = { { GPIOD, 12 }, { GPIOD, 13 }, { GPIOD, 14 }, { GPIOD, 15 }, { GPIOA, 1 }, { GPIOA, 2 } -}; #elif defined(CJMCU) || defined(EUSTM32F103RC) || defined(NAZE) || defined(OLIMEXINO) || defined(PORT103R) -const escHardware_t escHardware[ESC_COUNT] = { { GPIOA, 8 }, { GPIOA, 11 }, { GPIOB, 6 }, { GPIOB, 7 }, { GPIOB, 8 }, { GPIOB, 9 } -}; #elif CC3D -const escHardware_t escHardware[ESC_COUNT] = { { GPIOB, 9 }, { GPIOB, 8 }, { GPIOB, 7 }, { GPIOA, 8 }, { GPIOB, 4 }, { GPIOA, 2 } -}; +#elif SPRACINGF3 + { GPIOA, 6 }, + { GPIOA, 7 }, + { GPIOA, 11 }, + { GPIOA, 12 }, + { GPIOB, 8 }, + { GPIOB, 9 }, + { GPIOA, 2 }, + { GPIOA, 3 } #endif +}; static void gpio_set_mode(GPIO_TypeDef* gpio, uint16_t pin, GPIO_Mode mode) { gpio_config_t cfg; diff --git a/src/main/target/SPRACINGF3/target.h b/src/main/target/SPRACINGF3/target.h index 9393168847..f39779a0b3 100644 --- a/src/main/target/SPRACINGF3/target.h +++ b/src/main/target/SPRACINGF3/target.h @@ -169,3 +169,10 @@ // USART3, #define BIND_PORT GPIOB #define BIND_PIN Pin_11 + +#define USE_SERIAL_1WIRE +#define ESC_COUNT 8 +#define S1W_TX_GPIO GPIOA +#define S1W_TX_PIN GPIO_Pin_9 +#define S1W_RX_GPIO GPIOA +#define S1W_RX_PIN GPIO_Pin_10