switched to only doing the samping, not using avrage, reduces needed instructions.

This commit is contained in:
jakeg00dwin 2024-07-15 12:12:53 -07:00
parent 09f214efbe
commit 4b014da8ac
1 changed files with 2 additions and 2 deletions

4
load.c
View File

@ -16,9 +16,9 @@ void Load_HandleLoadPortA(uint8_t adc_pin, uint8_t out_pin)
ADC_Enable(adc_pin);
uint16_t val;
for(int i = 0; i < 32; i++){
val += ADC_ReadValue(adc_pin);
val = ADC_ReadValue(adc_pin);
}
val /= 32;
ADC_Disable();
if(val < 527 || val > 1000){
RegEdit_ClearBit((void *) &PORTA.OUT, out_pin);