Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Se puede refactorizar el codigo #3

Open
evolentini opened this issue May 30, 2021 · 0 comments
Open

Se puede refactorizar el codigo #3

evolentini opened this issue May 30, 2021 · 0 comments

Comments

@evolentini
Copy link

Dado que todos los led arrancan apagados sería buena idea reemplazar esta linea

*puerto = ALL_LEDS_OFF;

por una llamada a la función Led_TurnOffAll(). Ademas la función para consultar el estado

TP3-TSSE/src/leds.c

Lines 44 to 56 in 7a3146a

bool Led_State(uint8_t led)
{
uint16_t state;
state = *puerto & led_to_bit(led);
if(state == LED_OFF)
{
return false;
}
else
{
return true;
}
}

se puede reescribir como:

bool Led_State(uint8_t led)
{
    return (*puerto & led_to_bit(led)) != LED_OFF;
}

``
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant