X10 extra switches sticks (#6423)
[X10] 2 extra sticks switches + 2 extra pots
This commit is contained in:
@@ -107,14 +107,6 @@ extern uint16_t sessionTimer;
|
||||
#define TRAINER_CONNECTED() (GPIO_ReadInputDataBit(TRAINER_DETECT_GPIO, TRAINER_DETECT_GPIO_PIN) == Bit_RESET)
|
||||
#endif
|
||||
|
||||
#if defined(PCBX10)
|
||||
#define NUM_SLIDERS 2
|
||||
#define NUM_PWMSTICKS 4
|
||||
#else
|
||||
#define NUM_SLIDERS 4
|
||||
#define NUM_PWMSTICKS 0
|
||||
#endif
|
||||
|
||||
// Board driver
|
||||
void boardPreInit(void);
|
||||
void boardInit(void);
|
||||
@@ -142,19 +134,6 @@ void delay_ms(uint32_t ms);
|
||||
#define IS_FIRMWARE_COMPATIBLE_WITH_BOARD() (!IS_HORUS_PROD())
|
||||
#endif
|
||||
|
||||
#if NUM_PWMSTICKS > 0
|
||||
PACK(typedef struct {
|
||||
uint8_t sticksPwmDisabled : 1;
|
||||
uint8_t pxx2Enabled : 1;
|
||||
}) HardwareOptions;
|
||||
#else
|
||||
PACK(typedef struct {
|
||||
uint8_t pxx2Enabled : 1;
|
||||
}) HardwareOptions;
|
||||
#endif
|
||||
|
||||
extern HardwareOptions hardwareOptions;
|
||||
|
||||
// SD driver
|
||||
#define BLOCK_SIZE 512 /* Block Size in Bytes */
|
||||
#if !defined(SIMU) || defined(SIMU_DISKIO)
|
||||
@@ -300,8 +279,12 @@ enum EnumSwitches
|
||||
SW_SF,
|
||||
SW_SG,
|
||||
SW_SH,
|
||||
SW_GMBL,
|
||||
SW_GMBR,
|
||||
NUM_SWITCHES
|
||||
};
|
||||
|
||||
#define STORAGE_NUM_SWITCHES 10
|
||||
#define IS_3POS(x) ((x) != SW_SF && (x) != SW_SH)
|
||||
|
||||
enum EnumSwitchesPositions
|
||||
@@ -330,8 +313,20 @@ enum EnumSwitchesPositions
|
||||
SW_SH0,
|
||||
SW_SH1,
|
||||
SW_SH2,
|
||||
SW_SGMBL0,
|
||||
SW_SGMBL1,
|
||||
SW_SGMBL2,
|
||||
SW_SGMBR0,
|
||||
SW_SGMBR1,
|
||||
SW_SGMBR2,
|
||||
NUM_SWITCHES_POSITIONS
|
||||
};
|
||||
|
||||
|
||||
#if defined(__cplusplus)
|
||||
static_assert(NUM_SWITCHES_POSITIONS == NUM_SWITCHES * 3, "Wrong switches positions count");
|
||||
#endif
|
||||
|
||||
void keysInit(void);
|
||||
uint8_t keyState(uint8_t index);
|
||||
uint32_t switchState(uint8_t index);
|
||||
@@ -384,8 +379,26 @@ void watchdogInit(unsigned int duration);
|
||||
#endif
|
||||
|
||||
// ADC driver
|
||||
|
||||
#if defined(PCBX10)
|
||||
#define NUM_POTS 5
|
||||
#else
|
||||
#define NUM_POTS 3
|
||||
#endif
|
||||
|
||||
#define NUM_XPOTS NUM_POTS
|
||||
#define STORAGE_NUM_POTS 5
|
||||
|
||||
#if defined(PCBX10)
|
||||
#define NUM_SLIDERS 2
|
||||
#define NUM_PWMSTICKS 4
|
||||
#else
|
||||
#define NUM_SLIDERS 4
|
||||
#define NUM_PWMSTICKS 0
|
||||
#endif
|
||||
|
||||
#define STORAGE_NUM_SLIDERS 4
|
||||
|
||||
enum Analogs {
|
||||
STICK1,
|
||||
STICK2,
|
||||
@@ -395,7 +408,10 @@ enum Analogs {
|
||||
POT1 = POT_FIRST,
|
||||
POT2,
|
||||
POT3,
|
||||
POT_LAST = POT3,
|
||||
#if defined(PCBX10)
|
||||
EXT1,
|
||||
EXT2,
|
||||
#endif
|
||||
SLIDER_FIRST,
|
||||
SLIDER1 = SLIDER_FIRST,
|
||||
SLIDER2,
|
||||
@@ -410,12 +426,16 @@ enum Analogs {
|
||||
#endif
|
||||
SLIDER_LAST = SLIDER_FIRST + NUM_SLIDERS - 1,
|
||||
TX_VOLTAGE,
|
||||
#if defined(PCBX12S)
|
||||
MOUSE1, // TODO why after voltage?
|
||||
MOUSE2,
|
||||
#endif
|
||||
NUM_ANALOGS,
|
||||
TX_RTC = NUM_ANALOGS
|
||||
};
|
||||
|
||||
#define POT_LAST (SLIDER_FIRST - 1)
|
||||
|
||||
enum CalibratedAnalogs {
|
||||
CALIBRATED_STICK1,
|
||||
CALIBRATED_STICK2,
|
||||
@@ -445,12 +465,13 @@ void adcInit(void);
|
||||
void adcRead(void);
|
||||
uint16_t getRTCBattVoltage();
|
||||
uint16_t getAnalogValue(uint8_t index);
|
||||
#define NUM_MOUSE_ANALOGS 2
|
||||
#if defined(PCBX10)
|
||||
#define NUM_DUMMY_ANAS 2
|
||||
|
||||
#if defined(PCBX12S)
|
||||
#define NUM_MOUSE_ANALOGS 2
|
||||
#else
|
||||
#define NUM_DUMMY_ANAS 0
|
||||
#define NUM_MOUSE_ANALOGS 0
|
||||
#endif
|
||||
#define STORAGE_NUM_MOUSE_ANALOGS 2
|
||||
|
||||
#if NUM_PWMSTICKS > 0
|
||||
#define STICKS_PWM_ENABLED() (!hardwareOptions.sticksPwmDisabled)
|
||||
@@ -636,4 +657,17 @@ extern DMAFifo<512> telemetryFifo;
|
||||
extern DMAFifo<32> serial2RxFifo;
|
||||
#endif
|
||||
|
||||
#if NUM_PWMSTICKS > 0
|
||||
PACK(typedef struct {
|
||||
uint8_t sticksPwmDisabled : 1;
|
||||
uint8_t pxx2Enabled : 1;
|
||||
}) HardwareOptions;
|
||||
#else
|
||||
PACK(typedef struct {
|
||||
uint8_t pxx2Enabled : 1;
|
||||
}) HardwareOptions;
|
||||
#endif
|
||||
|
||||
extern HardwareOptions hardwareOptions;
|
||||
|
||||
#endif // _BOARD_HORUS_H_
|
||||
|
||||
@@ -39,10 +39,6 @@
|
||||
#define KEYS_GPIO_REG_RIGHT GPIOC->IDR
|
||||
#define KEYS_GPIO_PIN_RIGHT GPIO_Pin_4 // PC.04
|
||||
#elif defined(PCBX10)
|
||||
// #define KEYS_GPIO_REG_UNUSED GPIOH->IDR
|
||||
// #define KEYS_GPIO_PIN_UNUSED GPIO_Pin_14 // PH.14
|
||||
// #define KEYS_GPIO_REG_UNUSED GPIOH->IDR
|
||||
// #define KEYS_GPIO_PIN_UNUSED GPIO_Pin_15 // PH.15
|
||||
#define KEYS_GPIO_REG_ENTER GPIOI->IDR
|
||||
#define KEYS_GPIO_PIN_ENTER GPIO_Pin_8 // PI.08
|
||||
#define KEYS_GPIO_REG_PGDN GPIOI->IDR
|
||||
@@ -176,7 +172,7 @@
|
||||
#define KEYS_GPIOD_PINS (SWITCHES_GPIO_PIN_C_H | TRIMS_GPIO_PIN_RHL | TRIMS_GPIO_PIN_RHR | TRIMS_GPIO_PIN_LSD)
|
||||
#define KEYS_GPIOE_PINS (SWITCHES_GPIO_PIN_E_L)
|
||||
#define KEYS_GPIOG_PINS (SWITCHES_GPIO_PIN_D_L | SWITCHES_GPIO_PIN_G_H | SWITCHES_GPIO_PIN_G_L | SWITCHES_GPIO_PIN_H | TRIMS_GPIO_PIN_LVD)
|
||||
#define KEYS_GPIOH_PINS (GPIO_Pin_3 | GPIO_Pin_4 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12) // | GPIO_Pin_14 | GPIO_Pin_15)
|
||||
#define KEYS_GPIOH_PINS (GPIO_Pin_3 | GPIO_Pin_4 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12 | GPIO_Pin_14 | GPIO_Pin_15)
|
||||
#define KEYS_GPIOI_PINS (GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_6 | GPIO_Pin_7 | GPIO_Pin_8 | GPIO_Pin_11 | GPIO_Pin_15)
|
||||
#define KEYS_GPIOJ_PINS (SWITCHES_GPIO_PIN_D_H | TRIMS_GPIO_PIN_LVU | TRIMS_GPIO_PIN_RVD | TRIMS_GPIO_PIN_RVU | TRIMS_GPIO_PIN_LSU)
|
||||
#endif
|
||||
@@ -229,7 +225,7 @@
|
||||
#define PWM_GPIOA_PINS (GPIO_Pin_0 | GPIO_Pin_1 | 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_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
|
||||
@@ -255,7 +251,6 @@
|
||||
// Power
|
||||
#define PWR_RCC_AHB1Periph RCC_AHB1Periph_GPIOJ
|
||||
#define PWR_GPIO GPIOJ
|
||||
#define PWR_SWITCH_GPIO_REG PWR_GPIO->IDR
|
||||
#define PWR_SWITCH_GPIO_PIN GPIO_Pin_0 // PJ.00
|
||||
#define PWR_ON_GPIO_PIN GPIO_Pin_1 // PJ.01
|
||||
|
||||
|
||||
@@ -187,6 +187,8 @@ uint32_t switchState(uint8_t index)
|
||||
ADD_2POS_CASE(F);
|
||||
ADD_3POS_CASE(G, 6);
|
||||
ADD_2POS_CASE(H);
|
||||
ADD_2POS_CASE(GMBL);
|
||||
ADD_2POS_CASE(GMBR);
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -301,8 +301,11 @@ extern "C" {
|
||||
|
||||
// ADC driver
|
||||
#define NUM_POTS 3
|
||||
#define STORAGE_NUM_POTS 3
|
||||
#define NUM_SLIDERS 0
|
||||
#define STORAGE_NUM_SLIDERS 0
|
||||
#define NUM_XPOTS 0
|
||||
#define STORAGE_NUM_MOUSE_ANALOGS 0
|
||||
enum Analogs {
|
||||
STICK1,
|
||||
STICK2,
|
||||
@@ -339,7 +342,6 @@ void adcRead(void);
|
||||
uint16_t getAnalogValue(uint8_t index);
|
||||
void setSticksGain(uint8_t gains);
|
||||
#define NUM_MOUSE_ANALOGS 0
|
||||
#define NUM_DUMMY_ANAS 0
|
||||
|
||||
// Battery driver
|
||||
uint16_t getBatteryVoltage(); // returns current battery voltage in 10mV steps
|
||||
|
||||
@@ -493,10 +493,12 @@ enum Analogs {
|
||||
|
||||
#define NUM_POTS (POT_LAST-POT_FIRST+1)
|
||||
#define NUM_XPOTS NUM_POTS
|
||||
#define STORAGE_NUM_POTS NUM_POTS
|
||||
#define NUM_SLIDERS (TX_VOLTAGE-POT_LAST-1)
|
||||
#define STORAGE_NUM_SLIDERS NUM_SLIDERS
|
||||
#define NUM_TRIMS 4
|
||||
#define NUM_MOUSE_ANALOGS 0
|
||||
#define NUM_DUMMY_ANAS 0
|
||||
#define STORAGE_NUM_MOUSE_ANALOGS 0
|
||||
|
||||
#if defined(STICKS_PWM)
|
||||
#define NUM_PWMSTICKS 4
|
||||
|
||||
Reference in New Issue
Block a user