Subversion Repositories HomeAutomation

Rev

Rev 611 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 611 Rev 618
Line 58... Line 58...
58
   
58
   
59
    uint8_t state=STATE_IDLE;
59
    uint8_t state=STATE_IDLE;
60
    uint8_t repeatcnt=0;
60
    uint8_t repeatcnt=0;
61
    uint8_t stop=0;
61
    uint8_t stop=0;
62
    Ir_Protocol_Data_t proto;
62
    Ir_Protocol_Data_t proto;
63
    proto.timeout=0; proto.data=0; proto.repeats=0; proto.protocol=0;
63
    proto.timeout=0; proto.data=0; proto.repeats=0; proto.protocol=0; proto.framecnt = 0;
64
    uint8_t len=0;
64
    uint8_t len=0;
65
   
65
   
66
    uint16_t txbuffer[MAX_NR_TIMES];
66
    uint16_t txbuffer[MAX_NR_TIMES];
67
   
67
   
68
    while (1) {
68
    while (1) {
Line 85... Line 85...
85
        } else if (state == STATE_START_PAUSE) {
85
        } else if (state == STATE_START_PAUSE) {
86
            if (repeatcnt<proto.repeats) {
86
            if (repeatcnt<proto.repeats) {
87
                repeatcnt++;
87
                repeatcnt++;
88
            }
88
            }
89
            timePauseStarted = Timebase_CurrentTime();
89
            timePauseStarted = Timebase_CurrentTime();
-
 
90
            if (proto.framecnt != 255) {
-
 
91
                proto.framecnt++;
-
 
92
            }
90
            state = STATE_PAUSING;
93
            state = STATE_PAUSING;
91
        } else if (state == STATE_PAUSING) {
94
        } else if (state == STATE_PAUSING) {
92
            //när timeout har gått (timebase) så gå till STATE_START_TRANSMIT
95
            //när timeout har gått (timebase) så gå till STATE_START_TRANSMIT
93
            time = Timebase_CurrentTime();
96
            time = Timebase_CurrentTime();
94
            if (time - timePauseStarted >= proto.timeout) {
97
            if (time - timePauseStarted >= proto.timeout) {
Line 98... Line 101...
98
                state = STATE_STOP;
101
                state = STATE_STOP;
99
            }
102
            }
100
        } else if (state == STATE_STOP) {
103
        } else if (state == STATE_STOP) {
101
            stop = 0;
104
            stop = 0;
102
            proto.timeout = 0;
105
            proto.timeout = 0;
-
 
106
            proto.framecnt = 0;
103
            repeatcnt = 0;
107
            repeatcnt = 0;
104
            state = STATE_IDLE;
108
            state = STATE_IDLE;
105
        }
109
        }
106
 
110
 
107
       
111