Quote:
|
Originally Posted by tacman1123
Upgrading to EasyC 2.0 solved half my problem, as there is now a call GetRxInput(rx, channel) that gets the values I was looking for.
|
i'm guessing that rx is receiver 1 or 2 and that channel is 1 through 6. since there's no way to return an error indication, if we get rx 10, channel 9, we'll just return the first channel from the first receiver.
Code:
unsigned char GetRXInput (unsigned char rx, unsigned char channel) {
unsigned char bar;
switch (rx * 6 + channel) {
default:
case 1 : bar = PWM_in1; break;
case 2 : bar = PWM_in2; break;
case 3 : bar = PWM_in3; break;
case 4 : bar = PWM_in4; break;
case 5 : bar = PWM_in5; break;
case 6 : bar = PWM_in6; break;
case 7 : bar = PWM_in7; break;
case 8 : bar = PWM_in8; break;
case 9 : bar = PWM_in9; break;
case 10 : bar = PWM_in10; break;
case 11 : bar = PWM_in11; break;
case 12 : bar = PWM_in12; break;
}
return bar;
}
don't forget to include ifialiases.h.