-
Notifications
You must be signed in to change notification settings - Fork 0
/
HWfunc.ino
74 lines (60 loc) · 1.39 KB
/
HWfunc.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*! @file HWfunc.ino
@author Ing. M.Lampugnani
@par Company:
MyCompany
@version 0.0.1
@date 21th October 2011 */
//! Init LED status (GREEN)
void initStatus(){
pinMode(STATUS_PIN,OUTPUT);
}
//! Init LED ENABLE (YELLOW)
void initEnable(){
pinMode(ENABLE_PIN,OUTPUT);
}
//! Blinking led Status.
/*! Connected to pin def::STATUS_PIN */
void blinkStatus(){
digitalWrite( STATUS_PIN,!digitalRead(STATUS_PIN) );
}
//! Blinking led ENABLE
/*! Connected to pin def::ENABLE_PIN */
void blinkEnable(){
digitalWrite( ENABLE_PIN,!digitalRead(ENABLE_PIN) );
}
//! Action led ENABLE
/*! Connected to pin def::ENABLE_PIN */
void blinkEnable(char action){
switch(action){
case -127:
DBGp_ERR(1,"blinkERR:%u",action);
break;
case 0:
digitalWrite( ENABLE_PIN,LOW );
break;
case 1:
digitalWrite( ENABLE_PIN,HIGH );
break;
}
}
void blinkAll(){
blinkStatus();
blinkEnable();
}
//! CheckShutDown function
/*! Configured by external command and called by func::TSKlog() */
void chkSHUTdn(){
if(tickTIMER == 1){ //! Shutdown light --> go to define::STAT_OFF
led_off();
blinkEnable(0);
tickTIMER--;
system_stat = STAT_OFF;
DBGp_STAT(0,"Shutting Down Now\n", tickTIMER);
}
else if(tickTIMER > 1){ //! Decrease the value count
tickTIMER--;
DBGp_STAT(2,"%u tick to ShutDown\n", tickTIMER);
}
else{ //! Do nothing
}
}