M12-04P/hwCtrl.c

48 lines
732 B
C
Raw Normal View History

2023-03-07 15:12:00 +08:00
#include "hwCtrl.h"
#include "r_cg_port.h"
#include "iodefine.h"
#include "appTask.h"
2023-03-08 17:09:22 +08:00
#define IO_KEY_RESET P2_bit.no2
#define IO_RLY_CTRL1 P1_bit.no0
2023-03-11 17:08:25 +08:00
#define IO_RLY_CTRL2 P1_bit.no4
2023-03-07 15:12:00 +08:00
extern uint16_t g_AdVal[3];
2023-03-08 17:09:22 +08:00
uint8_t GetKeyState(uint8_t keyno)
2023-03-07 15:12:00 +08:00
{
2023-03-08 17:09:22 +08:00
switch (keyno)
2023-03-07 15:12:00 +08:00
{
2023-03-08 17:09:22 +08:00
case KEY_RESET:
return IO_KEY_RESET==0?1:0;
2023-03-07 15:12:00 +08:00
break;
default:
2023-03-08 17:09:22 +08:00
return 0;
2023-03-07 15:12:00 +08:00
break;
}
}
2023-03-08 17:09:22 +08:00
void MotorCtrl(uint8_t act)
2023-03-07 15:12:00 +08:00
{
2023-03-08 17:09:22 +08:00
switch (act)
2023-03-07 15:12:00 +08:00
{
2023-03-08 17:09:22 +08:00
case MOTOR_ZZ:
IO_RLY_CTRL1 = 1;
IO_RLY_CTRL2 = 0;
2023-03-07 15:12:00 +08:00
break;
2023-03-08 17:09:22 +08:00
case MOTOR_FZ:
IO_RLY_CTRL1 = 0;
IO_RLY_CTRL2 = 1;
2023-03-07 15:12:00 +08:00
break;
default:
2023-03-08 17:09:22 +08:00
IO_RLY_CTRL1 = 0;
IO_RLY_CTRL2 = 0;
2023-03-07 15:12:00 +08:00
break;
}
2023-03-08 17:09:22 +08:00
2023-03-07 15:12:00 +08:00
}