aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Modules/General/buttons.h
blob: 6a15d3765b6bedbe94be8f0fd86537008bac5aa9 (plain)
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
#ifndef BUTTONS_H
#define BUTTONS_H

typedef enum
{
    RELEASE = 0,
    PRESS //press
} PB_Status;

typedef enum
{
    colorOFF = 0,
    colorON,
    BLINK,
    fastBILNK,
    BREATHING
} PBcolor;

typedef enum
{
    OFFPB = 0, //notCOUNT
    COUNTPB ,
    SHORTPB ,
    LONGPB  ,
    REPLONGPB //repeat long PB
}PBstat;

typedef enum
{
    sttOFF = 0,
    sttON,
    sttIDLE,

    sttDISABLE,
    sttENABLE,
    sttJOGGING,
    sttLONG_JOGGING,

    sttRDY,
    sttPRELOAD,
    sttLOADING,
    sttLOADSUCSESS,
    sttLOADFAIL
} PBmachineState;

typedef struct Button
{
    char        bttn_name[10];  //option
    PB_Status   bttn_status;    // 0=RELEASE 1=PRESS
    PBstat      Action;         // enum : offPB,shortPB,longPB,countPB,replongPB
    PBcolor     color;          // enum : off, blue, blink, bithing
    PBmachineState state;    // enum : sttOFF, sttON, sttDISABLE, sttENABLE, sttIDLE, sttJOGGING
    uint32_t count;
}button;

extern button power, jog, load, cart1, cart2, cart3;

uint32_t Buttons_Init(void);
uint32_t Button_load_Init(void);
uint32_t Button_JOG_Init(void);
bool SetPowerMachineState(PBmachineState state);




#endif