From 9228d0703fb7031f8d23d8b02f4f1f88916f7ea3 Mon Sep 17 00:00:00 2001 From: jake Date: Sun, 16 Feb 2025 14:42:08 -0800 Subject: [PATCH] Added attiny13a adc expectations. --- tests/ADC/test_ADC.cpp | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/tests/ADC/test_ADC.cpp b/tests/ADC/test_ADC.cpp index b9abb6a..146da80 100644 --- a/tests/ADC/test_ADC.cpp +++ b/tests/ADC/test_ADC.cpp @@ -15,7 +15,7 @@ extern "C" { -#include //ATtiny404 header fille. +#include //ATtiny13A header file. #include "ADC.h" } @@ -40,6 +40,34 @@ TEST(test_ADC, FirstTest) TEST(test_ADC, ADC_SetupSetsRegisters) { + /* + * ADC Channel Selection(MUX1, MUX0): + * 00 == ADC0/PB5 + * 01 == ADC1/PB2 + * 10 == ADC2/PB4 + * 11 == ADC3/PB3 + */ + + /*Set the ADC Channel 0 using ADMUX reg*/ + mock().expectOneCall("RegEdit_SetNum") + .withPointerParameter("reg", (void *) &ADMUX) + .withUnsignedIntParameter("num", 0x00); + + /*Set the voltage reference to VCC.*/ + mock().expectOneCall("RegEdit_ClearBit") + .withPointerParameter("reg", (void *) &ADMUX) + .withUnsignedIntParameter("bit_num", 6); + + /*Set ADC Left adjust result setting to off.*/ + mock().expectOneCall("RegEdit_ClearBit") + .withPointerParameter("reg", (void *) &ADMUX) + .withUnsignedIntParameter("bit_num", 5); + + /*Set the Prescaler for samping frequency.*/ + + /*Set the ADC Enable bit ADEN in ADCSCR*/ + + //Clears control register A for ADC0 mock().expectOneCall("RegEdit_SetNum") .withPointerParameter("reg", (void *) &ADC0.CTRLA)