football_project_wo_output

Dependencies:   mbed

Fork of football_project by MZJ

Committer:
andriym
Date:
Sat Jun 11 06:50:32 2016 +0000
Revision:
89:425369a595c4
Parent:
87:a9870d513fcf
Child:
90:b4d53a870147
FOTA added (unable to test)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
andriym 83:79cb2ba44b66 1 #ifndef CONFIGS_h
andriym 83:79cb2ba44b66 2 #define CONFIGS_h
andriym 78:43a6b54f0372 3 /////////////////////////////////// HARDWARE SELECTION ///////////////////////////////////
andriym 78:43a6b54f0372 4
andriym 78:43a6b54f0372 5 // Board select, if none selected - LPC1768 assumed
andriym 84:705de339f554 6 #define NORDIC // nRF51822 (highest priority)
andriym 78:43a6b54f0372 7 #define NUCLEO // Nucleo-F411RE (lesser priority)
andriym 87:a9870d513fcf 8 #define HARD_V2 // version 2 hardware for nRF51822
andriym 78:43a6b54f0372 9
andriym 78:43a6b54f0372 10 // Frequency select
andriym 84:705de339f554 11 //#define FREQUENCY RF69_868MHZ
andriym 84:705de339f554 12 #define FREQUENCY RF69_915MHZ
andriym 78:43a6b54f0372 13
andriym 87:a9870d513fcf 14 #define HIGH_POWER // High power radio
andriym 78:43a6b54f0372 15
andriym 78:43a6b54f0372 16 // Output select
andriym 84:705de339f554 17 #define NO_DISP // No display?
andriym 78:43a6b54f0372 18 #define NO_SERIAL // Send info over serial?
andriym 78:43a6b54f0372 19 #define TEXT_LCD // Text LCD display
andriym 78:43a6b54f0372 20 #define _I2C_DISP // I2C display (SPI assumed)
andriym 79:9db29f41dc9d 21 #define ENABLE_SOUND // Turns on sound in the beep() function
andriym 89:425369a595c4 22 #define ENABLE_PIN // is there a pin to enable radio via MOSFET?
andriym 89:425369a595c4 23 #define BLE_ENABLE
andriym 78:43a6b54f0372 24
andriym 78:43a6b54f0372 25 /////////////////////////////////// CONSTANTS ///////////////////////////////////
andriym 78:43a6b54f0372 26
andriym 78:43a6b54f0372 27 #define EVERY_NODE 255 // Abstract address we are sending the packets to (doesn't matter)
andriym 78:43a6b54f0372 28 #define NETWORKID 102 // The same on all nodes that talk to each other
andriym 78:43a6b54f0372 29
andriym 79:9db29f41dc9d 30 #define CYCLE_MS 2400
andriym 79:9db29f41dc9d 31 #define SEND_RATE_MS 400L // 0.33 s
andriym 79:9db29f41dc9d 32 //#define SEND_DESYNC 0.20 // 0.20 -> send rate +/-10%
andriym 79:9db29f41dc9d 33 #define MAX_RECORDS 6
andriym 78:43a6b54f0372 34 #define NAME_LEN 5
andriym 78:43a6b54f0372 35 #define SIGNALS_VALID_MS 4000
andriym 89:425369a595c4 36 #define MAX_HISTORY_MS 30000 // 30 seconds
andriym 78:43a6b54f0372 37
andriym 79:9db29f41dc9d 38 #define NOTE_A3 0.004545454
andriym 79:9db29f41dc9d 39 #define NOTE_A4 0.002272727
andriym 79:9db29f41dc9d 40 #define NOTE_A5 0.001136363
andriym 79:9db29f41dc9d 41
andriym 79:9db29f41dc9d 42 const uint8_t SPACE[] = {1, 50, 60, 100}; // 5, 10, 15, 20 meters
andriym 78:43a6b54f0372 43
andriym 87:a9870d513fcf 44 // P-MOSFET
andriym 87:a9870d513fcf 45 #define LOW_ON 0
andriym 87:a9870d513fcf 46 #define LOW_OFF 1
andriym 87:a9870d513fcf 47
andriym 87:a9870d513fcf 48 #ifdef HARD_V2
andriym 87:a9870d513fcf 49
andriym 87:a9870d513fcf 50 // N-MOSFETS
andriym 87:a9870d513fcf 51 #define MED_ON 1
andriym 87:a9870d513fcf 52 #define MED_OFF 0
andriym 87:a9870d513fcf 53 #define HIGH_ON 1
andriym 87:a9870d513fcf 54 #define HIGH_OFF 0
andriym 87:a9870d513fcf 55
andriym 87:a9870d513fcf 56 #else // HARD_V2
andriym 87:a9870d513fcf 57
andriym 87:a9870d513fcf 58 // P-MOSFETS
andriym 87:a9870d513fcf 59 #define MED_ON 0
andriym 87:a9870d513fcf 60 #define MED_OFF 1
andriym 87:a9870d513fcf 61 #define HIGH_ON 0
andriym 87:a9870d513fcf 62 #define HIGH_OFF 1
andriym 87:a9870d513fcf 63
andriym 87:a9870d513fcf 64 #endif // HARD_V2
andriym 87:a9870d513fcf 65
andriym 78:43a6b54f0372 66 /////////////////////////////////// LOGIC ///////////////////////////////////
andriym 78:43a6b54f0372 67 #ifdef NORDIC
andriym 78:43a6b54f0372 68
andriym 78:43a6b54f0372 69 #ifndef NO_DISP
andriym 78:43a6b54f0372 70 #define NO_DISP // NORDIC --> no display (use Serial)
andriym 78:43a6b54f0372 71 #endif
andriym 78:43a6b54f0372 72
andriym 79:9db29f41dc9d 73 #define PRESSED 1
andriym 79:9db29f41dc9d 74 #define RELEASED 0
andriym 79:9db29f41dc9d 75
andriym 79:9db29f41dc9d 76 #else // NORDIC
andriym 79:9db29f41dc9d 77
andriym 79:9db29f41dc9d 78 #define PRESSED 0
andriym 79:9db29f41dc9d 79 #define RELEASED 1
andriym 79:9db29f41dc9d 80
andriym 89:425369a595c4 81 #ifdef BLE_ENABLE
andriym 89:425369a595c4 82 #undef BLE_ENABLE
andriym 89:425369a595c4 83 #endif
andriym 89:425369a595c4 84
andriym 79:9db29f41dc9d 85 #endif // NORDIC
andriym 79:9db29f41dc9d 86
andriym 79:9db29f41dc9d 87 /////////////////////// PINS ///////////////////////
andriym 79:9db29f41dc9d 88 #ifdef NORDIC
andriym 79:9db29f41dc9d 89
andriym 87:a9870d513fcf 90 #ifdef HARD_V2
andriym 87:a9870d513fcf 91
andriym 87:a9870d513fcf 92 #define LED_SPACE5 P0_21
andriym 87:a9870d513fcf 93 #define LED_SPACE10 P0_22
andriym 87:a9870d513fcf 94 #define LED_SPACE15 P0_0
andriym 87:a9870d513fcf 95 #define LED_SPACE20 P0_29
andriym 87:a9870d513fcf 96 #define LED_TEAM_A P0_11
andriym 87:a9870d513fcf 97 #define LED_TEAM_B P0_9
andriym 87:a9870d513fcf 98 #define LED_BUZZER_ON P0_8
andriym 87:a9870d513fcf 99
andriym 87:a9870d513fcf 100 #define BUZZER P0_5
andriym 87:a9870d513fcf 101 #define BUZZ_HIGH P0_4
andriym 87:a9870d513fcf 102 #define BUZZ_MED P0_1
andriym 87:a9870d513fcf 103
andriym 87:a9870d513fcf 104 #define BUT_VOL_MORE P0_28
andriym 87:a9870d513fcf 105 #define BUT_VOL_LESS P0_10
andriym 87:a9870d513fcf 106 #define BUT_SPACE P0_15
andriym 87:a9870d513fcf 107 #define BUT_TEAM P0_13
andriym 87:a9870d513fcf 108
andriym 87:a9870d513fcf 109 #else // HARD_V2
andriym 87:a9870d513fcf 110
andriym 79:9db29f41dc9d 111 #define LED_SPACE5 P0_7
andriym 79:9db29f41dc9d 112 #define LED_SPACE10 P0_8
andriym 79:9db29f41dc9d 113 #define LED_SPACE15 P0_9
andriym 79:9db29f41dc9d 114 #define LED_SPACE20 P0_11
andriym 79:9db29f41dc9d 115 #define LED_TEAM_A P0_22
andriym 79:9db29f41dc9d 116 #define LED_TEAM_B P0_0
andriym 79:9db29f41dc9d 117 #define LED_BUZZER_ON P0_3
andriym 79:9db29f41dc9d 118
andriym 79:9db29f41dc9d 119 #define BUZZER P0_5
andriym 79:9db29f41dc9d 120 #define BUZZ_HIGH P0_4
andriym 79:9db29f41dc9d 121 #define BUZZ_MED P0_1
andriym 79:9db29f41dc9d 122 #define BUZZ_LOW P0_2
andriym 79:9db29f41dc9d 123
andriym 79:9db29f41dc9d 124 #define BUT_VOL_MORE P0_28
andriym 79:9db29f41dc9d 125 #define BUT_VOL_LESS P0_10
andriym 79:9db29f41dc9d 126 #define BUT_SPACE P0_21
andriym 79:9db29f41dc9d 127 #define BUT_TEAM P0_15
andriym 79:9db29f41dc9d 128
andriym 87:a9870d513fcf 129 #endif // HARD_V2
andriym 87:a9870d513fcf 130
andriym 79:9db29f41dc9d 131 #define RFM_MOSI P0_19
andriym 79:9db29f41dc9d 132 #define RFM_MISO P0_18
andriym 79:9db29f41dc9d 133 #define RFM_SCK P0_17
andriym 79:9db29f41dc9d 134 #define RFM_SS P0_20
andriym 79:9db29f41dc9d 135 #define RFM_IRQ P0_12
andriym 83:79cb2ba44b66 136 #ifdef ENABLE_PIN
andriym 79:9db29f41dc9d 137 #define RFM_ISM_EN P0_16
andriym 83:79cb2ba44b66 138 #endif // ENABLE_PIN
andriym 79:9db29f41dc9d 139
andriym 79:9db29f41dc9d 140 #define CHARGE P0_6
andriym 79:9db29f41dc9d 141 #define V_MEAS
andriym 79:9db29f41dc9d 142 #define VBAT
andriym 79:9db29f41dc9d 143 #define PWR_BTN
andriym 79:9db29f41dc9d 144
andriym 79:9db29f41dc9d 145 #define ANALOG_IN CHARGE
andriym 79:9db29f41dc9d 146
andriym 79:9db29f41dc9d 147 #else
andriym 79:9db29f41dc9d 148 #ifdef NUCLEO
andriym 79:9db29f41dc9d 149
andriym 81:3cd7de5d01ef 150 #define LED_SPACE5 PC_3
andriym 83:79cb2ba44b66 151 #define LED_SPACE10 D1
andriym 79:9db29f41dc9d 152 #define LED_SPACE15 PA_14
andriym 79:9db29f41dc9d 153 #define LED_SPACE20 PA_15
andriym 79:9db29f41dc9d 154 #define LED_TEAM_A PC_11
andriym 81:3cd7de5d01ef 155 #define LED_TEAM_B PB_2
andriym 81:3cd7de5d01ef 156 #define LED_BUZZER_ON PD_2
andriym 79:9db29f41dc9d 157
andriym 79:9db29f41dc9d 158 #define BUZZER PB_8
andriym 79:9db29f41dc9d 159 #define BUZZ_HIGH
andriym 79:9db29f41dc9d 160 #define BUZZ_MED
andriym 79:9db29f41dc9d 161 #define BUZZ_LOW
andriym 79:9db29f41dc9d 162
andriym 81:3cd7de5d01ef 163 #define BUT_VOL_MORE PC_12
andriym 81:3cd7de5d01ef 164 #define BUT_VOL_LESS PC_10
andriym 81:3cd7de5d01ef 165 #define BUT_SPACE PH_1
andriym 79:9db29f41dc9d 166 #define BUT_TEAM USER_BUTTON
andriym 79:9db29f41dc9d 167
andriym 79:9db29f41dc9d 168 #define RFM_MOSI D11
andriym 79:9db29f41dc9d 169 #define RFM_MISO D12
andriym 79:9db29f41dc9d 170 #define RFM_SCK D13
andriym 79:9db29f41dc9d 171 #define RFM_SS D10
andriym 79:9db29f41dc9d 172 #define RFM_IRQ D9
andriym 83:79cb2ba44b66 173 #ifdef ENABLE_PIN
andriym 83:79cb2ba44b66 174 #define RFM_ISM_EN PA_13
andriym 83:79cb2ba44b66 175 #endif // ENABLE_PIN
andriym 79:9db29f41dc9d 176 #define CHARGE
andriym 79:9db29f41dc9d 177 #define V_MEAS
andriym 79:9db29f41dc9d 178 #define VBAT
andriym 79:9db29f41dc9d 179 #define PWR_BTN
andriym 79:9db29f41dc9d 180
andriym 79:9db29f41dc9d 181 #define ANALOG_IN A5
andriym 79:9db29f41dc9d 182
andriym 79:9db29f41dc9d 183
andriym 79:9db29f41dc9d 184 #else // it's LPC
andriym 79:9db29f41dc9d 185
andriym 79:9db29f41dc9d 186 #define LED_SPACE5
andriym 79:9db29f41dc9d 187 #define LED_SPACE10
andriym 79:9db29f41dc9d 188 #define LED_SPACE15
andriym 79:9db29f41dc9d 189 #define LED_SPACE20
andriym 79:9db29f41dc9d 190 #define LED_TEAM_A
andriym 79:9db29f41dc9d 191 #define LED_TEAM_B
andriym 79:9db29f41dc9d 192 #define LED_BUZZER_ON
andriym 79:9db29f41dc9d 193
andriym 79:9db29f41dc9d 194 #define BUZZER p21
andriym 79:9db29f41dc9d 195 #define BUZZ_HIGH
andriym 79:9db29f41dc9d 196 #define BUZZ_MED
andriym 79:9db29f41dc9d 197 #define BUZZ_LOW
andriym 79:9db29f41dc9d 198
andriym 79:9db29f41dc9d 199 #define BUT_VOL_MORE
andriym 79:9db29f41dc9d 200 #define BUT_VOL_LESS
andriym 79:9db29f41dc9d 201 #define BUT_SPACE
andriym 79:9db29f41dc9d 202 #define BUT_TEAM p5
andriym 79:9db29f41dc9d 203
andriym 79:9db29f41dc9d 204 #define RFM_MOSI p11
andriym 79:9db29f41dc9d 205 #define RFM_MISO p12
andriym 79:9db29f41dc9d 206 #define RFM_SCK p13
andriym 79:9db29f41dc9d 207 #define RFM_SS p10
andriym 79:9db29f41dc9d 208 #define RFM_IRQ p9
andriym 83:79cb2ba44b66 209 #ifdef ENABLE_PIN
andriym 79:9db29f41dc9d 210 #define RFM_ISM_EN
andriym 83:79cb2ba44b66 211 #endif // ENABLE_PIN
andriym 79:9db29f41dc9d 212
andriym 79:9db29f41dc9d 213 #define CHARGE
andriym 79:9db29f41dc9d 214 #define V_MEAS
andriym 79:9db29f41dc9d 215 #define VBAT
andriym 79:9db29f41dc9d 216 #define PWR_BTN
andriym 79:9db29f41dc9d 217
andriym 79:9db29f41dc9d 218 #define ANALOG_IN p15
andriym 79:9db29f41dc9d 219
andriym 79:9db29f41dc9d 220 #endif // NUCLEO
andriym 79:9db29f41dc9d 221 #endif // NORDIC
andriym 83:79cb2ba44b66 222
andriym 83:79cb2ba44b66 223
andriym 83:79cb2ba44b66 224 ////////////////////////////////////////////////////////////
andriym 83:79cb2ba44b66 225 #endif // CONFIGS_h