|
@@ -50,7 +50,7 @@
|
|
|
|
|
|
|
|
|
/*************<variable>***************/
|
|
|
-
|
|
|
+uint8_t g_svstatus = 0;
|
|
|
|
|
|
/*************<prototype>**************/
|
|
|
|
|
@@ -64,7 +64,7 @@
|
|
|
*/
|
|
|
void GPIO_PortInit(void)
|
|
|
{
|
|
|
-
|
|
|
+ /*
|
|
|
GPIO_SetFunc(GPIO_CLOSE_KEY, GPIO_FUN0);
|
|
|
GPIO_SetFunc(GPIO_OPEN_KEY, GPIO_FUN0);
|
|
|
GPIO_SetFunc(GPIO_COVER_KEY, GPIO_FUN0);
|
|
@@ -76,10 +76,11 @@ void GPIO_PortInit(void)
|
|
|
GPIO_SetPullup(GPIO_CLOSE_KEY, ENABLE);
|
|
|
GPIO_SetPullup(GPIO_OPEN_KEY, ENABLE);
|
|
|
GPIO_SetPullup(GPIO_COVER_KEY, ENABLE);
|
|
|
+ */
|
|
|
|
|
|
- //set pin mux uart0
|
|
|
- GPIO_SetFunc(GPIOA, GPIO_PIN7, GPIO_FUN1);
|
|
|
- GPIO_SetFunc(GPIOA, GPIO_PIN8, GPIO_FUN1);
|
|
|
+ //set pin mux uart1
|
|
|
+ GPIO_SetFunc(GPIOA, GPIO_PIN4, GPIO_FUN3);
|
|
|
+ GPIO_SetFunc(GPIOA, GPIO_PIN5, GPIO_FUN3);
|
|
|
|
|
|
|
|
|
/*初始化引脚功能,如果引脚上电后默认为GPIO,可省略掉初始化步骤.
|
|
@@ -89,8 +90,51 @@ void GPIO_PortInit(void)
|
|
|
|
|
|
GPIO_SetFunc(RUNLED_PORT, RUNLED_PIN, GPIO_FUN0);
|
|
|
GPIO_SetDir(RUNLED_PORT, RUNLED_PIN, GPIO_OUT);
|
|
|
+
|
|
|
+ GPIO_SetFunc(SV1_PORT, SV1_PIN, GPIO_FUN0);
|
|
|
+ GPIO_SetDir(SV1_PORT, SV1_PIN, GPIO_OUT);
|
|
|
+
|
|
|
+ GPIO_SetFunc(SV2_PORT, SV2_PIN, GPIO_FUN0);
|
|
|
+ GPIO_SetDir(SV2_PORT, SV2_PIN, GPIO_OUT);
|
|
|
+
|
|
|
+ GPIO_SetFunc(SV3_PORT, SV3_PIN, GPIO_FUN0);
|
|
|
+ GPIO_SetDir(SV3_PORT, SV3_PIN, GPIO_OUT);
|
|
|
+
|
|
|
+ GPIO_SetFunc(SV4_PORT, SV4_PIN, GPIO_FUN0);
|
|
|
+ GPIO_SetDir(SV4_PORT, SV4_PIN, GPIO_OUT);
|
|
|
+
|
|
|
+ GPIO_SetPinLevel(SV1_PORT, SV1_PIN, SV_CLOSE);
|
|
|
+ GPIO_SetPinLevel(SV2_PORT, SV2_PIN, SV_CLOSE);
|
|
|
+ GPIO_SetPinLevel(SV3_PORT, SV3_PIN, SV_CLOSE);
|
|
|
+ GPIO_SetPinLevel(SV4_PORT, SV4_PIN, SV_CLOSE);
|
|
|
+
|
|
|
+ g_svstatus = 0x00;
|
|
|
+
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+void Sv_Control(uint8_t id, uint8_t action)
|
|
|
+{
|
|
|
+ if(id >= SV_ALL){
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(SV_OPEN == action){
|
|
|
+ g_svstatus |= (1 << id);
|
|
|
|
|
|
+ }else{
|
|
|
+ g_svstatus &= ~(1 << id);
|
|
|
+ }
|
|
|
|
|
|
+ if(SV_01 == id){
|
|
|
+ GPIO_SetPinLevel(SV1_PORT, SV1_PIN, action);
|
|
|
+ }else if(SV_02 == id){
|
|
|
+ GPIO_SetPinLevel(SV2_PORT, SV2_PIN, action);
|
|
|
+ }else if(SV_03 == id){
|
|
|
+ GPIO_SetPinLevel(SV3_PORT, SV3_PIN, action);
|
|
|
+ }else if(SV_04 == id){
|
|
|
+ GPIO_SetPinLevel(SV4_PORT, SV4_PIN, action);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|