refact: ADC, switches and keys
Add "hardware_defs" target to dump hardware defines from hal.h per target Fixed hal.h definitions for switches & ADC inputs Tools to generate hardware definitions from current hal.h generator: add support for EXTx and analog switches WiP Add generated header to hardware_defs target Add support for ADC input direction and index per GPIO port Incredible: it compiles Removed StdPeriph ADC driver Works on QX7 Works on TX16S (VBat missing) Switch driver using generated switches for stm32 targets Switch driver with generated switches for simu Use switch names from switch driver Fixed single conversion handling Fixed horus VBat reading Added switch name Fix warnings about bitfield offsets and GCC 4.4 This is caused by bitfields that cross type boundaries. In this particular case, it happens as the bitfield is not defined the same in `rtc_backup.cpp`. Switches has already been moved to generic driver Jitter measurement for each sample, not just for oversampled values Moved periph clock init to the ADC driver ADC & GPIOs. Add switchInit() to init pins Fix NV14 CMake Fix taranis target Fix NV14 (again) Model audio files: use new interface for switch index Fix X9-lite Fix simu headers Fix getSwitchName() Add support for ADC switches Fix switch warning YAML Test only switches which are defined Conversions tests for QX7 only on QX7 Fix X12S Fix function switch names Enable ADC periph clock before initialising channels NV14: offset inputs for the sticks & fix switches WiP: get rid of VSRCRAW and some more Simu shall use normal ADC driver fix x7 fix nv14 Fix 9x nav fix 212x64 fix xlite fix x9e fix simu lib fix unit tests fix x7 tests PWM stick values should be written directly into adcValues ... just like FlySky sticks. fix x12s fix nv14 Add some support for SPI ADC (only unit tests) Remove `jq` usage fix generate_yaml.py for newer libclang fix pot config fix stick names Some YAML generator improvements Max 16 Pots on COLORLCD Fix some source names Use 10 bits for switches to prevent overflow Removed horus constants for switches & ADC inputs Fix unit tests Fix curve edit Fix libsimulator Fix function switches (tpro) Refine ADC & analog API Moved hardware definitions scripts and templates into own dir cleanup API refine Fix unit tests Mixer: apply calibration only on required inputs Place ADC switches after all other ADC inputs Fix X12S Remove useless TR_POTS_VSRCRAW, TR_SW_VSRCRAW, and TR_VSRCRAW Cleanup redundant generated YAML parsers Fixes Boxer rebase Add boxer to generate-hw-defs.sh Obsolete LUA exports Add boxer ADC_DIRECTION Split generate_hw_defs.py into multiple files Some cleanup (+ LUA switches) Fix AXIS definitions Fixed translation strings declarations Some rebase fixes Remove some useless StdPeriph drivers fix: set pin mode to reset state on usart deinit fix: use canonical names for calibration data fix: ADC driver does not care about unconfigured inputs fix X12S ADC Add support for ADC conversion chaining Better X12S ADC implem Moved X12S ADC driver to HAL/LL Improve ADC driver separation Fixed taranis & nv14 Moved PWM gimbals to HAL/LL Removed useless TR_EXTRA_VSRCRAW Fixed include guards Small fixes Renamed control inputs Moved internal and external module pulse driver def to boards Move more things to the generic_stm32 board Remove STR_VMIXTRIMS Added analog labels Generate main control names Misuse labels / short labels for main controls Backward compatibility: sliders and legacy names New keys driver Let's get rid of StdPeriph headers in simu Add jinja2 to CI workflows Use `grep` instead of `sed` chore: add python jinja2 oto msys setup script Removed more static definitions and use dynamic ones instead Fixes X9E Fix x7 nav too 212 switch display Fix default sliders Removed NUM_STICKS 212 switch display working nicely Surface radio 'stick' replacements fix: switch, trim & rotary pin init Remove old key drivers Removed VKEYS Removed ETX_FOURCC Fixed SURFACE_NAME Removed TR_VSWITCHES & TR_TRIMS_SWITCHES Fix xpot switches Store calibrated analogs in physical order Use getSourceString in drawSource Implement missing YAML read/write Fix isSourceAvailableInInputs() Fix isSourceAvailable() Some surface fixes Fix CLI debug Ported colour UI of analog diagnostics to new ADC API Small fixes Better input mapping Minor tpro fixes Fix trims available Remove TX mode choice on surface radio Rename surface controls Channel order alignement Fix throttle warning Fix checkTrims() Fix pot config casting issue Fix IS_SWITCH_FS() Fixed input mapping Fix fswitch auto-switch Fixed storing / reading function switches in YAML Fix enableVBatBridge() / disableVBatBridge() Fix interesting mode conversion Fix sources issues Fix special funnction list Proper function switch handling 128 GUI improvements Fix compilation Boxer cosmetics 128 hardware screen cosmetic Fix TX12 switches More switches fixes Simplify CPU type handling Fix flash size Fixed page-up / page-down in libopenui
This commit is contained in:
committed by
Malte Langermann
parent
b6dd3a0ef8
commit
2b100e0eb5
+238
-188
@@ -33,48 +33,48 @@
|
||||
// Keys
|
||||
#define KEYS_RCC_AHB1Periph (RCC_AHB1Periph_GPIOB | RCC_AHB1Periph_GPIOC | RCC_AHB1Periph_GPIOD | RCC_AHB1Periph_GPIOE | RCC_AHB1Periph_GPIOG | RCC_AHB1Periph_GPIOH | RCC_AHB1Periph_GPIOI | RCC_AHB1Periph_GPIOJ)
|
||||
#if defined(PCBX12S)
|
||||
#define KEYS_GPIO_REG_PGUP GPIOC->IDR
|
||||
#define KEYS_GPIO_PIN_PGUP GPIO_Pin_13 // PC.13
|
||||
#define KEYS_GPIO_REG_PGDN GPIOI->IDR
|
||||
#define KEYS_GPIO_PIN_PGDN GPIO_Pin_8 // PI.08
|
||||
#define KEYS_GPIO_REG_LEFT GPIOI->IDR
|
||||
#define KEYS_GPIO_PIN_LEFT GPIO_Pin_7 // PI.07
|
||||
#define KEYS_GPIO_REG_ENTER GPIOC->IDR
|
||||
#define KEYS_GPIO_PIN_ENTER GPIO_Pin_1 // PC.01
|
||||
#define KEYS_GPIO_REG_UP GPIOG->IDR
|
||||
#define KEYS_GPIO_PIN_UP GPIO_Pin_13 // PG.13
|
||||
#define KEYS_GPIO_REG_DOWN GPIOI->IDR
|
||||
#define KEYS_GPIO_PIN_DOWN GPIO_Pin_6 // PI.06
|
||||
#define KEYS_GPIO_REG_RIGHT GPIOC->IDR
|
||||
#define KEYS_GPIO_PIN_RIGHT GPIO_Pin_4 // PC.04
|
||||
#define KEYS_GPIO_REG_PGUP GPIOC
|
||||
#define KEYS_GPIO_PIN_PGUP LL_GPIO_PIN_13 // PC.13
|
||||
#define KEYS_GPIO_REG_PGDN GPIOI
|
||||
#define KEYS_GPIO_PIN_PGDN LL_GPIO_PIN_8 // PI.08
|
||||
#define KEYS_GPIO_REG_SYS GPIOI
|
||||
#define KEYS_GPIO_PIN_SYS LL_GPIO_PIN_7 // PI.07
|
||||
#define KEYS_GPIO_REG_ENTER GPIOC
|
||||
#define KEYS_GPIO_PIN_ENTER LL_GPIO_PIN_1 // PC.01
|
||||
#define KEYS_GPIO_REG_MDL GPIOG
|
||||
#define KEYS_GPIO_PIN_MDL LL_GPIO_PIN_13 // PG.13
|
||||
#define KEYS_GPIO_REG_EXIT GPIOI
|
||||
#define KEYS_GPIO_PIN_EXIT LL_GPIO_PIN_6 // PI.06
|
||||
#define KEYS_GPIO_REG_TELE GPIOC
|
||||
#define KEYS_GPIO_PIN_TELE LL_GPIO_PIN_4 // PC.04
|
||||
#elif defined(RADIO_TX16S)
|
||||
#define KEYS_GPIO_REG_ENTER GPIOI->IDR
|
||||
#define KEYS_GPIO_PIN_ENTER GPIO_Pin_8 // PI.08
|
||||
#define KEYS_GPIO_REG_PGUP GPIOC->IDR
|
||||
#define KEYS_GPIO_PIN_PGUP GPIO_Pin_13 // PC.13
|
||||
#define KEYS_GPIO_REG_PGDN GPIOI->IDR
|
||||
#define KEYS_GPIO_PIN_PGDN GPIO_Pin_11 // PI.11
|
||||
#define KEYS_GPIO_REG_UP GPIOI->IDR
|
||||
#define KEYS_GPIO_PIN_UP GPIO_Pin_6 // PI.06
|
||||
#define KEYS_GPIO_REG_DOWN GPIOI->IDR
|
||||
#define KEYS_GPIO_PIN_DOWN GPIO_Pin_4 // PI.04
|
||||
#define KEYS_GPIO_REG_LEFT GPIOI->IDR
|
||||
#define KEYS_GPIO_PIN_LEFT GPIO_Pin_7 // PI.07
|
||||
#define KEYS_GPIO_REG_RIGHT GPIOI->IDR
|
||||
#define KEYS_GPIO_PIN_RIGHT GPIO_Pin_5 // PI.05
|
||||
#define KEYS_GPIO_REG_ENTER GPIOI
|
||||
#define KEYS_GPIO_PIN_ENTER LL_GPIO_PIN_8 // PI.08
|
||||
#define KEYS_GPIO_REG_PGUP GPIOC
|
||||
#define KEYS_GPIO_PIN_PGUP LL_GPIO_PIN_13 // PC.13
|
||||
#define KEYS_GPIO_REG_PGDN GPIOI
|
||||
#define KEYS_GPIO_PIN_PGDN LL_GPIO_PIN_11 // PI.11
|
||||
#define KEYS_GPIO_REG_MDL GPIOI
|
||||
#define KEYS_GPIO_PIN_MDL LL_GPIO_PIN_6 // PI.06
|
||||
#define KEYS_GPIO_REG_EXIT GPIOI
|
||||
#define KEYS_GPIO_PIN_EXIT LL_GPIO_PIN_4 // PI.04
|
||||
#define KEYS_GPIO_REG_SYS GPIOI
|
||||
#define KEYS_GPIO_PIN_SYS LL_GPIO_PIN_7 // PI.07
|
||||
#define KEYS_GPIO_REG_TELE GPIOI
|
||||
#define KEYS_GPIO_PIN_TELE LL_GPIO_PIN_5 // PI.05
|
||||
#elif defined(PCBX10)
|
||||
#define KEYS_GPIO_REG_ENTER GPIOI->IDR
|
||||
#define KEYS_GPIO_PIN_ENTER GPIO_Pin_8 // PI.08
|
||||
#define KEYS_GPIO_REG_PGDN GPIOI->IDR
|
||||
#define KEYS_GPIO_PIN_PGDN GPIO_Pin_11 // PI.11
|
||||
#define KEYS_GPIO_REG_UP GPIOI->IDR
|
||||
#define KEYS_GPIO_PIN_UP GPIO_Pin_4 // PI.04
|
||||
#define KEYS_GPIO_REG_DOWN GPIOI->IDR
|
||||
#define KEYS_GPIO_PIN_DOWN GPIO_Pin_6 // PI.06
|
||||
#define KEYS_GPIO_REG_LEFT GPIOI->IDR
|
||||
#define KEYS_GPIO_PIN_LEFT GPIO_Pin_7 // PI.07
|
||||
#define KEYS_GPIO_REG_RIGHT GPIOI->IDR
|
||||
#define KEYS_GPIO_PIN_RIGHT GPIO_Pin_5 // PI.05
|
||||
#define KEYS_GPIO_REG_ENTER GPIOI
|
||||
#define KEYS_GPIO_PIN_ENTER LL_GPIO_PIN_8 // PI.08
|
||||
#define KEYS_GPIO_REG_PGDN GPIOI
|
||||
#define KEYS_GPIO_PIN_PGDN LL_GPIO_PIN_11 // PI.11
|
||||
#define KEYS_GPIO_REG_MDL GPIOI
|
||||
#define KEYS_GPIO_PIN_MDL LL_GPIO_PIN_4 // PI.04
|
||||
#define KEYS_GPIO_REG_EXIT GPIOI
|
||||
#define KEYS_GPIO_PIN_EXIT LL_GPIO_PIN_6 // PI.06
|
||||
#define KEYS_GPIO_REG_SYS GPIOI
|
||||
#define KEYS_GPIO_PIN_SYS LL_GPIO_PIN_7 // PI.07
|
||||
#define KEYS_GPIO_REG_TELE GPIOI
|
||||
#define KEYS_GPIO_PIN_TELE LL_GPIO_PIN_5 // PI.05
|
||||
#endif
|
||||
|
||||
// Rotary Encoder
|
||||
@@ -103,138 +103,146 @@
|
||||
// Switches
|
||||
#define STORAGE_SWITCH_A
|
||||
#define HARDWARE_SWITCH_A
|
||||
#define SWITCHES_GPIO_REG_A_H GPIOH->IDR
|
||||
#define SWITCHES_GPIO_PIN_A_H GPIO_Pin_9 // PH.09
|
||||
#define SWITCHES_GPIO_REG_A_L GPIOI->IDR
|
||||
#define SWITCHES_GPIO_PIN_A_L GPIO_Pin_15 // PI.15
|
||||
#define SWITCHES_GPIO_REG_A_H GPIOH
|
||||
#define SWITCHES_GPIO_PIN_A_H LL_GPIO_PIN_9 // PH.09
|
||||
#define SWITCHES_GPIO_REG_A_L GPIOI
|
||||
#define SWITCHES_GPIO_PIN_A_L LL_GPIO_PIN_15 // PI.15
|
||||
#define STORAGE_SWITCH_B
|
||||
#define HARDWARE_SWITCH_B
|
||||
#define SWITCHES_GPIO_REG_B_H GPIOH->IDR
|
||||
#define SWITCHES_GPIO_PIN_B_H GPIO_Pin_12 // PH.12
|
||||
#define SWITCHES_GPIO_REG_B_L GPIOB->IDR
|
||||
#define SWITCHES_GPIO_PIN_B_L GPIO_Pin_12 // PB.12
|
||||
#define SWITCHES_GPIO_REG_B_H GPIOH
|
||||
#define SWITCHES_GPIO_PIN_B_H LL_GPIO_PIN_12 // PH.12
|
||||
#define SWITCHES_GPIO_REG_B_L GPIOB
|
||||
#define SWITCHES_GPIO_PIN_B_L LL_GPIO_PIN_12 // PB.12
|
||||
#define STORAGE_SWITCH_C
|
||||
#define HARDWARE_SWITCH_C
|
||||
#define SWITCHES_GPIO_REG_C_H GPIOD->IDR
|
||||
#define SWITCHES_GPIO_PIN_C_H GPIO_Pin_11 // PD.11
|
||||
#define SWITCHES_GPIO_REG_C_L GPIOB->IDR
|
||||
#define SWITCHES_GPIO_PIN_C_L GPIO_Pin_15 // PB.15
|
||||
#define SWITCHES_GPIO_REG_C_H GPIOD
|
||||
#define SWITCHES_GPIO_PIN_C_H LL_GPIO_PIN_11 // PD.11
|
||||
#define SWITCHES_GPIO_REG_C_L GPIOB
|
||||
#define SWITCHES_GPIO_PIN_C_L LL_GPIO_PIN_15 // PB.15
|
||||
#define STORAGE_SWITCH_D
|
||||
#define HARDWARE_SWITCH_D
|
||||
#define SWITCHES_GPIO_REG_D_H GPIOJ->IDR
|
||||
#define SWITCHES_GPIO_PIN_D_H GPIO_Pin_7 // PJ.07
|
||||
#define SWITCHES_GPIO_REG_D_L GPIOG->IDR
|
||||
#define SWITCHES_GPIO_PIN_D_L GPIO_Pin_2 // PG.02
|
||||
#define SWITCHES_GPIO_REG_D_H GPIOJ
|
||||
#define SWITCHES_GPIO_PIN_D_H LL_GPIO_PIN_7 // PJ.07
|
||||
#define SWITCHES_GPIO_REG_D_L GPIOG
|
||||
#define SWITCHES_GPIO_PIN_D_L LL_GPIO_PIN_2 // PG.02
|
||||
#define STORAGE_SWITCH_E
|
||||
#define HARDWARE_SWITCH_E
|
||||
#define SWITCHES_GPIO_REG_E_H GPIOH->IDR
|
||||
#define SWITCHES_GPIO_PIN_E_H GPIO_Pin_4 // PH.04
|
||||
#define SWITCHES_GPIO_REG_E_L GPIOE->IDR
|
||||
#define SWITCHES_GPIO_PIN_E_L GPIO_Pin_3 // PE.03
|
||||
#define SWITCHES_GPIO_REG_E_H GPIOH
|
||||
#define SWITCHES_GPIO_PIN_E_H LL_GPIO_PIN_4 // PH.04
|
||||
#define SWITCHES_GPIO_REG_E_L GPIOE
|
||||
#define SWITCHES_GPIO_PIN_E_L LL_GPIO_PIN_3 // PE.03
|
||||
#define STORAGE_SWITCH_F
|
||||
#define HARDWARE_SWITCH_F
|
||||
#define SWITCHES_GPIO_REG_F GPIOH->IDR
|
||||
#define SWITCHES_GPIO_PIN_F GPIO_Pin_3 // PH.03
|
||||
#define SWITCHES_GPIO_REG_F GPIOH
|
||||
#define SWITCHES_GPIO_PIN_F LL_GPIO_PIN_3 // PH.03
|
||||
#define STORAGE_SWITCH_G
|
||||
#define HARDWARE_SWITCH_G
|
||||
#define SWITCHES_GPIO_REG_G_H GPIOG->IDR
|
||||
#define SWITCHES_GPIO_PIN_G_H GPIO_Pin_6 // PG.06
|
||||
#define SWITCHES_GPIO_REG_G_L GPIOG->IDR
|
||||
#define SWITCHES_GPIO_PIN_G_L GPIO_Pin_3 // PG.03
|
||||
#define SWITCHES_GPIO_REG_G_H GPIOG
|
||||
#define SWITCHES_GPIO_PIN_G_H LL_GPIO_PIN_6 // PG.06
|
||||
#define SWITCHES_GPIO_REG_G_L GPIOG
|
||||
#define SWITCHES_GPIO_PIN_G_L LL_GPIO_PIN_3 // PG.03
|
||||
#define STORAGE_SWITCH_H
|
||||
#define HARDWARE_SWITCH_H
|
||||
#define SWITCHES_GPIO_REG_H GPIOG->IDR
|
||||
#define SWITCHES_GPIO_PIN_H GPIO_Pin_7 // PG.07
|
||||
#define SWITCHES_GPIO_REG_H GPIOG
|
||||
#define SWITCHES_GPIO_PIN_H LL_GPIO_PIN_7 // PG.07
|
||||
|
||||
#if defined(PCBX12S)
|
||||
#define SWITCHES_F_INVERTED
|
||||
#elif defined(PCBX10)
|
||||
#define SWITCHES_B_INVERTED
|
||||
#define SWITCHES_D_INVERTED
|
||||
#define SWITCHES_E_INVERTED
|
||||
#endif
|
||||
|
||||
#if defined(PCBX10)
|
||||
// Gimbal switch left
|
||||
#define STORAGE_SWITCH_I
|
||||
#define HARDWARE_SWITCH_I
|
||||
#define SWITCHES_GPIO_REG_I GPIOH->IDR
|
||||
#define SWITCHES_GPIO_PIN_I GPIO_Pin_14 // PH.14
|
||||
#define SWITCHES_GPIO_REG_I GPIOH
|
||||
#define SWITCHES_GPIO_PIN_I LL_GPIO_PIN_14 // PH.14
|
||||
// Gimbal switch right
|
||||
#define STORAGE_SWITCH_J
|
||||
#define HARDWARE_SWITCH_J
|
||||
#define SWITCHES_GPIO_REG_J GPIOH->IDR
|
||||
#define SWITCHES_GPIO_PIN_J GPIO_Pin_15 // PH.15
|
||||
#define SWITCHES_GPIO_REG_J GPIOH
|
||||
#define SWITCHES_GPIO_PIN_J LL_GPIO_PIN_15 // PH.15
|
||||
#elif defined(PCBX12S)
|
||||
// Gimbal switch left
|
||||
#define STORAGE_SWITCH_I
|
||||
#define HARDWARE_SWITCH_I
|
||||
#define SWITCHES_GPIO_REG_I GPIOB->IDR
|
||||
#define SWITCHES_GPIO_PIN_I GPIO_Pin_1 // PB.01
|
||||
#define SWITCHES_GPIO_REG_I GPIOB
|
||||
#define SWITCHES_GPIO_PIN_I LL_GPIO_PIN_1 // PB.01
|
||||
// Gimbal switch right
|
||||
#define STORAGE_SWITCH_J
|
||||
#define HARDWARE_SWITCH_J
|
||||
#define SWITCHES_GPIO_REG_J GPIOB->IDR
|
||||
#define SWITCHES_GPIO_PIN_J GPIO_Pin_0 // PB.00
|
||||
#define SWITCHES_GPIO_REG_J GPIOB
|
||||
#define SWITCHES_GPIO_PIN_J LL_GPIO_PIN_0 // PB.00
|
||||
#endif
|
||||
|
||||
// Trims
|
||||
#if defined(PCBX12S)
|
||||
#define TRIMS_GPIO_REG_RHL GPIOC->IDR
|
||||
#define TRIMS_GPIO_PIN_RHL GPIO_Pin_0 // PC.00
|
||||
#define TRIMS_GPIO_REG_RHR GPIOI->IDR
|
||||
#define TRIMS_GPIO_PIN_RHR GPIO_Pin_4 // PI.04
|
||||
#define TRIMS_GPIO_REG_RVD GPIOG->IDR
|
||||
#define TRIMS_GPIO_PIN_RVD GPIO_Pin_12 // PG.12
|
||||
#define TRIMS_GPIO_REG_RVU GPIOJ->IDR
|
||||
#define TRIMS_GPIO_PIN_RVU GPIO_Pin_14 // PJ.14
|
||||
#define TRIMS_GPIO_REG_LVD GPIOJ->IDR
|
||||
#define TRIMS_GPIO_PIN_LVD GPIO_Pin_13 // PJ.13
|
||||
#define TRIMS_GPIO_REG_LHL GPIOD->IDR
|
||||
#define TRIMS_GPIO_PIN_LHL GPIO_Pin_3 // PD.03
|
||||
#define TRIMS_GPIO_REG_LVU GPIOJ->IDR
|
||||
#define TRIMS_GPIO_PIN_LVU GPIO_Pin_12 // PJ.12
|
||||
#define TRIMS_GPIO_REG_LHR GPIOD->IDR
|
||||
#define TRIMS_GPIO_PIN_LHR GPIO_Pin_7 // PD.07
|
||||
#define TRIMS_GPIO_REG_RSD GPIOJ->IDR
|
||||
#define TRIMS_GPIO_PIN_RSD GPIO_Pin_8 // PJ.08
|
||||
#define TRIMS_GPIO_REG_RSU GPIOD->IDR
|
||||
#define TRIMS_GPIO_PIN_RSU GPIO_Pin_13 // PD.13
|
||||
#define TRIMS_GPIO_REG_LSD GPIOB->IDR
|
||||
#define TRIMS_GPIO_PIN_LSD GPIO_Pin_14 // PB.14
|
||||
#define TRIMS_GPIO_REG_LSU GPIOB->IDR
|
||||
#define TRIMS_GPIO_PIN_LSU GPIO_Pin_13 // PB.13
|
||||
#define TRIMS_GPIO_REG_RHL GPIOC
|
||||
#define TRIMS_GPIO_PIN_RHL LL_GPIO_PIN_0 // PC.00
|
||||
#define TRIMS_GPIO_REG_RHR GPIOI
|
||||
#define TRIMS_GPIO_PIN_RHR LL_GPIO_PIN_4 // PI.04
|
||||
#define TRIMS_GPIO_REG_RVD GPIOG
|
||||
#define TRIMS_GPIO_PIN_RVD LL_GPIO_PIN_12 // PG.12
|
||||
#define TRIMS_GPIO_REG_RVU GPIOJ
|
||||
#define TRIMS_GPIO_PIN_RVU LL_GPIO_PIN_14 // PJ.14
|
||||
#define TRIMS_GPIO_REG_LVD GPIOJ
|
||||
#define TRIMS_GPIO_PIN_LVD LL_GPIO_PIN_13 // PJ.13
|
||||
#define TRIMS_GPIO_REG_LHL GPIOD
|
||||
#define TRIMS_GPIO_PIN_LHL LL_GPIO_PIN_3 // PD.03
|
||||
#define TRIMS_GPIO_REG_LVU GPIOJ
|
||||
#define TRIMS_GPIO_PIN_LVU LL_GPIO_PIN_12 // PJ.12
|
||||
#define TRIMS_GPIO_REG_LHR GPIOD
|
||||
#define TRIMS_GPIO_PIN_LHR LL_GPIO_PIN_7 // PD.07
|
||||
#define TRIMS_GPIO_REG_RSD GPIOJ
|
||||
#define TRIMS_GPIO_PIN_RSD LL_GPIO_PIN_8 // PJ.08
|
||||
#define TRIMS_GPIO_REG_RSU GPIOD
|
||||
#define TRIMS_GPIO_PIN_RSU LL_GPIO_PIN_13 // PD.13
|
||||
#define TRIMS_GPIO_REG_LSD GPIOB
|
||||
#define TRIMS_GPIO_PIN_LSD LL_GPIO_PIN_14 // PB.14
|
||||
#define TRIMS_GPIO_REG_LSU GPIOB
|
||||
#define TRIMS_GPIO_PIN_LSU LL_GPIO_PIN_13 // PB.13
|
||||
#elif defined(PCBX10)
|
||||
#if defined(RADIO_TX16S)
|
||||
#define TRIMS_GPIO_REG_LHL GPIOA->IDR
|
||||
#define TRIMS_GPIO_PIN_LHL GPIO_Pin_6 // PA.06
|
||||
#define TRIMS_GPIO_REG_LHR GPIOC->IDR
|
||||
#define TRIMS_GPIO_PIN_LHR GPIO_Pin_4 // PC.04
|
||||
#define TRIMS_GPIO_REG_LHL GPIOA
|
||||
#define TRIMS_GPIO_PIN_LHL LL_GPIO_PIN_6 // PA.06
|
||||
#define TRIMS_GPIO_REG_LHR GPIOC
|
||||
#define TRIMS_GPIO_PIN_LHR LL_GPIO_PIN_4 // PC.04
|
||||
#else
|
||||
#define TRIMS_GPIO_REG_LHL GPIOB->IDR
|
||||
#define TRIMS_GPIO_PIN_LHL GPIO_Pin_8 // PB.08
|
||||
#define TRIMS_GPIO_REG_LHR GPIOB->IDR
|
||||
#define TRIMS_GPIO_PIN_LHR GPIO_Pin_9 // PB.09
|
||||
#define TRIMS_GPIO_REG_LHL GPIOB
|
||||
#define TRIMS_GPIO_PIN_LHL LL_GPIO_PIN_8 // PB.08
|
||||
#define TRIMS_GPIO_REG_LHR GPIOB
|
||||
#define TRIMS_GPIO_PIN_LHR LL_GPIO_PIN_9 // PB.09
|
||||
#endif
|
||||
#define TRIMS_GPIO_REG_LVD GPIOG->IDR
|
||||
#define TRIMS_GPIO_PIN_LVD GPIO_Pin_12 // PG.12
|
||||
#define TRIMS_GPIO_REG_LVU GPIOJ->IDR
|
||||
#define TRIMS_GPIO_PIN_LVU GPIO_Pin_14 // PJ.14
|
||||
#define TRIMS_GPIO_REG_RVD GPIOJ->IDR
|
||||
#define TRIMS_GPIO_PIN_RVD GPIO_Pin_13 // PJ.13
|
||||
#define TRIMS_GPIO_REG_RHL GPIOD->IDR
|
||||
#define TRIMS_GPIO_PIN_RHL GPIO_Pin_3 // PD.03
|
||||
#define TRIMS_GPIO_REG_RVU GPIOJ->IDR
|
||||
#define TRIMS_GPIO_PIN_RVU GPIO_Pin_12 // PJ.12
|
||||
#define TRIMS_GPIO_REG_RHR GPIOD->IDR
|
||||
#define TRIMS_GPIO_PIN_RHR GPIO_Pin_7 // PD.07
|
||||
#define TRIMS_GPIO_REG_LVD GPIOG
|
||||
#define TRIMS_GPIO_PIN_LVD LL_GPIO_PIN_12 // PG.12
|
||||
#define TRIMS_GPIO_REG_LVU GPIOJ
|
||||
#define TRIMS_GPIO_PIN_LVU LL_GPIO_PIN_14 // PJ.14
|
||||
#define TRIMS_GPIO_REG_RVD GPIOJ
|
||||
#define TRIMS_GPIO_PIN_RVD LL_GPIO_PIN_13 // PJ.13
|
||||
#define TRIMS_GPIO_REG_RHL GPIOD
|
||||
#define TRIMS_GPIO_PIN_RHL LL_GPIO_PIN_3 // PD.03
|
||||
#define TRIMS_GPIO_REG_RVU GPIOJ
|
||||
#define TRIMS_GPIO_PIN_RVU LL_GPIO_PIN_12 // PJ.12
|
||||
#define TRIMS_GPIO_REG_RHR GPIOD
|
||||
#define TRIMS_GPIO_PIN_RHR LL_GPIO_PIN_7 // PD.07
|
||||
#if defined(RADIO_FAMILY_T16)
|
||||
#define TRIMS_GPIO_REG_LSU GPIOD->IDR
|
||||
#define TRIMS_GPIO_PIN_LSU GPIO_Pin_13 // PD.13
|
||||
#define TRIMS_GPIO_REG_LSD GPIOJ->IDR
|
||||
#define TRIMS_GPIO_PIN_LSD GPIO_Pin_8 // PJ.08
|
||||
#define TRIMS_GPIO_REG_LSU GPIOD
|
||||
#define TRIMS_GPIO_PIN_LSU LL_GPIO_PIN_13 // PD.13
|
||||
#define TRIMS_GPIO_REG_LSD GPIOJ
|
||||
#define TRIMS_GPIO_PIN_LSD LL_GPIO_PIN_8 // PJ.08
|
||||
#else
|
||||
#define TRIMS_GPIO_REG_LSU GPIOJ->IDR
|
||||
#define TRIMS_GPIO_PIN_LSU GPIO_Pin_8 // PJ.08
|
||||
#define TRIMS_GPIO_REG_LSD GPIOD->IDR
|
||||
#define TRIMS_GPIO_PIN_LSD GPIO_Pin_13 // PD.13
|
||||
#define TRIMS_GPIO_REG_LSU GPIOJ
|
||||
#define TRIMS_GPIO_PIN_LSU LL_GPIO_PIN_8 // PJ.08
|
||||
#define TRIMS_GPIO_REG_LSD GPIOD
|
||||
#define TRIMS_GPIO_PIN_LSD LL_GPIO_PIN_13 // PD.13
|
||||
#endif
|
||||
#define TRIMS_GPIO_REG_RSU GPIOB->IDR
|
||||
#define TRIMS_GPIO_PIN_RSU GPIO_Pin_14 // PB.14
|
||||
#define TRIMS_GPIO_REG_RSD GPIOB->IDR
|
||||
#define TRIMS_GPIO_PIN_RSD GPIO_Pin_13 // PB.13
|
||||
#define TRIMS_GPIO_REG_RSU GPIOB
|
||||
#define TRIMS_GPIO_PIN_RSU LL_GPIO_PIN_14 // PB.14
|
||||
#define TRIMS_GPIO_REG_RSD GPIOB
|
||||
#define TRIMS_GPIO_PIN_RSD LL_GPIO_PIN_13 // PB.13
|
||||
#endif
|
||||
|
||||
// Index of all keys
|
||||
@@ -269,88 +277,130 @@
|
||||
|
||||
// ADC
|
||||
#if defined(PCBX12S)
|
||||
#define ADC_RCC_AHB1Periph (RCC_AHB1Periph_GPIOE | RCC_AHB1Periph_GPIOF | RCC_AHB1Periph_DMA2)
|
||||
#define ADC_RCC_AHB1Periph (RCC_AHB1Periph_DMA2)
|
||||
#define ADC_RCC_APB1Periph 0
|
||||
#define ADC_RCC_APB2Periph (RCC_APB2Periph_SPI4 | RCC_APB2Periph_ADC1 | RCC_APB2Periph_ADC3)
|
||||
#define ADC_RCC_APB2Periph (RCC_APB2Periph_SPI4)
|
||||
#define ADC_SPI SPI4
|
||||
#define ADC_GPIO_AF GPIO_AF_SPI4
|
||||
#define ADC_SPI_GPIO GPIOE
|
||||
#define ADC_SPI_PIN_SCK GPIO_Pin_2 // PE.02
|
||||
#define ADC_SPI_PIN_CS GPIO_Pin_4 // PE.04
|
||||
#define ADC_SPI_PIN_MOSI GPIO_Pin_6 // PE.06
|
||||
#define ADC_SPI_PIN_MISO GPIO_Pin_5 // PE.05
|
||||
#define ADC_SPI_PinSource_SCK GPIO_PinSource2
|
||||
#define ADC_SPI_PinSource_MISO GPIO_PinSource5
|
||||
#define ADC_SPI_PinSource_MOSI GPIO_PinSource6
|
||||
#define ADC_GPIO_PIN_MOUSE1 GPIO_Pin_8 // PF.08 ADC3_IN6 J5 MOUSE_X
|
||||
#define ADC_GPIO_PIN_MOUSE2 GPIO_Pin_9 // PF.09 ADC3_IN7 J6 MOUSE_Y
|
||||
#define ADC_SPI_GPIO_AF LL_GPIO_AF_5
|
||||
#define ADC_SPI_GPIO_PIN_SCK LL_GPIO_PIN_2 // PE.02
|
||||
#define ADC_SPI_GPIO_PIN_CS LL_GPIO_PIN_4 // PE.04
|
||||
#define ADC_SPI_GPIO_PIN_MOSI LL_GPIO_PIN_6 // PE.06
|
||||
#define ADC_SPI_GPIO_PIN_MISO LL_GPIO_PIN_5 // PE.05
|
||||
|
||||
#define ADC_SPI_STICK_LH 0
|
||||
#define ADC_SPI_STICK_LV 1
|
||||
#define ADC_SPI_STICK_RV 2
|
||||
#define ADC_SPI_STICK_RH 3
|
||||
#define ADC_SPI_POT1 4
|
||||
#define ADC_SPI_POT2 5
|
||||
#define ADC_SPI_POT3 6
|
||||
#define ADC_SPI_SLIDER1 7
|
||||
#define ADC_SPI_SLIDER2 8
|
||||
#define ADC_SPI_BATT 9
|
||||
#define ADC_SPI_SLIDER3 11
|
||||
#define ADC_SPI_SLIDER4 10
|
||||
|
||||
#define ADC_MAIN ADC3
|
||||
#define ADC_GPIO_PIN_MOUSE1 LL_GPIO_PIN_8 // PF.08 ADC3_IN6 J5 MOUSE_X
|
||||
#define ADC_GPIO_PIN_MOUSE2 LL_GPIO_PIN_9 // PF.09 ADC3_IN7 J6 MOUSE_Y
|
||||
#define ADC_GPIO_MOUSE GPIOF
|
||||
#define ADC_CHANNEL_MOUSE1 6
|
||||
#define ADC_CHANNEL_MOUSE2 7
|
||||
#define ADC_GPIOF_PINS (ADC_GPIO_PIN_MOUSE1 | ADC_GPIO_PIN_MOUSE2)
|
||||
#define ADC_EXT ADC1
|
||||
#define ADC_EXT_SAMPTIME LL_ADC_SAMPLINGTIME_56CYCLES
|
||||
#define ADC_CHANNEL_RTC_BAT LL_ADC_CHANNEL_VBAT // ADC1_IN16
|
||||
#define ADC_EXT_CHANNELS { ADC_CHANNEL_RTC_BATT }
|
||||
#define ADC_DMA DMA2
|
||||
#define ADC_DMA_Stream DMA2_Stream0
|
||||
#define ADC_SAMPTIME 3
|
||||
#define ADC_VREF_PREC2 300
|
||||
#define ADC_DMA_CHANNEL LL_DMA_CHANNEL_2
|
||||
#define ADC_DMA_STREAM LL_DMA_STREAM_0
|
||||
#define ADC_DMA_STREAM_IRQ DMA2_Stream0_IRQn
|
||||
#define ADC_DMA_STREAM_IRQHandler DMA2_Stream0_IRQHandler
|
||||
#define ADC_SAMPTIME LL_ADC_SAMPLINGTIME_56CYCLES
|
||||
#define ADC_VREF_PREC2 600
|
||||
#elif defined(PCBX10)
|
||||
#define ADC_RCC_AHB1Periph (RCC_AHB1Periph_GPIOA | RCC_AHB1Periph_GPIOC | RCC_AHB1Periph_GPIOF | RCC_AHB1Periph_DMA2)
|
||||
#define ADC_RCC_AHB1Periph (RCC_AHB1Periph_DMA2)
|
||||
#define ADC_RCC_APB1Periph (RCC_APB1Periph_TIM5)
|
||||
#define ADC_RCC_APB2Periph (RCC_APB2Periph_ADC1 | RCC_APB2Periph_ADC3)
|
||||
#define ADC_GPIO_PIN_STICK_LH GPIO_Pin_0 // PA.00
|
||||
#define ADC_GPIO_PIN_STICK_LV GPIO_Pin_1 // PA.01
|
||||
#define ADC_GPIO_PIN_STICK_RH GPIO_Pin_2 // PA.02
|
||||
#define ADC_GPIO_PIN_STICK_RV GPIO_Pin_3 // PA.03
|
||||
#define ADC_GPIO_PIN_POT1 GPIO_Pin_0 // PC.00
|
||||
#define ADC_GPIO_PIN_POT2 GPIO_Pin_1 // PC.01
|
||||
#define ADC_GPIO_PIN_POT3 GPIO_Pin_2 // PC.02
|
||||
#define ADC_GPIO_PIN_SLIDER1 GPIO_Pin_6 // PF.06
|
||||
#define ADC_GPIO_PIN_SLIDER2 GPIO_Pin_3 // PC.03
|
||||
#define ADC_GPIO_PIN_BATT GPIO_Pin_7 // PF.07
|
||||
#define ADC_GPIO_PIN_EXT1 GPIO_Pin_8 // PF.08
|
||||
#define ADC_GPIO_PIN_EXT2 GPIO_Pin_9 // PF.09
|
||||
#define ADC_RCC_APB2Periph 0
|
||||
#define ADC_GPIO_PIN_STICK_LH LL_GPIO_PIN_0 // PA.00
|
||||
#define ADC_GPIO_PIN_STICK_LV LL_GPIO_PIN_1 // PA.01
|
||||
#define ADC_GPIO_PIN_STICK_RH LL_GPIO_PIN_2 // PA.02
|
||||
#define ADC_GPIO_PIN_STICK_RV LL_GPIO_PIN_3 // PA.03
|
||||
#define ADC_GPIO_PIN_POT1 LL_GPIO_PIN_0 // PC.00
|
||||
#define ADC_GPIO_PIN_POT2 LL_GPIO_PIN_1 // PC.01
|
||||
#define ADC_GPIO_PIN_POT3 LL_GPIO_PIN_2 // PC.02 //
|
||||
#define ADC_GPIO_PIN_SLIDER1 LL_GPIO_PIN_6 // PF.06
|
||||
#define ADC_GPIO_PIN_SLIDER2 LL_GPIO_PIN_3 // PC.03 //
|
||||
#define ADC_GPIO_PIN_BATT LL_GPIO_PIN_7 // PF.07
|
||||
#define ADC_GPIO_PIN_EXT1 LL_GPIO_PIN_8 // PF.08
|
||||
#define ADC_GPIO_PIN_EXT2 LL_GPIO_PIN_9 // PF.09
|
||||
#define ADC_GPIO_PIN_EXT3 ADC_GPIO_PIN_STICK_RH
|
||||
#define ADC_GPIO_PIN_EXT4 ADC_GPIO_PIN_STICK_RV
|
||||
#if !defined(RADIO_TX16S)
|
||||
#define PWM_STICKS
|
||||
#define PWM_TIMER TIM5
|
||||
#define PWM_GPIO GPIOA
|
||||
#define PWM_GPIO_AF GPIO_AF_TIM5
|
||||
#define PWM_IRQHandler TIM5_IRQHandler
|
||||
#define PWM_IRQn TIM5_IRQn
|
||||
#define PWM_GPIOA_PINS (GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3)
|
||||
#define PWM_GPIOA_PINS (ADC_GPIO_PIN_STICK_LH | ADC_GPIO_PIN_STICK_LV | ADC_GPIO_PIN_STICK_RH | ADC_GPIO_PIN_STICK_RV)
|
||||
#endif
|
||||
#define ADC_GPIOA_PINS_FS (GPIO_Pin_2 | GPIO_Pin_3)
|
||||
#define ADC_GPIOA_PINS (STICKS_PWM_ENABLED() ? 0 : (GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3))
|
||||
#define ADC_GPIOC_PINS (GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3)
|
||||
#define ADC_GPIOF_PINS (GPIO_Pin_6 | GPIO_Pin_7 | GPIO_Pin_8 | GPIO_Pin_9)
|
||||
#define ADC_CHANNEL_STICK_LH ADC_Channel_0 // ADC3_IN0
|
||||
#define ADC_CHANNEL_STICK_LV ADC_Channel_1 // ADC3_IN1
|
||||
#define ADC_CHANNEL_STICK_RH ADC_Channel_2 // ADC3_IN2
|
||||
#define ADC_CHANNEL_STICK_RV ADC_Channel_3 // ADC3_IN3
|
||||
#define ADC_CHANNEL_POT1 ADC_Channel_10 // ADC3_IN10
|
||||
#define ADC_CHANNEL_POT2 ADC_Channel_11 // ADC3_IN11
|
||||
#define ADC_CHANNEL_POT3 ADC_Channel_12 // ADC3_IN12
|
||||
#define ADC_CHANNEL_SLIDER1 ADC_Channel_4 // ADC3_IN4
|
||||
#define ADC_CHANNEL_SLIDER2 ADC_Channel_13 // ADC3_IN13
|
||||
#define ADC_CHANNEL_BATT ADC_Channel_5 // ADC3_IN5
|
||||
#define ADC_CHANNEL_EXT1 ADC_Channel_6 // ADC3_IN6
|
||||
#define ADC_CHANNEL_EXT2 ADC_Channel_7 // ADC3_IN7
|
||||
#define ADC_CHANNEL_EXT3 ADC_Channel_2 // ADC3_IN2: same as RH
|
||||
#define ADC_CHANNEL_EXT4 ADC_Channel_3 // ADC3_IN3: same as RV
|
||||
#define ADC_GPIOA_PINS_FS (LL_GPIO_PIN_2 | LL_GPIO_PIN_3)
|
||||
#define ADC_GPIOA_PINS (ADC_GPIO_PIN_STICK_LH | ADC_GPIO_PIN_STICK_LV | ADC_GPIO_PIN_STICK_RH | ADC_GPIO_PIN_STICK_RV)
|
||||
#define ADC_GPIOC_PINS (ADC_GPIO_PIN_POT1 | ADC_GPIO_PIN_POT2 | ADC_GPIO_PIN_POT3 | ADC_GPIO_PIN_SLIDER2)
|
||||
#define ADC_GPIOF_PINS (ADC_GPIO_PIN_SLIDER1 | ADC_GPIO_PIN_BATT | ADC_GPIO_PIN_EXT1 | ADC_GPIO_PIN_EXT2)
|
||||
#define ADC_CHANNEL_STICK_LH LL_ADC_CHANNEL_0 // ADC3_IN0
|
||||
#define ADC_CHANNEL_STICK_LV LL_ADC_CHANNEL_1 // ADC3_IN1
|
||||
#define ADC_CHANNEL_STICK_RH LL_ADC_CHANNEL_2 // ADC3_IN2
|
||||
#define ADC_CHANNEL_STICK_RV LL_ADC_CHANNEL_3 // ADC3_IN3
|
||||
#define ADC_CHANNEL_POT1 LL_ADC_CHANNEL_10 // ADC3_IN10
|
||||
#define ADC_CHANNEL_POT2 LL_ADC_CHANNEL_11 // ADC3_IN11
|
||||
#define ADC_CHANNEL_POT3 LL_ADC_CHANNEL_12 // ADC3_IN12
|
||||
#define ADC_CHANNEL_SLIDER1 LL_ADC_CHANNEL_4 // ADC3_IN4
|
||||
#define ADC_CHANNEL_SLIDER2 LL_ADC_CHANNEL_13 // ADC3_IN13
|
||||
#define ADC_CHANNEL_BATT LL_ADC_CHANNEL_5 // ADC3_IN5
|
||||
#define ADC_CHANNEL_EXT1 LL_ADC_CHANNEL_6 // ADC3_IN6
|
||||
#define ADC_CHANNEL_EXT2 LL_ADC_CHANNEL_7 // ADC3_IN7
|
||||
#define ADC_CHANNEL_EXT3 LL_ADC_CHANNEL_2 // ADC3_IN2: same as RH
|
||||
#define ADC_CHANNEL_EXT4 LL_ADC_CHANNEL_3 // ADC3_IN3: same as RV
|
||||
#define ADC_CHANNEL_RTC_BAT LL_ADC_CHANNEL_VBAT // ADC1_IN18
|
||||
#define ADC_MAIN ADC3
|
||||
#define ADC_EXT ADC1
|
||||
#define ADC_SAMPTIME 3
|
||||
#define ADC_EXT_CHANNELS { ADC_CHANNEL_RTC_BAT }
|
||||
#define ADC_EXT_SAMPTIME LL_ADC_SAMPLINGTIME_56CYCLES
|
||||
#define ADC_SAMPTIME LL_ADC_SAMPLINGTIME_56CYCLES
|
||||
#define ADC_DMA DMA2
|
||||
#define ADC_DMA_Channel DMA_Channel_2
|
||||
#define ADC_DMA_Stream DMA2_Stream0
|
||||
#define ADC_TRANSFER_COMPLETE() (ADC_DMA->LISR & DMA_LISR_TCIF0)
|
||||
#define ADC_DMA_TC_Flag DMA_FLAG_TCIF0
|
||||
#define ADC_DMA_CHANNEL LL_DMA_CHANNEL_2
|
||||
#define ADC_DMA_STREAM LL_DMA_STREAM_0
|
||||
#define ADC_DMA_STREAM_IRQ DMA2_Stream0_IRQn
|
||||
#define ADC_DMA_STREAM_IRQHandler DMA2_Stream0_IRQHandler
|
||||
|
||||
// VBat divider is /4 on F42x and F43x devices
|
||||
#if defined(RADIO_TX16S)
|
||||
#define ADC_VREF_PREC2 330
|
||||
#define ADC_VREF_PREC2 660
|
||||
#elif defined(RADIO_T16) || defined(RADIO_T18)
|
||||
#define ADC_VREF_PREC2 300
|
||||
#define ADC_VREF_PREC2 600
|
||||
#else
|
||||
#define ADC_VREF_PREC2 250
|
||||
#define ADC_VREF_PREC2 500
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(RADIO_T16)
|
||||
#define ADC_DIRECTION {1,-1,1,-1, 1,1,1, -1,1,1,1, -1,1 }
|
||||
#elif defined(RADIO_T18)
|
||||
#define ADC_DIRECTION {1,-1,1,-1, -1,1,-1, -1,1,1,1, -1,1 }
|
||||
#elif defined(RADIO_TX16S)
|
||||
#define ADC_DIRECTION {1,-1,1,-1, 1,1,1, -1,1,1,1, -1,1 }
|
||||
#elif defined(PCBX10)
|
||||
#define ADC_DIRECTION {1,-1,1,-1, -1,1,-1, 1,1,1,1, 1,-1 }
|
||||
#elif defined(PCBX12S)
|
||||
#define ADC_DIRECTION {1,-1,1,-1, -1,1,-1, 1,-1, -1,-1, 0,0,0}
|
||||
#else
|
||||
#error "Missing ADC_DIRECTION array"
|
||||
#endif
|
||||
|
||||
|
||||
// Power
|
||||
#if defined(RADIO_T18)
|
||||
#define PWR_RCC_AHB1Periph RCC_AHB1Periph_GPIOJ | RCC_AHB1Periph_GPIOB
|
||||
|
||||
Reference in New Issue
Block a user