21. 原則違反コードの改善ポイント3 ソースコード
int main(int argc, FAR char *argv[])
{
int one_time_counter = 0;
int game_coundown;
shooting_watch_gpio_create();
printf("Hello, shooting_watch!!!n");
while(exit_shooting_watch != true) {
switch (game_state) {
case STOP:
if (one_time_counter == 0) {
printf("----- Press SW2 to start the game. When the game starts, shoot SW1 continuously.-----n");
printf("----- Press SW1 and SW2 to end the game.-----n");
one_time_counter = 1;
board_gpio_write(USER_LED_1, USER_LED_TURN_OFF);
board_gpio_write(USER_LED_2, USER_LED_TURN_OFF);
}
【連続講座】ソフトウェア設計原則【SOLID】を学ぶ #1 単一責務の原則(single-responsibility principle)
21