Fixed issue with pin number

Fixed an issue where a placeholder value was still being used in a
function.
This commit is contained in:
Jake Goodwin 2024-08-25 06:38:10 -07:00
parent afebedb36a
commit 9fc9e43cd6
3 changed files with 22 additions and 3 deletions

View File

@ -26,7 +26,7 @@ LedByte LedController_New(uint8_t *port)
LedByte led_byte;
for (int i = 0; i < 8; i++)
{
led_byte.leds[i].pin_num = 1;
led_byte.leds[i].pin_num = i;
led_byte.leds[i].state = false;
led_byte.leds[i].port = port;
}
@ -35,6 +35,10 @@ LedByte LedController_New(uint8_t *port)
void LedController_ShowByte(LedByte *led_byte, uint8_t byte)
{
for (int i = 0; i < 8; i++)
{
LedController_SetHigh(&led_byte->leds[i]);
}
}
void LedControler_ClearByte(LedByte *led_byte)

View File

@ -38,7 +38,6 @@ LedByte LedController_New(uint8_t *port);
*/
void LedController_ShowByte(LedByte *led_byte, uint8_t byte);
/**
* Clears out the byte led representation
*/

View File

@ -103,3 +103,19 @@ TEST(test_LedController, NewLedByte)
}
}
TEST(test_LedController, LedByteDisplay)
{
uint8_t fake_port = 0x00;
uint8_t byte = 0xFF;
LedByte led_byte = LedController_New(&fake_port);
LedController_ShowByte(&led_byte, byte);
for(int i = 0; i < 8; i++){
CHECK_TRUE(led_byte.leds[i].state);
}
CHECK_EQUAL(0xFF, fake_port);
}