Fixed Logic issues with the load.c file.

This commit is contained in:
jakeg00dwin 2024-07-28 16:45:18 -07:00
parent ac6b93b49e
commit 01e4c43481
1 changed files with 6 additions and 6 deletions

View File

@ -7,12 +7,12 @@
void Load_HandleLoadPortA(uint8_t adc_pin, uint8_t out_pin)
{
ADC_Init(adc_pin);
ADC_Enable(adc_pin);
ADC_Enable();
ADC_SetPin(adc_pin);
uint16_t val = ADC_ReadValue(adc_pin);
val = ADC_ReadValue(adc_pin);
ADC_Disable();
if(val > 527 || val < 1000){
if(val > 527 && val < 1000){
RegEdit_SetBit((void *) &PORTA.DIR, out_pin);
RegEdit_SetBit((void *) &PORTA.OUT, out_pin);
}
@ -24,12 +24,12 @@ void Load_HandleLoadPortA(uint8_t adc_pin, uint8_t out_pin)
void Load_HandleLoadPortB(uint8_t adc_pin, uint8_t out_pin)
{
ADC_Init(adc_pin);
ADC_Enable(adc_pin);
ADC_Enable();
ADC_SetPin(adc_pin);
uint16_t val = ADC_ReadValue(adc_pin);
val = ADC_ReadValue(adc_pin);
ADC_Disable();
if(val > 527 || val < 1000){
if(val > 527 && val < 1000){
RegEdit_SetBit((void *) &PORTB.DIR, out_pin);
RegEdit_SetBit((void *) &PORTB.OUT, out_pin);
}