diff --git a/src/ADC/ADC.c b/src/ADC/ADC.c index 19b9926..2129129 100644 --- a/src/ADC/ADC.c +++ b/src/ADC/ADC.c @@ -47,17 +47,12 @@ void ADC_Init(uint8_t pin_num) (void *) (&PORTA.PIN0CTRL)+pin_num, PORT_ISC_INPUT_DISABLE_gc ); - /* - RegEdit_OR_Num( - (void *) (&PORTA.PIN0CTRL)+pin_num, - PORT_ISC_INPUT_DISABLE_gc - );*/ //Ensure we use full 10bit resolution - RegEdit_ClearBit((void *) &ADC0.CTRLA, 2); + //RegEdit_ClearBit((void *) &ADC0.CTRLA, 2); //Use VDD as our voltage refernce. - RegEdit_SetBit((void *) &ADC0.CTRLC, 4); + //RegEdit_SetBit((void *) &ADC0.CTRLC, 4); } diff --git a/tests/ADC/test_ADC.cpp b/tests/ADC/test_ADC.cpp index 115cfba..06fd84c 100644 --- a/tests/ADC/test_ADC.cpp +++ b/tests/ADC/test_ADC.cpp @@ -52,21 +52,10 @@ TEST(test_ADC, ADC_InitPortAPin7UsesCorrectRegisters) //Set the ISC(input sense config) to disable digital input //buffering and reduce the noise on ADC usage. - mock().expectOneCall("RegEdit_OR_Num") - .withPointerParameter("reg", (void *) &PORTA.PIN7CTRL) - .withUnsignedIntParameter("num", 0x4); - - - //check that the resolusion is selected - mock().expectOneCall("RegEdit_ClearBit") - .withPointerParameter("reg", (void *) &ADC0.CTRLA) - .withUnsignedIntParameter("bit_num", 2); - - //check for the seleceted refernce voltage - //we leave the adc prescaler alone mostly. mock().expectOneCall("RegEdit_SetBit") - .withPointerParameter("reg", (void *) &ADC0.CTRLC) - .withUnsignedIntParameter("bit_num", 4); + .withPointerParameter("reg", (void *) &PORTA.PIN7CTRL) + .withUnsignedIntParameter("bit_num", PORT_ISC_INPUT_DISABLE_gc); + ADC_Init(7); } @@ -85,20 +74,9 @@ TEST(test_ADC, ADC_InitPortAPin0UsesCorrectRegisters) //Set the ISC(input sense config) to disable digital input //buffering and reduce the noise on ADC usage. - mock().expectOneCall("RegEdit_OR_Num") - .withPointerParameter("reg", (void *) &PORTA.PIN0CTRL) - .withUnsignedIntParameter("num", 0x4); - - //check that the resolusion is selected - mock().expectOneCall("RegEdit_ClearBit") - .withPointerParameter("reg", (void *) &ADC0.CTRLA) - .withUnsignedIntParameter("bit_num", 2); - - //check for the seleceted refernce voltage - //we leave the adc prescaler alone mostly. mock().expectOneCall("RegEdit_SetBit") - .withPointerParameter("reg", (void *) &ADC0.CTRLC) - .withUnsignedIntParameter("bit_num", 4); + .withPointerParameter("reg", (void *) &PORTA.PIN0CTRL) + .withUnsignedIntParameter("bit_num", PORT_ISC_INPUT_DISABLE_gc); ADC_Init(0); }