Made Variant selection easy via platformio.ini
Now it is easy to select between different variant builds via platformio.ini. Currently, 3 variants can be selected: VARIANT_ADC VARIANT_USART3 TRANSPOTTER Note: For any particular needs, you can still change config.h according to your needs.
This commit is contained in:
parent
fdbfe28749
commit
72d2aae4d7
|
@ -43,8 +43,8 @@ matrix:
|
||||||
- export PATH=$HOME/arm-gcc-toolchain/bin:$PATH
|
- export PATH=$HOME/arm-gcc-toolchain/bin:$PATH
|
||||||
before_script: arm-none-eabi-gcc --version
|
before_script: arm-none-eabi-gcc --version
|
||||||
|
|
||||||
- name: pio genericSTM32F103RC
|
- name: platformio
|
||||||
script: platformio run -e genericSTM32F103RC
|
script: platformio run -e VARIANT_ADC -e VARIANT_USART3 -e TRANSPOTTER
|
||||||
language: python
|
language: python
|
||||||
python:
|
python:
|
||||||
- "2.7"
|
- "2.7"
|
||||||
|
|
31
Inc/config.h
31
Inc/config.h
|
@ -2,7 +2,13 @@
|
||||||
#include "stm32f1xx_hal.h"
|
#include "stm32f1xx_hal.h"
|
||||||
|
|
||||||
// ############################### DEFINE FIRMWARE VARIANT ###############################
|
// ############################### DEFINE FIRMWARE VARIANT ###############################
|
||||||
// #define TRANSPOTTER // Uncomment this line for TRANSPORTER configuration
|
// For variant selection, check platformio.ini
|
||||||
|
// For any particular needs, feel free to change this file according to your needs.
|
||||||
|
|
||||||
|
// Select the VARIANT_ADC as default variant, in case NO variant is defined
|
||||||
|
#if !defined(VARIANT_ADC) && !defined(VARIANT_USART3) && !defined(TRANSPOTTER)
|
||||||
|
#define VARIANT_ADC
|
||||||
|
#endif
|
||||||
|
|
||||||
// ############################### DO-NOT-TOUCH SETTINGS ###############################
|
// ############################### DO-NOT-TOUCH SETTINGS ###############################
|
||||||
|
|
||||||
|
@ -100,16 +106,25 @@
|
||||||
|
|
||||||
#define USART2_BAUD 38400 // UART2 baud rate (long wired cable)
|
#define USART2_BAUD 38400 // UART2 baud rate (long wired cable)
|
||||||
#define USART2_WORDLENGTH UART_WORDLENGTH_8B // UART_WORDLENGTH_8B or UART_WORDLENGTH_9B
|
#define USART2_WORDLENGTH UART_WORDLENGTH_8B // UART_WORDLENGTH_8B or UART_WORDLENGTH_9B
|
||||||
// #define CONTROL_SERIAL_USART2 // left sensor board cable, disable if ADC or PPM is used! For Arduino control check the hoverSerial.ino
|
#define USART3_BAUD 38400 // UART3 baud rate (short wired cable)
|
||||||
// #define FEEDBACK_SERIAL_USART2 // left sensor board cable, disable if ADC or PPM is used!
|
#define USART3_WORDLENGTH UART_WORDLENGTH_8B // UART_WORDLENGTH_8B or UART_WORDLENGTH_9B
|
||||||
// #define DEBUG_SERIAL_USART2 // left sensor board cable, disable if ADC or PPM is used!
|
|
||||||
|
#if defined(VARIANT_ADC)
|
||||||
|
// #define CONTROL_SERIAL_USART2 // left sensor board cable, disable if ADC or PPM is used! For Arduino control check the hoverSerial.ino
|
||||||
|
// #define FEEDBACK_SERIAL_USART2 // left sensor board cable, disable if ADC or PPM is used!
|
||||||
|
// #define DEBUG_SERIAL_USART2 // left sensor board cable, disable if ADC or PPM is used!
|
||||||
|
|
||||||
#ifndef TRANSPOTTER
|
|
||||||
#define USART3_BAUD 38400 // UART3 baud rate (short wired cable)
|
|
||||||
#define USART3_WORDLENGTH UART_WORDLENGTH_8B // UART_WORDLENGTH_8B or UART_WORDLENGTH_9B
|
|
||||||
// #define CONTROL_SERIAL_USART3 // right sensor board cable, disable if I2C (nunchuck or lcd) is used! For Arduino control check the hoverSerial.ino
|
// #define CONTROL_SERIAL_USART3 // right sensor board cable, disable if I2C (nunchuck or lcd) is used! For Arduino control check the hoverSerial.ino
|
||||||
// #define FEEDBACK_SERIAL_USART3 // right sensor board cable, disable if I2C (nunchuck or lcd) is used!
|
// #define FEEDBACK_SERIAL_USART3 // right sensor board cable, disable if I2C (nunchuck or lcd) is used!
|
||||||
#define DEBUG_SERIAL_USART3 // right sensor board cable, disable if I2C (nunchuck or lcd) is used!
|
#define DEBUG_SERIAL_USART3 // right sensor board cable, disable if I2C (nunchuck or lcd) is used!
|
||||||
|
#elif defined(VARIANT_USART3)
|
||||||
|
// #define CONTROL_SERIAL_USART2 // left sensor board cable, disable if ADC or PPM is used! For Arduino control check the hoverSerial.ino
|
||||||
|
// #define FEEDBACK_SERIAL_USART2 // left sensor board cable, disable if ADC or PPM is used!
|
||||||
|
// #define DEBUG_SERIAL_USART2 // left sensor board cable, disable if ADC or PPM is used!
|
||||||
|
|
||||||
|
#define CONTROL_SERIAL_USART3 // right sensor board cable, disable if I2C (nunchuck or lcd) is used! For Arduino control check the hoverSerial.ino
|
||||||
|
#define FEEDBACK_SERIAL_USART3 // right sensor board cable, disable if I2C (nunchuck or lcd) is used!
|
||||||
|
// #define DEBUG_SERIAL_USART3 // right sensor board cable, disable if I2C (nunchuck or lcd) is used!
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(FEEDBACK_SERIAL_USART2) || defined(DEBUG_SERIAL_USART2)
|
#if defined(FEEDBACK_SERIAL_USART2) || defined(DEBUG_SERIAL_USART2)
|
||||||
|
@ -133,7 +148,7 @@
|
||||||
* For middle resting potis: Let the potis in the middle resting position, write value 1 to ADC1_MID and value 2 to ADC2_MID
|
* For middle resting potis: Let the potis in the middle resting position, write value 1 to ADC1_MID and value 2 to ADC2_MID
|
||||||
* Make, flash and test it.
|
* Make, flash and test it.
|
||||||
*/
|
*/
|
||||||
#ifndef TRANSPOTTER
|
#ifdef VARIANT_ADC
|
||||||
#define CONTROL_ADC // use ADC as input. disable CONTROL_SERIAL_USART2, FEEDBACK_SERIAL_USART2, DEBUG_SERIAL_USART2!
|
#define CONTROL_ADC // use ADC as input. disable CONTROL_SERIAL_USART2, FEEDBACK_SERIAL_USART2, DEBUG_SERIAL_USART2!
|
||||||
// #define ADC1_MID_POT // ADC1 middle resting poti: comment-out if NOT a middle resting poti
|
// #define ADC1_MID_POT // ADC1 middle resting poti: comment-out if NOT a middle resting poti
|
||||||
#define ADC1_MIN 0 // min ADC1-value while poti at minimum-position (0 - 4095)
|
#define ADC1_MIN 0 // min ADC1-value while poti at minimum-position (0 - 4095)
|
||||||
|
|
|
@ -5,7 +5,13 @@
|
||||||
include_dir = Inc
|
include_dir = Inc
|
||||||
src_dir = Src
|
src_dir = Src
|
||||||
|
|
||||||
[env:genericSTM32F103RC]
|
;=================== VARIANT SELECTION ==========================
|
||||||
|
default_envs = VARIANT_ADC ; Variant for control via ADC input
|
||||||
|
;default_envs = VARIANT_USART3 ; Variant for Serial control via USART3 input
|
||||||
|
;default_envs = TRANSPOTTER ; Variant for TRANSPOTTER build https://github.com/Jan--Henrik/transpOtterNG
|
||||||
|
;================================================================
|
||||||
|
|
||||||
|
[env:VARIANT_ADC]
|
||||||
platform = ststm32
|
platform = ststm32
|
||||||
framework = stm32cube
|
framework = stm32cube
|
||||||
board = genericSTM32F103RC
|
board = genericSTM32F103RC
|
||||||
|
@ -25,3 +31,43 @@ build_flags =
|
||||||
-Wl,-lm
|
-Wl,-lm
|
||||||
-g -ggdb ; to generate correctly the 'firmware.elf' for STM STUDIO vizualization
|
-g -ggdb ; to generate correctly the 'firmware.elf' for STM STUDIO vizualization
|
||||||
# -Wl,-lnosys
|
# -Wl,-lnosys
|
||||||
|
|
||||||
|
[env:VARIANT_USART3]
|
||||||
|
platform = ststm32
|
||||||
|
framework = stm32cube
|
||||||
|
board = genericSTM32F103RC
|
||||||
|
debug_tool = stlink
|
||||||
|
upload_protocol = stlink
|
||||||
|
|
||||||
|
; Serial Port settings (make sure the COM port is correct)
|
||||||
|
monitor_port = COM5
|
||||||
|
monitor_speed = 38400
|
||||||
|
|
||||||
|
build_flags =
|
||||||
|
-I${PROJECT_DIR}/inc/
|
||||||
|
-DUSE_HAL_DRIVER
|
||||||
|
-DSTM32F103xE
|
||||||
|
-Wl,-T./STM32F103RCTx_FLASH.ld
|
||||||
|
-Wl,-lc
|
||||||
|
-Wl,-lm
|
||||||
|
-g -ggdb ; to generate correctly the 'firmware.elf' for STM STUDIO vizualization
|
||||||
|
# -Wl,-lnosys
|
||||||
|
-D VARIANT_USART3
|
||||||
|
|
||||||
|
[env:TRANSPOTTER]
|
||||||
|
platform = ststm32
|
||||||
|
framework = stm32cube
|
||||||
|
board = genericSTM32F103RC
|
||||||
|
debug_tool = stlink
|
||||||
|
upload_protocol = stlink
|
||||||
|
|
||||||
|
build_flags =
|
||||||
|
-I${PROJECT_DIR}/inc/
|
||||||
|
-DUSE_HAL_DRIVER
|
||||||
|
-DSTM32F103xE
|
||||||
|
-Wl,-T./STM32F103RCTx_FLASH.ld
|
||||||
|
-Wl,-lc
|
||||||
|
-Wl,-lm
|
||||||
|
-g -ggdb ; to generate correctly the 'firmware.elf' for STM STUDIO vizualization
|
||||||
|
# -Wl,-lnosys
|
||||||
|
-D TRANSPOTTER
|
Loading…
Reference in New Issue