Updated `Load_HandleLoadPortB()` to pass new tests.
This commit is contained in:
parent
bd2f396bac
commit
3b9845487c
|
@ -79,13 +79,18 @@ void Load_HandleLoadPortA(uint8_t adc_pin, uint8_t out_pin)
|
|||
void Load_HandleLoadPortB(uint8_t adc_pin, uint8_t out_pin)
|
||||
{
|
||||
uint16_t val = sample_adc(adc_pin);
|
||||
|
||||
if(is_valid_load(val) && !portb_disabled[adc_pin]){
|
||||
if(portb_disabled[adc_pin]){
|
||||
RegEdit_ClearBit((void *) &PORTB.OUT, out_pin);
|
||||
}
|
||||
else if(!is_valid_load(val)){
|
||||
RegEdit_ClearBit((void *) &PORTB.OUT, out_pin);
|
||||
portb_disabled[adc_pin] = true;
|
||||
}
|
||||
else if(is_below_target(val)) {
|
||||
RegEdit_SetBit((void *) &PORTB.DIR, out_pin);
|
||||
RegEdit_SetBit((void *) &PORTB.OUT, out_pin);
|
||||
}
|
||||
else{
|
||||
RegEdit_ClearBit((void *) &PORTB.OUT, out_pin);
|
||||
portb_disabled[adc_pin] = true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue