football_project_wo_output

Dependencies:   mbed

Fork of football_project by MZJ

Revision:
79:9db29f41dc9d
Parent:
78:43a6b54f0372
Child:
81:3cd7de5d01ef
--- a/configs.h	Mon May 09 01:08:01 2016 +0000
+++ b/configs.h	Wed May 25 05:02:53 2016 +0000
@@ -1,45 +1,164 @@
 ///////////////////////////////////  HARDWARE SELECTION ///////////////////////////////////
 
 // Board select, if none selected - LPC1768 assumed
-#define _NORDIC         // nRF51822         (highest priority)
+#define NORDIC         // nRF51822         (highest priority)
 #define NUCLEO          // Nucleo-F411RE    (lesser priority)
 
 // Frequency select 
 //#define FREQUENCY     RF69_433MHZ    
-#define FREQUENCY     RF69_868MHZ
-//#define FREQUENCY     RF69_915MHZ
+//#define FREQUENCY     RF69_868MHZ
+#define FREQUENCY     RF69_915MHZ
 
 #define HIGH_POWER      // High power radio
 
 // Output select
-#define _NO_DISP        // No display?
+#define NO_DISP        // No display?
 #define NO_SERIAL       // Send info over serial? 
 #define TEXT_LCD        // Text LCD display
 #define _I2C_DISP       // I2C display (SPI assumed)
-#define _ENABLE_SOUND    // Turns on sound in the beep() function
+#define ENABLE_SOUND    // Turns on sound in the beep() function
 
 ///////////////////////////////////  CONSTANTS   ///////////////////////////////////
 
 #define EVERY_NODE 255  // Abstract address we are sending the packets to (doesn't matter)
 #define NETWORKID 102   // The same on all nodes that talk to each other
 
+#define CYCLE_MS 2400
+#define SEND_RATE_MS 400L       // 0.33 s
+//#define SEND_DESYNC 0.20        // 0.20 -> send rate +/-10%
+#define MAX_RECORDS 6
 #define NAME_LEN 5
-#define MAX_RECORDS 35
-#define MAX_HISTORY_MS 60000   // 1 minute
 #define SIGNALS_VALID_MS 4000  
-#define SEND_RATE_MS 400L
-//#define SEND_DESYNC 0.20        // 0.20 -> send rate +/-10%
+#define MAX_HISTORY_MS 60000    // 1 minute
 
+#define NOTE_A3 0.004545454
+#define NOTE_A4 0.002272727
+#define NOTE_A5 0.001136363
+
+const uint8_t SPACE[] = {1, 50, 60, 100};      // 5, 10, 15, 20 meters
 
 ///////////////////////////////////  LOGIC  ///////////////////////////////////
 #ifdef NORDIC
 
-#ifdef ENABLE_SOUND
-#undef ENABLE_SOUND     // NORDIC --> no sound (at the moment)
-#endif 
-
 #ifndef NO_DISP
 #define NO_DISP     // NORDIC --> no display (use Serial)
 #endif
 
-#endif
\ No newline at end of file
+#define PRESSED 1
+#define RELEASED 0
+
+#else // NORDIC
+
+#define PRESSED 0
+#define RELEASED 1
+
+#endif // NORDIC
+
+
+///////////////////////  PINS  ///////////////////////
+#ifdef NORDIC
+
+#define LED_SPACE5      P0_7
+#define LED_SPACE10     P0_8
+#define LED_SPACE15     P0_9
+#define LED_SPACE20     P0_11
+#define LED_TEAM_A      P0_22
+#define LED_TEAM_B      P0_0
+#define LED_BUZZER_ON   P0_3
+
+#define BUZZER          P0_5
+#define BUZZ_HIGH       P0_4
+#define BUZZ_MED        P0_1
+#define BUZZ_LOW        P0_2
+
+#define BUT_VOL_MORE    P0_28
+#define BUT_VOL_LESS    P0_10
+#define BUT_SPACE       P0_21
+#define BUT_TEAM        P0_15
+
+#define RFM_MOSI        P0_19
+#define RFM_MISO        P0_18
+#define RFM_SCK         P0_17
+#define RFM_SS          P0_20
+#define RFM_IRQ         P0_12
+#define RFM_ISM_EN      P0_16
+
+#define CHARGE          P0_6
+#define V_MEAS
+#define VBAT
+#define PWR_BTN
+
+#define ANALOG_IN       CHARGE
+
+#else 
+#ifdef NUCLEO
+
+#define LED_SPACE5      PC_12
+#define LED_SPACE10     PA_13
+#define LED_SPACE15     PA_14
+#define LED_SPACE20     PA_15
+#define LED_TEAM_A      PC_11
+#define LED_TEAM_B      PD_2
+#define LED_BUZZER_ON   
+
+#define BUZZER          PB_8
+#define BUZZ_HIGH       
+#define BUZZ_MED        
+#define BUZZ_LOW        
+
+#define BUT_VOL_MORE    
+#define BUT_VOL_LESS    
+#define BUT_SPACE       PC_10
+#define BUT_TEAM        USER_BUTTON
+
+#define RFM_MOSI        D11
+#define RFM_MISO        D12
+#define RFM_SCK         D13
+#define RFM_SS          D10
+#define RFM_IRQ         D9
+#define RFM_ISM_EN      
+
+#define CHARGE
+#define V_MEAS
+#define VBAT
+#define PWR_BTN
+
+#define ANALOG_IN       A5
+
+
+#else // it's LPC
+
+#define LED_SPACE5      
+#define LED_SPACE10     
+#define LED_SPACE15     
+#define LED_SPACE20     
+#define LED_TEAM_A      
+#define LED_TEAM_B      
+#define LED_BUZZER_ON   
+
+#define BUZZER          p21
+#define BUZZ_HIGH       
+#define BUZZ_MED        
+#define BUZZ_LOW        
+
+#define BUT_VOL_MORE    
+#define BUT_VOL_LESS    
+#define BUT_SPACE       
+#define BUT_TEAM        p5
+
+#define RFM_MOSI        p11
+#define RFM_MISO        p12
+#define RFM_SCK         p13
+#define RFM_SS          p10
+#define RFM_IRQ         p9
+#define RFM_ISM_EN      
+
+#define CHARGE
+#define V_MEAS
+#define VBAT
+#define PWR_BTN
+
+#define ANALOG_IN       p15
+
+#endif // NUCLEO
+#endif // NORDIC