Refactored tests and TriacOut Code for High power setup
This commit is contained in:
parent
ee63806a22
commit
3af31e045d
|
@ -22,16 +22,12 @@ void TriacOut_InitTimerA(void)
|
||||||
void TriacOut_SetupPins(void)
|
void TriacOut_SetupPins(void)
|
||||||
{
|
{
|
||||||
RegEdit_SetBit((void *) &PORTA.DIR, G1);
|
RegEdit_SetBit((void *) &PORTA.DIR, G1);
|
||||||
RegEdit_SetBit((void *) &PORTB.DIR, G2);
|
|
||||||
RegEdit_SetBit((void *) &PORTB.DIR, G3);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TriacOut_SetAllHigh(void)
|
void TriacOut_SetAllHigh(void)
|
||||||
{
|
{
|
||||||
RegEdit_SetBit((void *) &PORTA.OUT, G1);
|
RegEdit_SetBit((void *) &PORTA.OUT, G1);
|
||||||
RegEdit_SetBit((void *) &PORTB.OUT, G2);
|
|
||||||
RegEdit_SetBit((void *) &PORTB.OUT, G3);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,6 +37,4 @@ void TriacOut_PulsePins(uint16_t pulse_time)
|
||||||
Delay_MicroSeconds(pulse_time);
|
Delay_MicroSeconds(pulse_time);
|
||||||
|
|
||||||
RegEdit_ClearBit((void *) &PORTA.OUT, G1);
|
RegEdit_ClearBit((void *) &PORTA.OUT, G1);
|
||||||
RegEdit_ClearBit((void *) &PORTB.OUT, G2);
|
|
||||||
RegEdit_ClearBit((void *) &PORTB.OUT, G3);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,15 +53,6 @@ TEST(test_TriacOut, TriacOut_SetupPins)
|
||||||
.withPointerParameter("reg", (void *) &PORTA.DIR)
|
.withPointerParameter("reg", (void *) &PORTA.DIR)
|
||||||
.withUnsignedIntParameter("bit_num", G1);
|
.withUnsignedIntParameter("bit_num", G1);
|
||||||
|
|
||||||
//Expect that pin PB3 is set to output
|
|
||||||
mock().expectOneCall("RegEdit_SetBit")
|
|
||||||
.withPointerParameter("reg", (void *) &PORTB.DIR)
|
|
||||||
.withUnsignedIntParameter("bit_num", G2);
|
|
||||||
|
|
||||||
//Expect that pin PB2 is set to output
|
|
||||||
mock().expectOneCall("RegEdit_SetBit")
|
|
||||||
.withPointerParameter("reg", (void *) &PORTB.DIR)
|
|
||||||
.withUnsignedIntParameter("bit_num", G3);
|
|
||||||
|
|
||||||
TriacOut_SetupPins();
|
TriacOut_SetupPins();
|
||||||
}
|
}
|
||||||
|
@ -74,16 +65,6 @@ TEST(test_TriacOut, TriacOut_SetAllHigh)
|
||||||
.withPointerParameter("reg", (void *) &PORTA.OUT)
|
.withPointerParameter("reg", (void *) &PORTA.OUT)
|
||||||
.withUnsignedIntParameter("bit_num", G1);
|
.withUnsignedIntParameter("bit_num", G1);
|
||||||
|
|
||||||
//Expect that pin PB3 is set to output
|
|
||||||
mock().expectOneCall("RegEdit_SetBit")
|
|
||||||
.withPointerParameter("reg", (void *) &PORTB.OUT)
|
|
||||||
.withUnsignedIntParameter("bit_num", G2);
|
|
||||||
|
|
||||||
//Expect that pin PB2 is set to output
|
|
||||||
mock().expectOneCall("RegEdit_SetBit")
|
|
||||||
.withPointerParameter("reg", (void *) &PORTB.OUT)
|
|
||||||
.withUnsignedIntParameter("bit_num", G3);
|
|
||||||
|
|
||||||
TriacOut_SetAllHigh();
|
TriacOut_SetAllHigh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,15 +76,5 @@ TEST(test_TriacOut, TriacOut_PulsePins)
|
||||||
.withPointerParameter("reg", (void *) &PORTA.OUT)
|
.withPointerParameter("reg", (void *) &PORTA.OUT)
|
||||||
.withUnsignedIntParameter("bit_num", G1);
|
.withUnsignedIntParameter("bit_num", G1);
|
||||||
|
|
||||||
//Expect that pin PB3 is set to output
|
|
||||||
mock().expectOneCall("RegEdit_ClearBit")
|
|
||||||
.withPointerParameter("reg", (void *) &PORTB.OUT)
|
|
||||||
.withUnsignedIntParameter("bit_num", G2);
|
|
||||||
|
|
||||||
//Expect that pin PB2 is set to output
|
|
||||||
mock().expectOneCall("RegEdit_ClearBit")
|
|
||||||
.withPointerParameter("reg", (void *) &PORTB.OUT)
|
|
||||||
.withUnsignedIntParameter("bit_num", G3);
|
|
||||||
|
|
||||||
TriacOut_PulsePins(1000);
|
TriacOut_PulsePins(1000);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue