Fixed issue with pin number
Fixed an issue where a placeholder value was still being used in a function.
This commit is contained in:
parent
afebedb36a
commit
9fc9e43cd6
|
@ -26,7 +26,7 @@ LedByte LedController_New(uint8_t *port)
|
||||||
LedByte led_byte;
|
LedByte led_byte;
|
||||||
for (int i = 0; i < 8; i++)
|
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].state = false;
|
||||||
led_byte.leds[i].port = port;
|
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)
|
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)
|
void LedControler_ClearByte(LedByte *led_byte)
|
||||||
|
|
|
@ -38,7 +38,6 @@ LedByte LedController_New(uint8_t *port);
|
||||||
*/
|
*/
|
||||||
void LedController_ShowByte(LedByte *led_byte, uint8_t byte);
|
void LedController_ShowByte(LedByte *led_byte, uint8_t byte);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears out the byte led representation
|
* Clears out the byte led representation
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -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);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue