sm1000_leds_switches: Clean up and move remainder of logic.
authorsjlongland <sjlongland@01035d8c-6547-0410-b346-abe4f91aad63>
Thu, 24 Sep 2015 08:12:07 +0000 (08:12 +0000)
committersjlongland <sjlongland@01035d8c-6547-0410-b346-abe4f91aad63>
Thu, 24 Sep 2015 08:12:07 +0000 (08:12 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@2364 01035d8c-6547-0410-b346-abe4f91aad63

codec2-dev/stm32/inc/sm1000_leds_switches.h
codec2-dev/stm32/src/sm1000_leds_switches.c
codec2-dev/stm32/src/sm1000_main.c

index a7fadd4f1b9bb5e609343ad0599fab7b9de34e1a..33de73fe708977c629604416317cf12049fd31dd 100644 (file)
@@ -28,6 +28,8 @@
 #ifndef __LEDS_SWITCHES__
 #define __LEDS_SWITCHES__
 
+#include <stdint.h>
+
 void sm1000_leds_switches_init(void);
 
 void led_pwr(int state);
@@ -41,6 +43,11 @@ int switch_select(void);
 int switch_back(void);
 int ext_ptt(void);
 
+#define DEBOUNCE_DELAY 500 /*!< Delay to wait while switch bounces */
+
+#define SW_STEADY   0   /*!< Switch is in steady-state */
+#define SW_DEBOUNCE 1   /*!< Switch is being debounced */
+
 /*! Switch debounce and logic handling */
 struct switch_t {
     /*! Debounce/hold timer */
index b08d533384095181ca874fed74dac83a104c9a77..129d54ef711342d45c2548e2c64bb6e2bbaf831b 100644 (file)
@@ -160,7 +160,7 @@ void BusFault_Handler(void)  { ColorfulRingOfDeath(3); }
 void UsageFault_Handler(void){ ColorfulRingOfDeath(4); }
 
 
-static void switch_tick(struct switch_t* const sw)
+void switch_tick(struct switch_t* const sw)
 {
     if (sw->sw != sw->raw) {
         /* State transition, reset timer */
index 22c183e48baa97fde4d21e66cb451bd46c7776df..9519e4f4cba7b3d6f5833c17662fd537e350a220 100644 (file)
@@ -43,7 +43,6 @@
 
 #define FREEDV_NSAMPLES_16K (2*FREEDV_NSAMPLES)
 
-#define DEBOUNCE_DELAY     500
 #define ANNOUNCE_DELAY  300000  /* Supposed to be msec, seems not */
 
 #define MAX_MODES  3
@@ -51,9 +50,6 @@
 #define DV         1
 #define TONE       2
 
-#define SW_STEADY   0   /*!< Switch is in steady-state */
-#define SW_DEBOUNCE 1   /*!< Switch is being debounced */
-
 struct switch_t sw_select;  /*!< Switch driver for SELECT button */
 struct switch_t sw_back;    /*!< Switch driver for BACK button */
 struct switch_t sw_ptt;     /*!< Switch driver for PTT buttons */