| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575 |
- #include "drivers/keycontrol/keycontrol_ll.h"
- #include "drivers/keycontrol/keycontrol_ll_encoding.h"
- #include "core/gpio.h"
- #include "core/csect.h"
- #include "core/config_pins.h"
- #include "core/main.h" // HAL_Wait_us
- #include <stdint.h>
- #include <stddef.h>
- #define SUPPORT_SERIAL_REGISTER_1 0
- #define SUPPORT_SERIAL_REGISTER_2 0
- // LowLevel KeyControl version ACM2543.1
- //
- // [3] [4] VDD VSS | Logic Port Desc
- // HEADER #1 (o) (o) (o) (o) | PCB HOLE
- // *p1 *p2 *p3 *p4 | Legend index
- // -----------------------------------------------------+
- // VSS VDD [1] [2] | Logic Port Desc
- // HEADER #2 (o) (o) (o) (o) | PCB HOLE
- // *p5 *p6 *p7 *p8 | Legend index
- // Legend:
- // p1 - ST_VCTRL1_ADRF3_1, #12, PA2, [Line3]
- // p2 - ST_VCTRL2_ADRF3_1, #11, PA1, [Line4]
- // p3 - VDD_ADRF3_1
- // p4 - VSS_ADRF4_1
- // p5 - VSS_ADRF3_1
- // p6 - VDD_ADRF4_1
- // p7 - ST_VCTRL1_ADRF4_1, #39, PB3, [Line1]
- // p8 - ST_VCTRL2_ADRF4_1, #40, PB4, [Line2]
- static bool KeySwitch_Init( eKeySwitchControlMode_t mode );
- static bool KeySwitch_SetKeyCode( tKeySwitchCode_t code );
- static bool AmpSwitch_SetAmpCode( tKeySwitchCode_t code );
- static bool FiltSwitch_SetFiltCode( tKeySwitchCode_t code );
- static bool KeySwitch_SetKeyCodeParallel( tKeySwitchCode_t code );
- static bool KeySwitch_SetKeyCodeSerial( tKeySwitchCode_t code );
- static bool BandSwitch_SetBandCodeParallel( tKeySwitchCode_t code );
- static bool GainSwitch_SetGainCodeParallel( tKeySwitchCode_t code );
- #if SUPPORT_SERIAL_REGISTER_1
- static bool KeySwitch_SetKeyCodeSerial_Register1( tKeySwitchCode_t code );
- #endif
- #if SUPPORT_SERIAL_REGISTER_2
- static bool KeySwitch_SetKeyCodeSerial_Register2( tKeySwitchCode_t code );
- #endif
- static bool KeySwitch_GetKeyCode( tKeySwitchCode_t * pcode );
- static bool AmpSwitch_GetAmpCode( tKeySwitchCode_t * pcode );
- static bool FiltSwitch_GetFiltCode( tKeySwitchCode_t * pcode );
- static void KeySwitch_DeInit();
- static tKeySwitchCode_t keyCode = 0;
- static bool bInitialized = false;
- static eKeySwitchControlMode_t xMode = eSwCtlMode_default;
- typedef enum
- {
- eLLKeySw_IOLine_1,
- eLLKeySw_IOLine_2,
- eLLKeySw_IOLine_3,
- eLLKeySw_IOLine_4,
- eLLKeySw_IOLine_5,
- eLLKeySw_IOLine_6,
- }
- e_LLKeySwitch_IOLines_t;
- #if SUPPORT_SERIAL_REGISTER_1
- #define Register1_IOLine_Shift (eLLKeySw_IOLine_3)
- #define Register1_IOLine_Store (eLLKeySw_IOLine_2)
- #define Register1_IOLine_Data (eLLKeySw_IOLine_1)
- #endif
- #if SUPPORT_SERIAL_REGISTER_2
- #define Register2_IOLine_Shift (eLLKeySw_IOLine_3)
- #define Register2_IOLine_Store (eLLKeySw_IOLine_2)
- #define Register2_IOLine_Data (eLLKeySw_IOLine_1)
- #endif
- static void LL_KeySwitch_SetIOLine( e_LLKeySwitch_IOLines_t port, bool state );
- const sKeySwitchControlLL_t KeyControlLLHandle =
- {
- .Init = KeySwitch_Init,
- .SetKeyCode = KeySwitch_SetKeyCode,
- .SetAmpCode = AmpSwitch_SetAmpCode,
- .SetFiltCode = FiltSwitch_SetFiltCode,
- .GetKeyCode = KeySwitch_GetKeyCode,
- .GetAmpCode = AmpSwitch_GetAmpCode,
- .GetFiltCode = FiltSwitch_GetFiltCode,
- .DeInit = KeySwitch_DeInit
- };
-
- static bool KeySwitch_Init( eKeySwitchControlMode_t mode )
- {
- DI();
- xMode = mode;
- // Configure GPIO pins for KeySwitch control
- #if CONFIG_PORT__SINGLEPORTINIT
- {
- GPIO_InitTypeDef GPIO_InitStruct = {0};
- switch(xMode)
- {
- case eSwCtlMode_6line:
- GPIO_InitStruct.Pin = CONFIG_PIN__SWKEYPP_L1|CONFIG_PIN__SWKEYPP_L2|CONFIG_PIN__SWKEYPP_L3|CONFIG_PIN__SWKEYPP_L4|CONFIG_PIN__SWKEYPP_L5|CONFIG_PIN__SWKEYPP_L6;
- break;
- case eSwCtlMode_4line:
- default:
- GPIO_InitStruct.Pin = CONFIG_PIN__SWKEYPP_L1|CONFIG_PIN__SWKEYPP_L2|CONFIG_PIN__SWKEYPP_L3|CONFIG_PIN__SWKEYPP_L4;
- break;
- }
- GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
- GPIO_InitStruct.Pull = GPIO_NOPULL;
- GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
- HAL_GPIO_Init(CONFIG_PORT__SWKEYPP_L1, &GPIO_InitStruct);
- }
- #else
- {
- GPIO_InitTypeDef GPIO_InitStruct = {0};
- GPIO_InitStruct.Pin = CONFIG_PIN__SWKEYPP_L1;
- GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
- GPIO_InitStruct.Pull = GPIO_NOPULL;
- GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
- HAL_GPIO_Init(CONFIG_PORT__SWKEYPP_L1, &GPIO_InitStruct);
- }
- {
- GPIO_InitTypeDef GPIO_InitStruct = {0};
- GPIO_InitStruct.Pin = CONFIG_PIN__SWKEYPP_L2;
- GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
- GPIO_InitStruct.Pull = GPIO_NOPULL;
- GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
- HAL_GPIO_Init(CONFIG_PORT__SWKEYPP_L2, &GPIO_InitStruct);
- }
- {
- GPIO_InitTypeDef GPIO_InitStruct = {0};
- GPIO_InitStruct.Pin = CONFIG_PIN__SWKEYPP_L3;
- GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
- GPIO_InitStruct.Pull = GPIO_NOPULL;
- GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
- HAL_GPIO_Init(CONFIG_PORT__SWKEYPP_L3, &GPIO_InitStruct);
- }
- {
- GPIO_InitTypeDef GPIO_InitStruct = {0};
- GPIO_InitStruct.Pin = CONFIG_PIN__SWKEYPP_L4;
- GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
- GPIO_InitStruct.Pull = GPIO_NOPULL;
- GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
- HAL_GPIO_Init(CONFIG_PORT__SWKEYPP_L4, &GPIO_InitStruct);
- }
- if( xMode == eSwCtlMode_5line )
- {
- {
- GPIO_InitTypeDef GPIO_InitStruct = {0};
- GPIO_InitStruct.Pin = CONFIG_PIN__SWKEYPP_L5;
- GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
- GPIO_InitStruct.Pull = GPIO_NOPULL;
- GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
- HAL_GPIO_Init(CONFIG_PORT__SWKEYPP_L5, &GPIO_InitStruct);
- }
- }
- if( xMode == eSwCtlMode_6line )
- {
- {
- GPIO_InitTypeDef GPIO_InitStruct = {0};
- GPIO_InitStruct.Pin = CONFIG_PIN__SWKEYPP_L5;
- GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
- GPIO_InitStruct.Pull = GPIO_NOPULL;
- GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
- HAL_GPIO_Init(CONFIG_PORT__SWKEYPP_L5, &GPIO_InitStruct);
- }
- {
- GPIO_InitTypeDef GPIO_InitStruct = {0};
- GPIO_InitStruct.Pin = CONFIG_PIN__SWKEYPP_L6;
- GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
- GPIO_InitStruct.Pull = GPIO_NOPULL;
- GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
- HAL_GPIO_Init(CONFIG_PORT__SWKEYPP_L6, &GPIO_InitStruct);
- }
- }
- #endif
- bInitialized = true;
- EI();
- return true;
- }
- static bool KeySwitch_SetKeyCode( tKeySwitchCode_t code )
- {
- // Check the control type:
- if( CHECK_CONTROL_TYPE_REGISTER( code ) )
- {
- // Serial control (registers)
- return KeySwitch_SetKeyCodeSerial( code );
- }
-
- // Parallel control
- return KeySwitch_SetKeyCodeParallel( code );
-
- }
-
- static bool AmpSwitch_SetAmpCode( tKeySwitchCode_t code )
- {
- // Check the control type:
- if( CHECK_CONTROL_TYPE_REGISTER( code ) )
- {
- // Serial control (registers)
- return KeySwitch_SetKeyCodeSerial( code );
- }
-
- // Parallel control
- return GainSwitch_SetGainCodeParallel( code );
-
- }
-
- static bool FiltSwitch_SetFiltCode( tKeySwitchCode_t code )
- {
- // Check the control type:
- if( CHECK_CONTROL_TYPE_REGISTER( code ) )
- {
- // Serial control (registers)
- return KeySwitch_SetKeyCodeSerial( code );
- }
-
- // Parallel control
- return BandSwitch_SetBandCodeParallel( code );
-
- }
- static bool KeySwitch_SetKeyCodeParallel( tKeySwitchCode_t code )
- {
- bool set = true;
- DI();
- if( bInitialized )
- {
- // IOLine#1 = code.bit[6]
- // IOLine#2 = code.bit[7]
- // IOLine#3 = code.bit[8]
- // IOLine#4 = code.bit[9]
- LL_KeySwitch_SetIOLine( eLLKeySw_IOLine_1, (code & (1ul<<6)) );
- LL_KeySwitch_SetIOLine( eLLKeySw_IOLine_2, (code & (1ul<<7)) );
- LL_KeySwitch_SetIOLine( eLLKeySw_IOLine_3, (code & (1ul<<8)) );
- LL_KeySwitch_SetIOLine( eLLKeySw_IOLine_4, (code & (1ul<<9)) );
- if(xMode == eSwCtlMode_5line)
- {
- LL_KeySwitch_SetIOLine( eLLKeySw_IOLine_5, (code & (1ul<<10)));
- }
- if(xMode == eSwCtlMode_6line )
- {
- LL_KeySwitch_SetIOLine( eLLKeySw_IOLine_5, (code & (1ul<<10)));
- LL_KeySwitch_SetIOLine( eLLKeySw_IOLine_6, (code & (1ul<<11)));
- }
- keyCode = code;
- }
- else
- {
- set = false;
- }
- EI();
- return set;
- }
-
- static bool BandSwitch_SetBandCodeParallel( tKeySwitchCode_t code )
- {
- bool set = true;
- DI();
- if( bInitialized )
- {
- LL_KeySwitch_SetIOLine( eLLKeySw_IOLine_1, (code & (1ul<<6)) ); // CTRL-ADRFV1_ON
- LL_KeySwitch_SetIOLine( eLLKeySw_IOLine_2, (code & (1ul<<7)) ); // CTRL-ADRFV2_ON
- keyCode = code;
- }
- else
- {
- set = false;
- }
- EI();
- return set;
- }
-
- static bool GainSwitch_SetGainCodeParallel( tKeySwitchCode_t code )
- {
- bool set = true;
- DI();
- if( bInitialized )
- {
- LL_KeySwitch_SetIOLine( eLLKeySw_IOLine_3, (code & (1ul<<8)) ); // CTRL-HMCV1_ON
- LL_KeySwitch_SetIOLine( eLLKeySw_IOLine_4, (code & (1ul<<9)) ); // CTRL-HMCV2_ON
- if(xMode == eSwCtlMode_5line)
- {
- LL_KeySwitch_SetIOLine( eLLKeySw_IOLine_5, (code & (1ul<<10))); // CTRL-HMCV3_ON
- }
- keyCode = code;
- }
- else
- {
- set = false;
- }
- EI();
- return set;
- }
- #if SUPPORT_SERIAL_REGISTER_1
- static bool KeySwitch_SetKeyCodeSerial_Register1( tKeySwitchCode_t code )
- {
- // Idle
- __DI__
- LL_KeySwitch_SetIOLine( Register1_IOLine_Shift, false );
- LL_KeySwitch_SetIOLine( Register1_IOLine_Store, false );
- LL_KeySwitch_SetIOLine( Register1_IOLine_Data, false );
- __EI__
-
- // DataOut
- uint8_t value = GET_CONTROL_REGISTER_1( code );
- for( int32_t i = 7; i>=0; i-- )
- {
- LL_KeySwitch_SetIOLine( Register1_IOLine_Shift, false );
- LL_KeySwitch_SetIOLine( Register1_IOLine_Data, (value & (1ul<<i)) );
- HAL_Wait_us( SystemCoreClock / 1000000 ); // 1MHz
- LL_KeySwitch_SetIOLine( Register1_IOLine_Shift, true );
- HAL_Wait_us( SystemCoreClock / 1000000 ); // 1MHz
- LL_KeySwitch_SetIOLine( Register1_IOLine_Shift, false );
- }
- // Store
- __DI__
- HAL_Wait_us( SystemCoreClock / 1000000 ); // 1MHz
- LL_KeySwitch_SetIOLine( Register1_IOLine_Store, true );
- HAL_Wait_us( SystemCoreClock / 1000000 ); // 1MHz
- LL_KeySwitch_SetIOLine( Register1_IOLine_Store, false );
- __EI__
-
- // Idle
- __DI__
- LL_KeySwitch_SetIOLine( Register1_IOLine_Shift, false );
- LL_KeySwitch_SetIOLine( Register1_IOLine_Store, false );
- LL_KeySwitch_SetIOLine( Register1_IOLine_Data, false );
- __EI__
- return true;
- }
- #endif
- #if SUPPORT_SERIAL_REGISTER_2
- static bool KeySwitch_SetKeyCodeSerial_Register2( tKeySwitchCode_t code )
- {
- // Idle
- __DI__
- LL_KeySwitch_SetIOLine( Register2_IOLine_Shift, false );
- LL_KeySwitch_SetIOLine( Register2_IOLine_Store, false );
- LL_KeySwitch_SetIOLine( Register2_IOLine_Data, false );
- __EI__
-
- // DataOut
- uint8_t value = GET_CONTROL_REGISTER_2( code );
- for( int32_t i = 7; i>=0; i-- )
- {
- LL_KeySwitch_SetIOLine( Register2_IOLine_Shift, false );
- LL_KeySwitch_SetIOLine( Register2_IOLine_Data, (value & (1ul<<i)) );
- HAL_Wait_us( SystemCoreClock / 1000000 ); // 1MHz
- LL_KeySwitch_SetIOLine( Register2_IOLine_Shift, true );
- HAL_Wait_us( SystemCoreClock / 1000000 ); // 1MHz
- LL_KeySwitch_SetIOLine( Register2_IOLine_Shift, false );
- }
- // Store
- __DI__
- HAL_Wait_us( SystemCoreClock / 1000000 ); // 1MHz
- LL_KeySwitch_SetIOLine( Register2_IOLine_Store, true );
- HAL_Wait_us( SystemCoreClock / 1000000 ); // 1MHz
- LL_KeySwitch_SetIOLine( Register2_IOLine_Store, false );
- __EI__
-
- // Idle
- __DI__
- LL_KeySwitch_SetIOLine( Register2_IOLine_Shift, false );
- LL_KeySwitch_SetIOLine( Register2_IOLine_Store, false );
- LL_KeySwitch_SetIOLine( Register2_IOLine_Data, false );
- __EI__
- return true;
- }
- #endif
- static bool KeySwitch_SetKeyCodeSerial( tKeySwitchCode_t code )
- {
- bool set = true;
- DI();
- if( bInitialized )
- {
- EI();
-
- #if SUPPORT_SERIAL_REGISTER_1
- if( CHECK_CONTROL_REGISTER_1(code) )
- set = set && KeySwitch_SetKeyCodeSerial_Register1(code);
- #endif
- #if SUPPORT_SERIAL_REGISTER_2
- if( CHECK_CONTROL_REGISTER_2(code) )
- set = set && KeySwitch_SetKeyCodeSerial_Register2(code);
- #endif
- if( set )
- keyCode = code;
- }
- else
- {
- EI();
- set = false;
- }
- return set;
- }
- static void LL_KeySwitch_SetIOLine( e_LLKeySwitch_IOLines_t port, bool state )
- {
- switch( port )
- {
- // LogicPort #1
- case eLLKeySw_IOLine_1: HAL_GPIO_WritePin( CONFIG_PORT__SWKEYPP_L1, CONFIG_PIN__SWKEYPP_L1, ((state)?GPIO_PIN_SET:GPIO_PIN_RESET) );
- break;
- // LogicPort #2
- case eLLKeySw_IOLine_2: HAL_GPIO_WritePin( CONFIG_PORT__SWKEYPP_L2, CONFIG_PIN__SWKEYPP_L2, ((state)?GPIO_PIN_SET:GPIO_PIN_RESET) );
- break;
- // LogicPort #3
- case eLLKeySw_IOLine_3: HAL_GPIO_WritePin( CONFIG_PORT__SWKEYPP_L3, CONFIG_PIN__SWKEYPP_L3, ((state)?GPIO_PIN_SET:GPIO_PIN_RESET) );
- break;
- // LogicPort #4
- case eLLKeySw_IOLine_4: HAL_GPIO_WritePin( CONFIG_PORT__SWKEYPP_L4, CONFIG_PIN__SWKEYPP_L4, ((state)?GPIO_PIN_SET:GPIO_PIN_RESET) );
- break;
- // LogicPort #5
- case eLLKeySw_IOLine_5: HAL_GPIO_WritePin( CONFIG_PORT__SWKEYPP_L5, CONFIG_PIN__SWKEYPP_L5, ((state)?GPIO_PIN_SET:GPIO_PIN_RESET) );
- break;
- // LogicPort #6
- case eLLKeySw_IOLine_6: HAL_GPIO_WritePin( CONFIG_PORT__SWKEYPP_L6, CONFIG_PIN__SWKEYPP_L6, ((state)?GPIO_PIN_SET:GPIO_PIN_RESET) );
- break;
- }
-
- }
-
- static bool KeySwitch_GetKeyCode( tKeySwitchCode_t * pcode )
- {
- if( pcode )
- {
- __DI__ *pcode = keyCode; __EI__
- return true;
- }
- return false;
- }
-
- static bool AmpSwitch_GetAmpCode( tKeySwitchCode_t * pcode )
- {
- if( pcode )
- {
- __DI__ *pcode = keyCode; __EI__
- return true;
- }
- return false;
- }
-
- static bool FiltSwitch_GetFiltCode( tKeySwitchCode_t * pcode )
- {
- if( pcode )
- {
- __DI__ *pcode = keyCode; __EI__
- return true;
- }
- return false;
- }
- static void KeySwitch_DeInit()
- {
- DI();
- bInitialized = false;
- #if CONFIG_PORT__SINGLEPORTINIT
- {
- GPIO_InitTypeDef GPIO_InitStruct = {0};
- // Configure GPIO pins for KeySwitch control
- switch(xMode)
- {
- case eSwCtlMode_6line:
- GPIO_InitStruct.Pin = CONFIG_PIN__SWKEYPP_L1|CONFIG_PIN__SWKEYPP_L2|CONFIG_PIN__SWKEYPP_L3|CONFIG_PIN__SWKEYPP_L4|CONFIG_PIN__SWKEYPP_L5|CONFIG_PIN__SWKEYPP_L6;
- break;
- case eSwCtlMode_4line:
- default:
- GPIO_InitStruct.Pin = CONFIG_PIN__SWKEYPP_L1|CONFIG_PIN__SWKEYPP_L2|CONFIG_PIN__SWKEYPP_L3|CONFIG_PIN__SWKEYPP_L4;
- break;
- }
- }
- GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
- GPIO_InitStruct.Pull = GPIO_NOPULL;
- GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
- HAL_GPIO_Init(CONFIG_PORT__SWKEYPP_L1, &GPIO_InitStruct);
- }
- #else
- {
- GPIO_InitTypeDef GPIO_InitStruct = {0};
- // Configure GPIO pins for KeySwitch control
- GPIO_InitStruct.Pin = CONFIG_PIN__SWKEYPP_L1;
- GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
- GPIO_InitStruct.Pull = GPIO_NOPULL;
- GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
- HAL_GPIO_Init(CONFIG_PORT__SWKEYPP_L1, &GPIO_InitStruct);
- }
- {
- GPIO_InitTypeDef GPIO_InitStruct = {0};
- // Configure GPIO pins for KeySwitch control
- GPIO_InitStruct.Pin = CONFIG_PIN__SWKEYPP_L2;
- GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
- GPIO_InitStruct.Pull = GPIO_NOPULL;
- GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
- HAL_GPIO_Init(CONFIG_PORT__SWKEYPP_L2, &GPIO_InitStruct);
- }
- {
- GPIO_InitTypeDef GPIO_InitStruct = {0};
- // Configure GPIO pins for KeySwitch control
- GPIO_InitStruct.Pin = CONFIG_PIN__SWKEYPP_L3;
- GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
- GPIO_InitStruct.Pull = GPIO_NOPULL;
- GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
- HAL_GPIO_Init(CONFIG_PORT__SWKEYPP_L3, &GPIO_InitStruct);
- }
- {
- GPIO_InitTypeDef GPIO_InitStruct = {0};
- // Configure GPIO pins for KeySwitch control
- GPIO_InitStruct.Pin = CONFIG_PIN__SWKEYPP_L4;
- GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
- GPIO_InitStruct.Pull = GPIO_NOPULL;
- GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
- HAL_GPIO_Init(CONFIG_PORT__SWKEYPP_L4, &GPIO_InitStruct);
- }
- if( xMode == eSwCtlMode_6line )
- {
- {
- GPIO_InitTypeDef GPIO_InitStruct = {0};
- // Configure GPIO pins for KeySwitch control
- GPIO_InitStruct.Pin = CONFIG_PIN__SWKEYPP_L5;
- GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
- GPIO_InitStruct.Pull = GPIO_NOPULL;
- GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
- HAL_GPIO_Init(CONFIG_PORT__SWKEYPP_L5, &GPIO_InitStruct);
- }
- {
- GPIO_InitTypeDef GPIO_InitStruct = {0};
- // Configure GPIO pins for KeySwitch control
- GPIO_InitStruct.Pin = CONFIG_PIN__SWKEYPP_L6;
- GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
- GPIO_InitStruct.Pull = GPIO_NOPULL;
- GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
- HAL_GPIO_Init(CONFIG_PORT__SWKEYPP_L6, &GPIO_InitStruct);
- }
- }
- #endif
- xMode = eSwCtlMode_default;
- EI();
- }
|