diff options
author | Thomas White <taw@physics.org> | 2023-02-26 17:01:57 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2023-02-26 17:01:57 +0100 |
commit | cbf8d8d9660674d095f4ef99de20396675f61950 (patch) | |
tree | 74f7ae4b72c7c2cd36f5b3678c337dba23bc8eb4 | |
parent | 2f3955aa509e594d9bf122519a8fe24ac0cb3577 (diff) |
Add test button
-rw-r--r-- | morningtown.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/morningtown.c b/morningtown.c index f201abb..578101d 100644 --- a/morningtown.c +++ b/morningtown.c @@ -31,6 +31,7 @@ #define LED_GREEN 21 #define LED_RED 22 +#define TEST_BUTTON 16 int ntp_sent = 0; int ntp_ok = 0; @@ -128,8 +129,11 @@ int main() gpio_init(LED_GREEN); gpio_init(LED_RED); + gpio_init(TEST_BUTTON); gpio_set_dir(LED_GREEN, GPIO_OUT); gpio_set_dir(LED_RED, GPIO_OUT); + gpio_set_dir(TEST_BUTTON, GPIO_IN); + gpio_pull_up(TEST_BUTTON); cyw43_arch_init(); cyw43_arch_enable_sta_mode(); @@ -178,6 +182,12 @@ int main() ntp_poll(ntp_state); + if ( ntp_ok && !gpio_get(TEST_BUTTON) ) { + gpio_put(LED_GREEN, 1); + } else { + gpio_put(LED_GREEN, 0); + } + debug_print("tick\n"); last_conn += 1; |