Added function for setting the enable pins low

This commit is contained in:
jakeg00dwin 2024-07-27 12:53:45 -07:00
parent a09d7de1df
commit 0fe08d7612
3 changed files with 57 additions and 0 deletions

View File

@ -17,5 +17,20 @@
void Enable_SetPinsHigh()
{
RegEdit_SetBit((void *) &PORTA.DIR, EN1);
RegEdit_SetBit((void *) &PORTB.DIR, EN2);
RegEdit_SetBit((void *) &PORTB.DIR, EN3);
RegEdit_SetBit((void *) &PORTA.OUT, EN1);
RegEdit_SetBit((void *) &PORTB.OUT, EN2);
RegEdit_SetBit((void *) &PORTB.OUT, EN3);
return;
}
void Enable_SetPinsLow()
{
RegEdit_ClearBit((void *) &PORTA.OUT, EN1);
RegEdit_ClearBit((void *) &PORTB.OUT, EN2);
RegEdit_ClearBit((void *) &PORTB.OUT, EN3);
return;
}

View File

@ -19,6 +19,10 @@
*/
void Enable_SetPinsHigh();
/**
* Sets all the Enable pins low.
*/
void Enable_SetPinsLow();
#endif //ENABLE

View File

@ -40,5 +40,43 @@ TEST(test_Enable, SetEnablePinsHighCallsCorrectFuncs)
.withPointerParameter("reg", (void *) &PORTA.DIR)
.withUnsignedIntParameter("bit_num", EN1);
mock().expectOneCall("RegEdit_SetBit")
.withPointerParameter("reg", (void *) &PORTB.DIR)
.withUnsignedIntParameter("bit_num", EN2);
mock().expectOneCall("RegEdit_SetBit")
.withPointerParameter("reg", (void *) &PORTB.DIR)
.withUnsignedIntParameter("bit_num", EN3);
mock().expectOneCall("RegEdit_SetBit")
.withPointerParameter("reg", (void *) &PORTA.OUT)
.withUnsignedIntParameter("bit_num", EN1);
mock().expectOneCall("RegEdit_SetBit")
.withPointerParameter("reg", (void *) &PORTB.OUT)
.withUnsignedIntParameter("bit_num", EN2);
mock().expectOneCall("RegEdit_SetBit")
.withPointerParameter("reg", (void *) &PORTB.OUT)
.withUnsignedIntParameter("bit_num", EN3);
Enable_SetPinsHigh();
}
TEST(test_Enable, SetEnablePinsLow)
{
mock().expectOneCall("RegEdit_ClearBit")
.withPointerParameter("reg", (void *) &PORTA.OUT)
.withUnsignedIntParameter("bit_num", EN1);
mock().expectOneCall("RegEdit_ClearBit")
.withPointerParameter("reg", (void *) &PORTB.OUT)
.withUnsignedIntParameter("bit_num", EN2);
mock().expectOneCall("RegEdit_ClearBit")
.withPointerParameter("reg", (void *) &PORTB.OUT)
.withUnsignedIntParameter("bit_num", EN3);
Enable_SetPinsLow();
}