Minor updates

- fixed all warnings for VARIANT_NUNCHUCK and VARIANT_PPM
- changed the variant order: the basic Variants on top, more application specific in the bottom
This commit is contained in:
EmanuelFeru 2020-01-07 18:09:19 +01:00
parent 574e947cc2
commit a3b6e40fa2
5 changed files with 65 additions and 46 deletions

View File

@ -8,10 +8,10 @@
#if !defined(PLATFORMIO) #if !defined(PLATFORMIO)
//#define VARIANT_ADC // Variant for control via ADC input //#define VARIANT_ADC // Variant for control via ADC input
//#define VARIANT_USART3 // Variant for Serial control via USART3 input //#define VARIANT_USART3 // Variant for Serial control via USART3 input
//#define VARIANT_HOVERCAR // Variant for HOVERCAR build
//#define VARIANT_TRANSPOTTER // Variant for TRANSPOTTER build https://github.com/NiklasFauth/hoverboard-firmware-hack/wiki/Build-Instruction:-TranspOtter https://hackaday.io/project/161891-transpotter-ng
//#define VARIANT_NUNCHUCK // Variant for Nunchuck controlled vehicle build //#define VARIANT_NUNCHUCK // Variant for Nunchuck controlled vehicle build
//#define VARIANT_PPM // Variant for RC-Remote with PPM-Sum Signal //#define VARIANT_PPM // Variant for RC-Remote with PPM-Sum Signal
//#define VARIANT_HOVERCAR // Variant for HOVERCAR build
//#define VARIANT_TRANSPOTTER // Variant for TRANSPOTTER build https://github.com/NiklasFauth/hoverboard-firmware-hack/wiki/Build-Instruction:-TranspOtter https://hackaday.io/project/161891-transpotter-ng
#endif #endif
// For any particular needs, feel free to change this file according to your needs. // For any particular needs, feel free to change this file according to your needs.

View File

@ -174,8 +174,10 @@ void mixerFcn(int16_t rtu_speed, int16_t rtu_steer, int16_t *rty_speedR, int16_t
void rateLimiter16(int16_t u, int16_t rate, int16_t *y); void rateLimiter16(int16_t u, int16_t rate, int16_t *y);
void multipleTapDet(int16_t u, uint32_t timeNow, MultipleTap *x); void multipleTapDet(int16_t u, uint32_t timeNow, MultipleTap *x);
// Define I2C and Nunchuck functions // Define I2C, Nunchuck, PPM functions
void I2C_Init(void); void I2C_Init(void);
void Nunchuck_Init(void); void Nunchuck_Init(void);
void Nunchuck_Read(void); void Nunchuck_Read(void);
uint8_t Nunchuck_Ping(void); uint8_t Nunchuck_Ping(void);
void PPM_Init(void);
void PPM_ISR_Callback(void);

View File

@ -71,7 +71,8 @@ extern volatile adc_buf_t adc_buffer;
LCD_PCF8574_HandleTypeDef lcd; LCD_PCF8574_HandleTypeDef lcd;
#endif #endif
extern I2C_HandleTypeDef hi2c2; extern I2C_HandleTypeDef hi2c2;
#ifndef VARIANT_TRANSPOTTER #if defined(CONTROL_SERIAL_USART2) || defined(FEEDBACK_SERIAL_USART2) || defined(DEBUG_SERIAL_USART2) \
|| defined(CONTROL_SERIAL_USART3) || defined(FEEDBACK_SERIAL_USART3) || defined(DEBUG_SERIAL_USART3)
extern UART_HandleTypeDef huart2; extern UART_HandleTypeDef huart2;
extern UART_HandleTypeDef huart3; extern UART_HandleTypeDef huart3;
static UART_HandleTypeDef huart; static UART_HandleTypeDef huart;
@ -454,7 +455,8 @@ int main(void) {
cmd1 = CLAMP((ppm_captured_value[0] - INPUT_MID) * 2, INPUT_MIN, INPUT_MAX); cmd1 = CLAMP((ppm_captured_value[0] - INPUT_MID) * 2, INPUT_MIN, INPUT_MAX);
cmd2 = CLAMP((ppm_captured_value[1] - INPUT_MID) * 2, INPUT_MIN, INPUT_MAX); cmd2 = CLAMP((ppm_captured_value[1] - INPUT_MID) * 2, INPUT_MIN, INPUT_MAX);
button1 = ppm_captured_value[5] > INPUT_MID; button1 = ppm_captured_value[5] > INPUT_MID;
float scale = ppm_captured_value[2] / 1000.0f; button2 = 0;
// float scale = ppm_captured_value[2] / 1000.0f; // not used for now, uncomment if needed
#endif #endif
#ifdef CONTROL_ADC #ifdef CONTROL_ADC

View File

@ -34,6 +34,7 @@
#include "stm32f1xx_hal.h" #include "stm32f1xx_hal.h"
#include "stm32f1xx.h" #include "stm32f1xx.h"
#include "stm32f1xx_it.h" #include "stm32f1xx_it.h"
#include "defines.h"
#include "config.h" #include "config.h"
extern DMA_HandleTypeDef hdma_i2c2_rx; extern DMA_HandleTypeDef hdma_i2c2_rx;

View File

@ -11,10 +11,12 @@ src_dir = Src
; ;
;default_envs = VARIANT_ADC ; Variant for control via ADC input ;default_envs = VARIANT_ADC ; Variant for control via ADC input
;default_envs = VARIANT_USART3 ; Variant for Serial control via USART3 input ;default_envs = VARIANT_USART3 ; Variant for Serial control via USART3 input
;default_envs = VARIANT_HOVERCAR ; Variant for HOVERCAR build
;default_envs = VARIANT_TRANSPOTTER ; Variant for TRANSPOTTER build https://github.com/NiklasFauth/hoverboard-firmware-hack/wiki/Build-Instruction:-TranspOtter https://hackaday.io/project/161891-transpotter-ng
;default_envs = VARIANT_NUNCHUCK ; Variant for Nunchuck controlled vehicle build ;default_envs = VARIANT_NUNCHUCK ; Variant for Nunchuck controlled vehicle build
;default_envs = VARIANT_PPM ; Variant for RC-Remotes with PPM-Sum signal ;default_envs = VARIANT_PPM ; Variant for RC-Remotes with PPM-Sum signal
;default_envs = VARIANT_HOVERCAR ; Variant for HOVERCAR build
;default_envs = VARIANT_TRANSPOTTER ; Variant for TRANSPOTTER build https://github.com/NiklasFauth/hoverboard-firmware-hack/wiki/Build-Instruction:-TranspOtter https://hackaday.io/project/161891-transpotter-ng
;================================================================
;================================================================ ;================================================================
[env:VARIANT_ADC] [env:VARIANT_ADC]
@ -40,6 +42,8 @@ build_flags =
-D VARIANT_ADC -D VARIANT_ADC
-D PALTFORMIO -D PALTFORMIO
;================================================================
[env:VARIANT_USART3] [env:VARIANT_USART3]
platform = ststm32 platform = ststm32
framework = stm32cube framework = stm32cube
@ -63,6 +67,50 @@ build_flags =
-D VARIANT_USART3 -D VARIANT_USART3
-D PALTFORMIO -D PALTFORMIO
;================================================================
[env:VARIANT_NUNCHUCK]
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 VARIANT_NUNCHUCK
-D PALTFORMIO
;================================================================
[env:VARIANT_PPM]
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 VARIANT_PPM
-D PALTFORMIO
;================================================================
[env:VARIANT_HOVERCAR] [env:VARIANT_HOVERCAR]
platform = ststm32 platform = ststm32
framework = stm32cube framework = stm32cube
@ -86,6 +134,8 @@ build_flags =
-D VARIANT_HOVERCAR -D VARIANT_HOVERCAR
-D PALTFORMIO -D PALTFORMIO
;================================================================
[env:VARIANT_TRANSPOTTER] [env:VARIANT_TRANSPOTTER]
platform = ststm32 platform = ststm32
framework = stm32cube framework = stm32cube
@ -105,40 +155,4 @@ build_flags =
-D VARIANT_TRANSPOTTER -D VARIANT_TRANSPOTTER
-D PALTFORMIO -D PALTFORMIO
[env:VARIANT_NUNCHUCK] ;================================================================
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 VARIANT_NUNCHUCK
-D PALTFORMIO
[env:VARIANT_PPM]
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 VARIANT_PPM
-D PALTFORMIO