]> git.scottworley.com Git - tattlekey/commitdiff
client: Move queue servicing to service_queue()
authorScott Worley <scottworley@scottworley.com>
Mon, 9 Oct 2023 19:51:43 +0000 (12:51 -0700)
committerScott Worley <scottworley@scottworley.com>
Wed, 11 Oct 2023 01:48:48 +0000 (18:48 -0700)
client/tattlekey.c

index cd1324145e220b097578b0b67e613ca973778bd8..a11e6c192899b4343ca0b9d16e5a3956d69077c9 100644 (file)
@@ -51,21 +51,7 @@ static void button_pressed() {
   }
 }
 
-int main() {
-  stdio_init_all();
-  if (cyw43_arch_init_with_country(CYW43_COUNTRY_USA))
-    signal_error_by_blinking();
-  cyw43_arch_enable_sta_mode();
-  signal(3, 100);
-  if (cyw43_arch_wifi_connect_timeout_ms(config_wifi_ssid, config_wifi_pass,
-                                         CYW43_AUTH_WPA2_AES_PSK, 90000))
-    signal_error_by_blinking();
-  signal(2, 300);
-
-  queue_init(&queue, sizeof(event_t), 99);
-
-  begin_listening_for_button_press(button_pressed);
-
+void service_queue() {
   u16_t seq = 0;
   while (1) {
     event_t e;
@@ -95,3 +81,21 @@ int main() {
     }
   }
 }
+
+int main() {
+  stdio_init_all();
+  if (cyw43_arch_init_with_country(CYW43_COUNTRY_USA))
+    signal_error_by_blinking();
+  cyw43_arch_enable_sta_mode();
+  signal(3, 100);
+  if (cyw43_arch_wifi_connect_timeout_ms(config_wifi_ssid, config_wifi_pass,
+                                         CYW43_AUTH_WPA2_AES_PSK, 90000))
+    signal_error_by_blinking();
+  signal(2, 300);
+
+  queue_init(&queue, sizeof(event_t), 99);
+
+  begin_listening_for_button_press(button_pressed);
+
+  service_queue();
+}