Andriy Makukha
/
football_project_wo_output
football_project_wo_output
Fork of football_project by
configs.h@98:9241041ec253, 2016-06-16 (annotated)
- Committer:
- andriym
- Date:
- Thu Jun 16 06:52:07 2016 +0000
- Revision:
- 98:9241041ec253
- Parent:
- 95:3cc3ae2e5e7f
Removed timer.;
Who changed what in which revision?
User | Revision | Line number | New 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 | 90:b4d53a870147 | 22 | #define ENABLE_PIN // is there a pin to enable radio via MOSFET? |
andriym | 90:b4d53a870147 | 23 | #define BLE_ENABLE // enable BlueTooth FOTA |
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 | 95:3cc3ae2e5e7f | 73 | #ifdef NUCLEO |
andriym | 95:3cc3ae2e5e7f | 74 | #undef NUCLEO // NORDIC --> not NUCLEO |
andriym | 95:3cc3ae2e5e7f | 75 | #endif |
andriym | 95:3cc3ae2e5e7f | 76 | |
andriym | 95:3cc3ae2e5e7f | 77 | |
andriym | 79:9db29f41dc9d | 78 | #define PRESSED 1 |
andriym | 79:9db29f41dc9d | 79 | #define RELEASED 0 |
andriym | 79:9db29f41dc9d | 80 | |
andriym | 95:3cc3ae2e5e7f | 81 | #else // not NORDIC |
andriym | 95:3cc3ae2e5e7f | 82 | |
andriym | 95:3cc3ae2e5e7f | 83 | #ifdef BLE_ENABLE |
andriym | 95:3cc3ae2e5e7f | 84 | #undef BLE_ENABLE // not NORDIC -> no BLE |
andriym | 95:3cc3ae2e5e7f | 85 | #endif |
andriym | 79:9db29f41dc9d | 86 | |
andriym | 79:9db29f41dc9d | 87 | #define PRESSED 0 |
andriym | 79:9db29f41dc9d | 88 | #define RELEASED 1 |
andriym | 79:9db29f41dc9d | 89 | |
andriym | 79:9db29f41dc9d | 90 | #endif // NORDIC |
andriym | 79:9db29f41dc9d | 91 | |
andriym | 94:831a7fc2d69a | 92 | #ifdef ENABLE_SOUND |
andriym | 94:831a7fc2d69a | 93 | #ifdef NORDIC |
andriym | 94:831a7fc2d69a | 94 | #ifdef HARD_V2 |
andriym | 94:831a7fc2d69a | 95 | #define _TEST_LED_SOUND |
andriym | 94:831a7fc2d69a | 96 | #endif |
andriym | 94:831a7fc2d69a | 97 | #endif |
andriym | 94:831a7fc2d69a | 98 | #endif |
andriym | 94:831a7fc2d69a | 99 | |
andriym | 79:9db29f41dc9d | 100 | /////////////////////// PINS /////////////////////// |
andriym | 79:9db29f41dc9d | 101 | #ifdef NORDIC |
andriym | 79:9db29f41dc9d | 102 | |
andriym | 87:a9870d513fcf | 103 | #ifdef HARD_V2 |
andriym | 87:a9870d513fcf | 104 | |
andriym | 87:a9870d513fcf | 105 | #define LED_SPACE5 P0_21 |
andriym | 87:a9870d513fcf | 106 | #define LED_SPACE10 P0_22 |
andriym | 87:a9870d513fcf | 107 | #define LED_SPACE15 P0_0 |
andriym | 87:a9870d513fcf | 108 | #define LED_SPACE20 P0_29 |
andriym | 87:a9870d513fcf | 109 | #define LED_TEAM_A P0_11 |
andriym | 87:a9870d513fcf | 110 | #define LED_TEAM_B P0_9 |
andriym | 87:a9870d513fcf | 111 | #define LED_BUZZER_ON P0_8 |
andriym | 87:a9870d513fcf | 112 | |
andriym | 87:a9870d513fcf | 113 | #define BUZZER P0_5 |
andriym | 87:a9870d513fcf | 114 | #define BUZZ_HIGH P0_4 |
andriym | 87:a9870d513fcf | 115 | #define BUZZ_MED P0_1 |
andriym | 87:a9870d513fcf | 116 | |
andriym | 87:a9870d513fcf | 117 | #define BUT_VOL_MORE P0_28 |
andriym | 87:a9870d513fcf | 118 | #define BUT_VOL_LESS P0_10 |
andriym | 87:a9870d513fcf | 119 | #define BUT_SPACE P0_15 |
andriym | 87:a9870d513fcf | 120 | #define BUT_TEAM P0_13 |
andriym | 87:a9870d513fcf | 121 | |
andriym | 87:a9870d513fcf | 122 | #else // HARD_V2 |
andriym | 87:a9870d513fcf | 123 | |
andriym | 79:9db29f41dc9d | 124 | #define LED_SPACE5 P0_7 |
andriym | 79:9db29f41dc9d | 125 | #define LED_SPACE10 P0_8 |
andriym | 79:9db29f41dc9d | 126 | #define LED_SPACE15 P0_9 |
andriym | 79:9db29f41dc9d | 127 | #define LED_SPACE20 P0_11 |
andriym | 79:9db29f41dc9d | 128 | #define LED_TEAM_A P0_22 |
andriym | 79:9db29f41dc9d | 129 | #define LED_TEAM_B P0_0 |
andriym | 79:9db29f41dc9d | 130 | #define LED_BUZZER_ON P0_3 |
andriym | 79:9db29f41dc9d | 131 | |
andriym | 79:9db29f41dc9d | 132 | #define BUZZER P0_5 |
andriym | 79:9db29f41dc9d | 133 | #define BUZZ_HIGH P0_4 |
andriym | 79:9db29f41dc9d | 134 | #define BUZZ_MED P0_1 |
andriym | 79:9db29f41dc9d | 135 | #define BUZZ_LOW P0_2 |
andriym | 79:9db29f41dc9d | 136 | |
andriym | 79:9db29f41dc9d | 137 | #define BUT_VOL_MORE P0_28 |
andriym | 79:9db29f41dc9d | 138 | #define BUT_VOL_LESS P0_10 |
andriym | 79:9db29f41dc9d | 139 | #define BUT_SPACE P0_21 |
andriym | 79:9db29f41dc9d | 140 | #define BUT_TEAM P0_15 |
andriym | 79:9db29f41dc9d | 141 | |
andriym | 87:a9870d513fcf | 142 | #endif // HARD_V2 |
andriym | 87:a9870d513fcf | 143 | |
andriym | 79:9db29f41dc9d | 144 | #define RFM_MOSI P0_19 |
andriym | 79:9db29f41dc9d | 145 | #define RFM_MISO P0_18 |
andriym | 79:9db29f41dc9d | 146 | #define RFM_SCK P0_17 |
andriym | 79:9db29f41dc9d | 147 | #define RFM_SS P0_20 |
andriym | 79:9db29f41dc9d | 148 | #define RFM_IRQ P0_12 |
andriym | 83:79cb2ba44b66 | 149 | #ifdef ENABLE_PIN |
andriym | 79:9db29f41dc9d | 150 | #define RFM_ISM_EN P0_16 |
andriym | 83:79cb2ba44b66 | 151 | #endif // ENABLE_PIN |
andriym | 79:9db29f41dc9d | 152 | |
andriym | 79:9db29f41dc9d | 153 | #define CHARGE P0_6 |
andriym | 79:9db29f41dc9d | 154 | #define V_MEAS |
andriym | 79:9db29f41dc9d | 155 | #define VBAT |
andriym | 79:9db29f41dc9d | 156 | #define PWR_BTN |
andriym | 79:9db29f41dc9d | 157 | |
andriym | 79:9db29f41dc9d | 158 | #define ANALOG_IN CHARGE |
andriym | 79:9db29f41dc9d | 159 | |
andriym | 79:9db29f41dc9d | 160 | #else |
andriym | 79:9db29f41dc9d | 161 | #ifdef NUCLEO |
andriym | 79:9db29f41dc9d | 162 | |
andriym | 81:3cd7de5d01ef | 163 | #define LED_SPACE5 PC_3 |
andriym | 83:79cb2ba44b66 | 164 | #define LED_SPACE10 D1 |
andriym | 79:9db29f41dc9d | 165 | #define LED_SPACE15 PA_14 |
andriym | 79:9db29f41dc9d | 166 | #define LED_SPACE20 PA_15 |
andriym | 79:9db29f41dc9d | 167 | #define LED_TEAM_A PC_11 |
andriym | 81:3cd7de5d01ef | 168 | #define LED_TEAM_B PB_2 |
andriym | 81:3cd7de5d01ef | 169 | #define LED_BUZZER_ON PD_2 |
andriym | 79:9db29f41dc9d | 170 | |
andriym | 79:9db29f41dc9d | 171 | #define BUZZER PB_8 |
andriym | 79:9db29f41dc9d | 172 | #define BUZZ_HIGH |
andriym | 79:9db29f41dc9d | 173 | #define BUZZ_MED |
andriym | 79:9db29f41dc9d | 174 | #define BUZZ_LOW |
andriym | 79:9db29f41dc9d | 175 | |
andriym | 81:3cd7de5d01ef | 176 | #define BUT_VOL_MORE PC_12 |
andriym | 81:3cd7de5d01ef | 177 | #define BUT_VOL_LESS PC_10 |
andriym | 81:3cd7de5d01ef | 178 | #define BUT_SPACE PH_1 |
andriym | 79:9db29f41dc9d | 179 | #define BUT_TEAM USER_BUTTON |
andriym | 79:9db29f41dc9d | 180 | |
andriym | 79:9db29f41dc9d | 181 | #define RFM_MOSI D11 |
andriym | 79:9db29f41dc9d | 182 | #define RFM_MISO D12 |
andriym | 79:9db29f41dc9d | 183 | #define RFM_SCK D13 |
andriym | 79:9db29f41dc9d | 184 | #define RFM_SS D10 |
andriym | 79:9db29f41dc9d | 185 | #define RFM_IRQ D9 |
andriym | 83:79cb2ba44b66 | 186 | #ifdef ENABLE_PIN |
andriym | 83:79cb2ba44b66 | 187 | #define RFM_ISM_EN PA_13 |
andriym | 83:79cb2ba44b66 | 188 | #endif // ENABLE_PIN |
andriym | 79:9db29f41dc9d | 189 | #define CHARGE |
andriym | 79:9db29f41dc9d | 190 | #define V_MEAS |
andriym | 79:9db29f41dc9d | 191 | #define VBAT |
andriym | 79:9db29f41dc9d | 192 | #define PWR_BTN |
andriym | 79:9db29f41dc9d | 193 | |
andriym | 79:9db29f41dc9d | 194 | #define ANALOG_IN A5 |
andriym | 79:9db29f41dc9d | 195 | |
andriym | 79:9db29f41dc9d | 196 | |
andriym | 79:9db29f41dc9d | 197 | #else // it's LPC |
andriym | 79:9db29f41dc9d | 198 | |
andriym | 79:9db29f41dc9d | 199 | #define LED_SPACE5 |
andriym | 79:9db29f41dc9d | 200 | #define LED_SPACE10 |
andriym | 79:9db29f41dc9d | 201 | #define LED_SPACE15 |
andriym | 79:9db29f41dc9d | 202 | #define LED_SPACE20 |
andriym | 79:9db29f41dc9d | 203 | #define LED_TEAM_A |
andriym | 79:9db29f41dc9d | 204 | #define LED_TEAM_B |
andriym | 79:9db29f41dc9d | 205 | #define LED_BUZZER_ON |
andriym | 79:9db29f41dc9d | 206 | |
andriym | 79:9db29f41dc9d | 207 | #define BUZZER p21 |
andriym | 79:9db29f41dc9d | 208 | #define BUZZ_HIGH |
andriym | 79:9db29f41dc9d | 209 | #define BUZZ_MED |
andriym | 79:9db29f41dc9d | 210 | #define BUZZ_LOW |
andriym | 79:9db29f41dc9d | 211 | |
andriym | 79:9db29f41dc9d | 212 | #define BUT_VOL_MORE |
andriym | 79:9db29f41dc9d | 213 | #define BUT_VOL_LESS |
andriym | 79:9db29f41dc9d | 214 | #define BUT_SPACE |
andriym | 79:9db29f41dc9d | 215 | #define BUT_TEAM p5 |
andriym | 79:9db29f41dc9d | 216 | |
andriym | 79:9db29f41dc9d | 217 | #define RFM_MOSI p11 |
andriym | 79:9db29f41dc9d | 218 | #define RFM_MISO p12 |
andriym | 79:9db29f41dc9d | 219 | #define RFM_SCK p13 |
andriym | 79:9db29f41dc9d | 220 | #define RFM_SS p10 |
andriym | 79:9db29f41dc9d | 221 | #define RFM_IRQ p9 |
andriym | 83:79cb2ba44b66 | 222 | #ifdef ENABLE_PIN |
andriym | 79:9db29f41dc9d | 223 | #define RFM_ISM_EN |
andriym | 83:79cb2ba44b66 | 224 | #endif // ENABLE_PIN |
andriym | 79:9db29f41dc9d | 225 | |
andriym | 79:9db29f41dc9d | 226 | #define CHARGE |
andriym | 79:9db29f41dc9d | 227 | #define V_MEAS |
andriym | 79:9db29f41dc9d | 228 | #define VBAT |
andriym | 79:9db29f41dc9d | 229 | #define PWR_BTN |
andriym | 79:9db29f41dc9d | 230 | |
andriym | 79:9db29f41dc9d | 231 | #define ANALOG_IN p15 |
andriym | 79:9db29f41dc9d | 232 | |
andriym | 79:9db29f41dc9d | 233 | #endif // NUCLEO |
andriym | 79:9db29f41dc9d | 234 | #endif // NORDIC |
andriym | 83:79cb2ba44b66 | 235 | |
andriym | 83:79cb2ba44b66 | 236 | |
andriym | 83:79cb2ba44b66 | 237 | //////////////////////////////////////////////////////////// |
andriym | 83:79cb2ba44b66 | 238 | #endif // CONFIGS_h |