some very old changes, resurrected from the old CVS, almost forgotten

This commit is contained in:
Ronald Schaten 2009-03-18 14:23:57 +00:00
parent 9d77685934
commit 6cc9f77a0d

11
main.c
View File

@ -348,6 +348,7 @@ const uint8_t switch_timer_index[STATE_START_COUNT]= { 13, 0 };
/** contains the port assignments for each interval */ /** contains the port assignments for each interval */
uint8_t switch_state[STATE_COUNT][PORT_COUNT]; uint8_t switch_state[STATE_COUNT][PORT_COUNT];
uint8_t switch_state_new[STATE_COUNT][PORT_COUNT];
/** /**
* Three bytes have to be received for a full command. This enum is used to * Three bytes have to be received for a full command. This enum is used to
* indicate what part of the command we are waiting for. * indicate what part of the command we are waiting for.
@ -401,10 +402,10 @@ void set_brightness(uint8_t channel, uint16_t brightness){
// walk through all states... // walk through all states...
if (brightness & 1) { if (brightness & 1) {
// set the bit if it needs to be set in this state // set the bit if it needs to be set in this state
switch_state[i][port] |= mask; switch_state_new[i][port] |= mask;
} else { } else {
// clear it otherwise // clear it otherwise
switch_state[i][port] &= ~mask; switch_state_new[i][port] &= ~mask;
} }
// shift the value to look at the next bit // shift the value to look at the next bit
brightness >>= 1; brightness >>= 1;
@ -536,6 +537,12 @@ int main(void) {
} }
} }
} }
for(state_number= 0; state_number < STATE_COUNT; state_number++) {
for(port= 0; port < PORT_COUNT; port++) {
switch_state[state_number][port]=
switch_state_new[state_number][port];
}
}
} }
return 0; return 0;
} }