switched to only doing the samping, not using avrage, reduces needed instructions.
This commit is contained in:
parent
09f214efbe
commit
4b014da8ac
4
load.c
4
load.c
|
@ -16,9 +16,9 @@ void Load_HandleLoadPortA(uint8_t adc_pin, uint8_t out_pin)
|
||||||
ADC_Enable(adc_pin);
|
ADC_Enable(adc_pin);
|
||||||
uint16_t val;
|
uint16_t val;
|
||||||
for(int i = 0; i < 32; i++){
|
for(int i = 0; i < 32; i++){
|
||||||
val += ADC_ReadValue(adc_pin);
|
val = ADC_ReadValue(adc_pin);
|
||||||
}
|
}
|
||||||
val /= 32;
|
|
||||||
ADC_Disable();
|
ADC_Disable();
|
||||||
if(val < 527 || val > 1000){
|
if(val < 527 || val > 1000){
|
||||||
RegEdit_ClearBit((void *) &PORTA.OUT, out_pin);
|
RegEdit_ClearBit((void *) &PORTA.OUT, out_pin);
|
||||||
|
|
Loading…
Reference in New Issue