generated from TDD-Templates/cmake_cpputest_template_avr
Added test for adc enable.
+ code for testing ADC enable. + code for passing ADC enable function test.
This commit is contained in:
parent
a00e176675
commit
969b852cb3
|
@ -77,7 +77,7 @@ void ADC_Init(uint8_t adc_chan) {
|
||||||
|
|
||||||
void ADC_Enable(void) {
|
void ADC_Enable(void) {
|
||||||
// Set the enable bit in the CTRLA register
|
// Set the enable bit in the CTRLA register
|
||||||
// RegEdit_SetBit((void *)&ADC0.CTRLA, 0);
|
RegEdit_SetBit((void *)&ADCSRA, ADEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ADC_Disable() {
|
void ADC_Disable() {
|
||||||
|
|
|
@ -119,46 +119,18 @@ TEST(test_ADC, ADC_InitPortbWorksWithValidChannels)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(test_ADC, ADC_InitPortAPin0UsesCorrectRegisters)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
//Check for setting the direction to input.
|
|
||||||
mock().expectOneCall("RegEdit_ClearBit")
|
|
||||||
.withPointerParameter("reg", (void *) &PORTA.DIR)
|
|
||||||
.withUnsignedIntParameter("bit_num", 0);
|
|
||||||
|
|
||||||
//Check that the pullup is off
|
|
||||||
mock().expectOneCall("RegEdit_ClearBit")
|
|
||||||
.withPointerParameter("reg", (void *) &PORTA.OUT)
|
|
||||||
.withUnsignedIntParameter("bit_num", 0);
|
|
||||||
|
|
||||||
//Set the ISC(input sense config) to disable digital input
|
|
||||||
//buffering and reduce the noise on ADC usage.
|
|
||||||
mock().expectOneCall("RegEdit_SetBit")
|
|
||||||
.withPointerParameter("reg", (void *) &PORTA.PIN0CTRL)
|
|
||||||
.withUnsignedIntParameter("bit_num", PORT_ISC_INPUT_DISABLE_gc);
|
|
||||||
|
|
||||||
*/
|
|
||||||
//ADC_Init(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(test_ADC, ADC_InitDoesNothingOnHighPinNumbers)
|
|
||||||
{
|
|
||||||
//mock().expectNoCall("RegEdit_SetBit");
|
|
||||||
//ADC_Init(8);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(test_ADC, ADC_EnablePasses)
|
TEST(test_ADC, ADC_EnablePasses)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
mock().expectOneCall("RegEdit_SetBit")
|
|
||||||
.withPointerParameter("reg", (void *) &ADC0.CTRLA)
|
|
||||||
.withUnsignedIntParameter("bit_num", 0);
|
|
||||||
|
|
||||||
*/
|
mock().expectOneCall("RegEdit_SetBit")
|
||||||
//ADC_Enable();
|
.withPointerParameter("reg", (void *) &ADCSRA)
|
||||||
|
.withUnsignedIntParameter("bit_num", ADEN);
|
||||||
|
|
||||||
|
ADC_Enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TEST(test_ADC, ADC_DisablePasses)
|
TEST(test_ADC, ADC_DisablePasses)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -169,6 +141,7 @@ TEST(test_ADC, ADC_DisablePasses)
|
||||||
//ADC_Disable();
|
//ADC_Disable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TEST(test_ADC, ADC_SetPinSetsRightRegisters)
|
TEST(test_ADC, ADC_SetPinSetsRightRegisters)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue