BLSJ/bl_zc/hwCtrl.c
2025-01-17 15:39:34 +08:00

73 lines
953 B
C

#include "hwCtrl.h"
#include "r_cg_port.h"
#include "iodefine.h"
#define IO_KEYUP P1_bit.no4
#define IO_KEYDOWN P1_bit.no0
#define IO_KEYAUTO P1_bit.no2
#define IO_OUT1 P2_bit.no0
#define IO_OUT2 P4_bit.no2
#define IO_MOS P2_bit.no1
void RLY1_Ctrl(uint8_t onoff)
{
if (onoff == ON)
{
IO_OUT1 = 1;
}
else
{
IO_OUT1 = 0;
}
}
void RLY2_Ctrl(uint8_t onoff)
{
if (onoff == ON)
{
IO_OUT2 = 1;
}
else
{
IO_OUT2 = 0;
}
}
void MOS_Ctrl(uint8_t onoff)
{
if (onoff == ON)
{
IO_MOS = 1;
}
else
{
IO_MOS = 0;
}
}
uint8_t GetKeyState(uint8_t keyno)
{
switch (keyno)
{
case KEY_DOWN:
return IO_KEYUP;
break;
case KEY_UP:
return IO_KEYDOWN;
break;
case KEY_AUTO:
return IO_KEYAUTO;
break;
default:
return 0;
break;
}
}