#include "uio.h" #include "board.h" volatile unsigned char uiosBitStatus; unsigned char gtFlashSpeed=20; UIO_SWENUM uiosCtl[UIO_MAX]; short uioTick[UIO_MAX]; static void uioUpdateStatus(UIO_TYPEENUM uioType, UIO_STATUSENUM newStatus); static void newIoStatus(UIO_TYPEENUM value,UIO_SWENUM swType) { if(swType == uiosCtl[value]) return; uiosCtl[value]=swType; ; switch (uiosCtl[value]) { case UIO_SW_KEEP_HIGH://保持常高 case UIO_SW_KEEP_LOW: //保持常低 uioTick[value]=0; break; case UIO_SW_FLASH_FAST: uioTick[value]=gtFlashSpeed; break; case UIO_SW_FLASH_SLOW: uioTick[value]=50; break; } uioUpdateStatus(value,UIO_LOW);//切换状态后让灯先灭 } void uioStatusSet(UIO_INDENUM status){ switch(status){ case UIO_INDRX: newIoStatus(UIO_LED_RED, UIO_SW_KEEP_LOW); newIoStatus(UIO_LED_GREEN, UIO_SW_KEEP_HIGH); break; case UIO_INDTX: newIoStatus(UIO_LED_RED, UIO_SW_KEEP_HIGH); newIoStatus(UIO_LED_GREEN, UIO_SW_KEEP_LOW); break; case UIO_INDGT: gtFlashSpeed=10; newIoStatus(UIO_LED_RED, UIO_SW_FLASH_FAST); newIoStatus(UIO_LED_GREEN, UIO_SW_FLASH_FAST); uioTick[UIO_LED_GREEN]=gtFlashSpeed/2;//GT模式下经绿灯快闪错开一下 break; case UIO_INDONLINE: newIoStatus(UIO_LED_RED, UIO_SW_KEEP_LOW); newIoStatus(UIO_LED_GREEN, UIO_SW_FLASH_SLOW); break; case UIO_INDOFFLINE: newIoStatus(UIO_LED_RED, UIO_SW_KEEP_LOW); newIoStatus(UIO_LED_GREEN, UIO_SW_FLASH_FAST); break; } } void uioStatusInit(void){ newIoStatus(UIO_LED_RED, UIO_SW_KEEP_HIGH); newIoStatus(UIO_LED_GREEN, UIO_SW_KEEP_LOW); } static void uioUpdateStatus(UIO_TYPEENUM uioType, UIO_STATUSENUM newStatus){ UIO_STATUSENUM lastBitStatus; if(uiosBitStatus & (1<