LP Long Distance IR Vision Robot
Dependencies: max77650_charger_sample BufferedSerial SX1276GenericLib Adafruit-MotorShield NEO-6m-GPS MAX17055_EZconfig Adafruit_GFX USBDeviceHT Adafruit-PWM-Servo-Driver
main.cpp@38:c10d2a04a0c2, 2018-08-01 (annotated)
- Committer:
- dev_alexander
- Date:
- Wed Aug 01 01:46:12 2018 +0000
- Revision:
- 38:c10d2a04a0c2
- Parent:
- 37:f0fcc0341654
I added support for the OLED on the Master device, and support for the MAX17055 and MAX77650 on the slave devices.;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Helmut64 | 0:c43b6919ae15 | 1 | /* |
Helmut64 | 17:98f2528e8399 | 2 | * Copyright (c) 2018 HELIOS Software GmbH |
Helmut64 | 0:c43b6919ae15 | 3 | * 30826 Garbsen (Hannover) Germany |
Helmut64 | 0:c43b6919ae15 | 4 | * Licensed under the Apache License, Version 2.0); |
Helmut64 | 0:c43b6919ae15 | 5 | */ |
dev_alexander | 21:1b92cabe8a3b | 6 | |
dev_alexander | 21:1b92cabe8a3b | 7 | /* |
dev_alexander | 21:1b92cabe8a3b | 8 | * For Wiring Instructions, please visit the link below: |
dev_alexander | 21:1b92cabe8a3b | 9 | * https://www.hackster.io/DevinAlex64/getting-started-with-the-max32620fthr-and-lora-f9d8dd\ |
dev_alexander | 21:1b92cabe8a3b | 10 | */ |
dev_alexander | 37:f0fcc0341654 | 11 | |
dev_alexander | 37:f0fcc0341654 | 12 | /*************************************************************************** |
dev_alexander | 37:f0fcc0341654 | 13 | * Misc Instantiation |
dev_alexander | 38:c10d2a04a0c2 | 14 | **************************************************************************/\ |
dev_alexander | 38:c10d2a04a0c2 | 15 | #include "mbed.h" |
dev_alexander | 30:66f9750cc44c | 16 | #include "main.h" |
dev_alexander | 30:66f9750cc44c | 17 | #include "global_buffers.h" |
dev_alexander | 35:bae9b236070b | 18 | //#define DEBUG_GRID_EYE |
dev_alexander | 32:b108ed6096b0 | 19 | #define RASPBERRY_PI |
dev_alexander | 37:f0fcc0341654 | 20 | DigitalOut myled(LED); |
dev_alexander | 37:f0fcc0341654 | 21 | Serial pc(USBTX, USBRX); |
dev_alexander | 32:b108ed6096b0 | 22 | |
dev_alexander | 38:c10d2a04a0c2 | 23 | I2C i2cBus0(P1_6, P1_7); |
dev_alexander | 38:c10d2a04a0c2 | 24 | I2C i2cBus1(P3_4, P3_5); |
dev_alexander | 38:c10d2a04a0c2 | 25 | I2C i2cBus2(P5_7, P6_0); |
dev_alexander | 23:f74a50977593 | 26 | |
dev_alexander | 37:f0fcc0341654 | 27 | /*************************************************************************** |
dev_alexander | 37:f0fcc0341654 | 28 | * MAX32630FTHR Instantiation |
dev_alexander | 37:f0fcc0341654 | 29 | **************************************************************************/ |
dev_alexander | 37:f0fcc0341654 | 30 | #if defined(TARGET_MAX32630FTHR) |
dev_alexander | 37:f0fcc0341654 | 31 | /* If the board that is compiled is the master device (BLE enabled MAX32630FTHR), |
dev_alexander | 37:f0fcc0341654 | 32 | * then it needs this library and needs to be configed in order for the device to |
dev_alexander | 37:f0fcc0341654 | 33 | * work with a 3.3volt output instead of a 1.8 volt output. |
dev_alexander | 37:f0fcc0341654 | 34 | * |
dev_alexander | 37:f0fcc0341654 | 35 | * This is only needed for the MAX32630FTHR. The MAX325620FTHR is exampt from this |
dev_alexander | 37:f0fcc0341654 | 36 | * additional setup in the main program. |
dev_alexander | 37:f0fcc0341654 | 37 | */ |
dev_alexander | 37:f0fcc0341654 | 38 | #include "max32630fthr.h" |
dev_alexander | 37:f0fcc0341654 | 39 | MAX32630FTHR pegasus(MAX32630FTHR::VIO_3V3); |
dev_alexander | 37:f0fcc0341654 | 40 | #endif |
dev_alexander | 37:f0fcc0341654 | 41 | |
dev_alexander | 37:f0fcc0341654 | 42 | /*************************************************************************** |
dev_alexander | 37:f0fcc0341654 | 43 | * MAX32620FTHR Instantiation |
dev_alexander | 37:f0fcc0341654 | 44 | **************************************************************************/ |
dev_alexander | 31:f15747cffb20 | 45 | #if defined(TARGET_MAX32620FTHR) |
dev_alexander | 38:c10d2a04a0c2 | 46 | |
dev_alexander | 32:b108ed6096b0 | 47 | #endif |
dev_alexander | 32:b108ed6096b0 | 48 | |
dev_alexander | 32:b108ed6096b0 | 49 | |
dev_alexander | 37:f0fcc0341654 | 50 | /*************************************************************************** |
dev_alexander | 37:f0fcc0341654 | 51 | * Grid Eye Sensor Instantiation |
dev_alexander | 37:f0fcc0341654 | 52 | **************************************************************************/ |
dev_alexander | 37:f0fcc0341654 | 53 | #include "GridEye.h" |
Helmut64 | 0:c43b6919ae15 | 54 | |
dev_alexander | 23:f74a50977593 | 55 | #if defined(TARGET_MAX32630FTHR) // Master Device: MAX32630FTHR BLE-to-LoRa Gateway |
dev_alexander | 23:f74a50977593 | 56 | /* No grid eye object needed. The function the master uses to convert the raw |
dev_alexander | 23:f74a50977593 | 57 | * data that is sent over from the slave deevice that contains the data from the |
dev_alexander | 23:f74a50977593 | 58 | * actual grid eye sensor is actually a function that is not part of the grid eye |
dev_alexander | 23:f74a50977593 | 59 | * class. this is due to the fact that the grid eye class requires n i2c bus to |
dev_alexander | 23:f74a50977593 | 60 | * be assigned to a phyiscal sensor. In this case, the library for the Grid Eye |
dev_alexander | 32:b108ed6096b0 | 61 | * sensor has a support function that is used to convert data that is aquired from |
dev_alexander | 23:f74a50977593 | 62 | * the grid eye sensor. So it is not supposed to be a class specific function. |
dev_alexander | 37:f0fcc0341654 | 63 | */ |
dev_alexander | 32:b108ed6096b0 | 64 | #elif defined(TARGET_MAX32620FTHR) // Slave Device: LoRa Controlled Robot |
dev_alexander | 38:c10d2a04a0c2 | 65 | GridEye gridEye(i2cBus0); |
dev_alexander | 23:f74a50977593 | 66 | #endif |
dev_alexander | 19:9f035b9e65ec | 67 | |
dev_alexander | 37:f0fcc0341654 | 68 | /*************************************************************************** |
dev_alexander | 37:f0fcc0341654 | 69 | * GPS Instantiation |
dev_alexander | 37:f0fcc0341654 | 70 | **************************************************************************/ |
dev_alexander | 37:f0fcc0341654 | 71 | #if defined(TARGET_MAX32630FTHR) // Master Device: MAX32630FTHR BLE-to-LoRa Gateway |
dev_alexander | 37:f0fcc0341654 | 72 | // No GPS module on the master device |
dev_alexander | 37:f0fcc0341654 | 73 | #elif defined(TARGET_MAX32620FTHR) // Slave Device: LoRa Controlled Robot |
dev_alexander | 37:f0fcc0341654 | 74 | #include "GPS.h" |
dev_alexander | 37:f0fcc0341654 | 75 | GPS gps(P0_1, P0_0, 115200); // (Tx, Rx, Baud rate) |
dev_alexander | 37:f0fcc0341654 | 76 | #endif |
dev_alexander | 37:f0fcc0341654 | 77 | |
dev_alexander | 37:f0fcc0341654 | 78 | /*************************************************************************** |
dev_alexander | 37:f0fcc0341654 | 79 | * MAX77650 Instatiation |
dev_alexander | 37:f0fcc0341654 | 80 | **************************************************************************/ |
dev_alexander | 38:c10d2a04a0c2 | 81 | #if defined(TARGET_MAX32630FTHR) // Master Device: MAX32630FTHR BLE-to-LoRa Gateway |
dev_alexander | 38:c10d2a04a0c2 | 82 | // No MAX77650 PMIC on this board |
dev_alexander | 38:c10d2a04a0c2 | 83 | #elif defined(TARGET_MAX32620FTHR) // Slave Device: LoRa Controlled Robot |
dev_alexander | 38:c10d2a04a0c2 | 84 | #include "max77650.h" |
dev_alexander | 38:c10d2a04a0c2 | 85 | |
dev_alexander | 38:c10d2a04a0c2 | 86 | // Definitions for running board off of battery |
dev_alexander | 38:c10d2a04a0c2 | 87 | #define POWER_HOLD_ON 1 |
dev_alexander | 38:c10d2a04a0c2 | 88 | #define POWER_HOLD_OFF 0 |
dev_alexander | 38:c10d2a04a0c2 | 89 | |
dev_alexander | 38:c10d2a04a0c2 | 90 | /* This is the pin that the MAX77650's Power Hold pin is connected to on MAX32620FTHR |
dev_alexander | 38:c10d2a04a0c2 | 91 | * Without programming it to POWER_HOLD_ON, the device cant be started off of battery |
dev_alexander | 38:c10d2a04a0c2 | 92 | * power alone. |
dev_alexander | 38:c10d2a04a0c2 | 93 | */ |
dev_alexander | 38:c10d2a04a0c2 | 94 | DigitalOut pw_Hold(P2_2, POWER_HOLD_ON); |
dev_alexander | 38:c10d2a04a0c2 | 95 | |
dev_alexander | 38:c10d2a04a0c2 | 96 | // Instatiate instance of the Simo Pimic |
dev_alexander | 38:c10d2a04a0c2 | 97 | MAX77650 simo_pmic(i2cBus2); |
dev_alexander | 38:c10d2a04a0c2 | 98 | |
dev_alexander | 38:c10d2a04a0c2 | 99 | // Battery Charger Interrupt |
dev_alexander | 38:c10d2a04a0c2 | 100 | InterruptIn simoIRQ(P2_3); |
dev_alexander | 38:c10d2a04a0c2 | 101 | |
dev_alexander | 38:c10d2a04a0c2 | 102 | void charger_Detect(); |
dev_alexander | 38:c10d2a04a0c2 | 103 | bool chrg_State_fn(); |
dev_alexander | 38:c10d2a04a0c2 | 104 | |
dev_alexander | 38:c10d2a04a0c2 | 105 | void charger_Detect() |
dev_alexander | 38:c10d2a04a0c2 | 106 | { |
dev_alexander | 38:c10d2a04a0c2 | 107 | |
dev_alexander | 38:c10d2a04a0c2 | 108 | uint8_t int_chr_value,temp, int_chr_MASK = 0x04; |
dev_alexander | 38:c10d2a04a0c2 | 109 | int status; |
dev_alexander | 38:c10d2a04a0c2 | 110 | pc.printf("Charger Detected \n"); |
dev_alexander | 38:c10d2a04a0c2 | 111 | status = simo_pmic.readReg(MAX77650::INT_CHG, int_chr_value); |
dev_alexander | 38:c10d2a04a0c2 | 112 | pc.printf("INT_CHR val= %X \n", int_chr_value); |
dev_alexander | 38:c10d2a04a0c2 | 113 | if (status == 1){ |
dev_alexander | 38:c10d2a04a0c2 | 114 | temp = int_chr_value & int_chr_MASK; |
dev_alexander | 38:c10d2a04a0c2 | 115 | pc.printf("INT_CHR anded= %X \n", temp); |
dev_alexander | 38:c10d2a04a0c2 | 116 | if (temp == 4){ |
dev_alexander | 38:c10d2a04a0c2 | 117 | pc.printf("enable charger \n"); |
dev_alexander | 38:c10d2a04a0c2 | 118 | simo_pmic.enCharger(); |
dev_alexander | 38:c10d2a04a0c2 | 119 | } |
dev_alexander | 38:c10d2a04a0c2 | 120 | } |
dev_alexander | 38:c10d2a04a0c2 | 121 | } |
dev_alexander | 38:c10d2a04a0c2 | 122 | |
dev_alexander | 38:c10d2a04a0c2 | 123 | bool chrg_State_fn() |
dev_alexander | 38:c10d2a04a0c2 | 124 | { |
dev_alexander | 38:c10d2a04a0c2 | 125 | uint8_t status_chr_value,temp, chr_status_MASK = 0x02; |
dev_alexander | 38:c10d2a04a0c2 | 126 | int status; |
dev_alexander | 38:c10d2a04a0c2 | 127 | pc.printf("Charger State \n"); |
dev_alexander | 38:c10d2a04a0c2 | 128 | status = simo_pmic.readReg(MAX77650::STAT_CHG_B, status_chr_value); |
dev_alexander | 38:c10d2a04a0c2 | 129 | pc.printf("STAR_CHG_B val= %X \n", status_chr_value); |
dev_alexander | 38:c10d2a04a0c2 | 130 | if (status == 1){ |
dev_alexander | 38:c10d2a04a0c2 | 131 | temp = status_chr_value & chr_status_MASK; |
dev_alexander | 38:c10d2a04a0c2 | 132 | pc.printf("STAR_CHG_B val= %X \n", temp); |
dev_alexander | 38:c10d2a04a0c2 | 133 | if (temp == 2){ |
dev_alexander | 38:c10d2a04a0c2 | 134 | return true; |
dev_alexander | 38:c10d2a04a0c2 | 135 | } |
dev_alexander | 38:c10d2a04a0c2 | 136 | return false; |
dev_alexander | 38:c10d2a04a0c2 | 137 | } |
dev_alexander | 38:c10d2a04a0c2 | 138 | return false; |
dev_alexander | 38:c10d2a04a0c2 | 139 | } |
dev_alexander | 38:c10d2a04a0c2 | 140 | |
dev_alexander | 38:c10d2a04a0c2 | 141 | #endif |
dev_alexander | 38:c10d2a04a0c2 | 142 | |
dev_alexander | 37:f0fcc0341654 | 143 | |
dev_alexander | 37:f0fcc0341654 | 144 | /*************************************************************************** |
dev_alexander | 37:f0fcc0341654 | 145 | * MAX17055 Instatiation |
dev_alexander | 37:f0fcc0341654 | 146 | **************************************************************************/ |
dev_alexander | 38:c10d2a04a0c2 | 147 | #if defined(TARGET_MAX32630FTHR) // Master Device: MAX32630FTHR BLE-to-LoRa Gateway |
dev_alexander | 38:c10d2a04a0c2 | 148 | // No MAX77650 PMIC on this board |
dev_alexander | 38:c10d2a04a0c2 | 149 | #elif defined(TARGET_MAX32620FTHR) // Slave Device: LoRa Controlled Robot |
dev_alexander | 38:c10d2a04a0c2 | 150 | #include "max17055.h" |
dev_alexander | 38:c10d2a04a0c2 | 151 | |
dev_alexander | 38:c10d2a04a0c2 | 152 | MAX17055 fuelGauge(i2cBus2); |
dev_alexander | 38:c10d2a04a0c2 | 153 | MAX17055::platform_data design_param; |
dev_alexander | 38:c10d2a04a0c2 | 154 | |
dev_alexander | 38:c10d2a04a0c2 | 155 | #endif |
dev_alexander | 38:c10d2a04a0c2 | 156 | |
dev_alexander | 38:c10d2a04a0c2 | 157 | |
dev_alexander | 37:f0fcc0341654 | 158 | /*************************************************************************** |
dev_alexander | 37:f0fcc0341654 | 159 | * OLED Instatiation |
dev_alexander | 37:f0fcc0341654 | 160 | **************************************************************************/ |
dev_alexander | 38:c10d2a04a0c2 | 161 | #if defined(TARGET_MAX32630FTHR) // Master Device: MAX32630FTHR BLE-to-LoRa Gateway |
dev_alexander | 38:c10d2a04a0c2 | 162 | #include "Adafruit_SSD1306.h" |
dev_alexander | 38:c10d2a04a0c2 | 163 | #include "maxim_bitmap.h" |
dev_alexander | 38:c10d2a04a0c2 | 164 | Adafruit_SSD1306_I2c displayOled(i2cBus1); |
dev_alexander | 38:c10d2a04a0c2 | 165 | |
dev_alexander | 38:c10d2a04a0c2 | 166 | |
dev_alexander | 38:c10d2a04a0c2 | 167 | #elif defined(TARGET_MAX32620FTHR) // Slave Device: LoRa Controlled Robot |
dev_alexander | 38:c10d2a04a0c2 | 168 | /* Currently, there is no OLED display attached to the MAX32620, |
dev_alexander | 38:c10d2a04a0c2 | 169 | * so we are not compiling for it at the moment |
dev_alexander | 38:c10d2a04a0c2 | 170 | */ |
dev_alexander | 38:c10d2a04a0c2 | 171 | #endif |
dev_alexander | 38:c10d2a04a0c2 | 172 | |
dev_alexander | 37:f0fcc0341654 | 173 | |
dev_alexander | 37:f0fcc0341654 | 174 | /*************************************************************************** |
dev_alexander | 37:f0fcc0341654 | 175 | * BLE Instatiation and Related Functions |
dev_alexander | 37:f0fcc0341654 | 176 | **************************************************************************/ |
dev_alexander | 37:f0fcc0341654 | 177 | #if defined(TARGET_MAX32630FTHR) // Master Device: MAX32630FTHR BLE-to-LoRa Gateway |
dev_alexander | 37:f0fcc0341654 | 178 | #include "ble/BLE.h" |
dev_alexander | 37:f0fcc0341654 | 179 | //#include "ble/Gap.h" |
dev_alexander | 37:f0fcc0341654 | 180 | #include "UARTService_custom.h" |
dev_alexander | 37:f0fcc0341654 | 181 | #include <events/mbed_events.h> |
dev_alexander | 37:f0fcc0341654 | 182 | |
dev_alexander | 37:f0fcc0341654 | 183 | DigitalOut led2(LED2); |
dev_alexander | 37:f0fcc0341654 | 184 | UARTService *uart; |
dev_alexander | 37:f0fcc0341654 | 185 | |
dev_alexander | 37:f0fcc0341654 | 186 | #define NEED_CONSOLE_OUTPUT 1 /* Set this if you need debug messages on the console; |
dev_alexander | 37:f0fcc0341654 | 187 | * it will have an impact on code-size and power consumption. */ |
dev_alexander | 37:f0fcc0341654 | 188 | |
dev_alexander | 37:f0fcc0341654 | 189 | #if NEED_CONSOLE_OUTPUT |
dev_alexander | 37:f0fcc0341654 | 190 | #define DEBUG(STR) { if (uart) uart->write(STR, strlen(STR)); } |
dev_alexander | 37:f0fcc0341654 | 191 | #define READ(STR) { if (uart) uart->read(STR, strlen(STR)); } |
dev_alexander | 37:f0fcc0341654 | 192 | |
dev_alexander | 37:f0fcc0341654 | 193 | #else |
dev_alexander | 37:f0fcc0341654 | 194 | #define DEBUG(...) /* nothing */ |
dev_alexander | 37:f0fcc0341654 | 195 | #endif /* #if NEED_CONSOLE_OUTPUT */ |
dev_alexander | 37:f0fcc0341654 | 196 | |
dev_alexander | 37:f0fcc0341654 | 197 | //Triggered when the robot is disconnected from the mobile app. |
dev_alexander | 37:f0fcc0341654 | 198 | void disconnectionCallback(const Gap::DisconnectionCallbackParams_t *params) |
dev_alexander | 37:f0fcc0341654 | 199 | { |
dev_alexander | 37:f0fcc0341654 | 200 | BLE &ble = BLE::Instance(); |
dev_alexander | 37:f0fcc0341654 | 201 | DEBUG("Disconnected!\n\r"); |
dev_alexander | 37:f0fcc0341654 | 202 | DEBUG("Restarting the advertising process\n\r"); |
dev_alexander | 37:f0fcc0341654 | 203 | ble.gap().startAdvertising(); |
dev_alexander | 37:f0fcc0341654 | 204 | } |
dev_alexander | 37:f0fcc0341654 | 205 | |
dev_alexander | 37:f0fcc0341654 | 206 | /* This pointer is needed to reference data in the main program when filling |
dev_alexander | 37:f0fcc0341654 | 207 | * with data from the BLE |
dev_alexander | 37:f0fcc0341654 | 208 | */ |
dev_alexander | 37:f0fcc0341654 | 209 | uint8_t * onDataWritten_curr_ble_to_slave; |
dev_alexander | 37:f0fcc0341654 | 210 | |
dev_alexander | 37:f0fcc0341654 | 211 | // Triggered when there is data written |
dev_alexander | 37:f0fcc0341654 | 212 | void onDataWritten(const GattWriteCallbackParams *params) |
dev_alexander | 37:f0fcc0341654 | 213 | { |
dev_alexander | 37:f0fcc0341654 | 214 | //LED1 will be off when button is pressed, and on when button is released. |
dev_alexander | 37:f0fcc0341654 | 215 | led2 = !led2; |
dev_alexander | 37:f0fcc0341654 | 216 | uint8_t button_state; |
dev_alexander | 37:f0fcc0341654 | 217 | uint8_t direction; |
dev_alexander | 37:f0fcc0341654 | 218 | |
dev_alexander | 37:f0fcc0341654 | 219 | /* If there is a valid data sent by the mobile app */ |
dev_alexander | 37:f0fcc0341654 | 220 | if ((uart != NULL) && (params->handle == uart ->getTXCharacteristicHandle())) { |
dev_alexander | 37:f0fcc0341654 | 221 | const uint8_t *packet = params->data; |
dev_alexander | 37:f0fcc0341654 | 222 | button_state = packet[3]; |
dev_alexander | 37:f0fcc0341654 | 223 | direction = packet[2]; |
dev_alexander | 37:f0fcc0341654 | 224 | |
dev_alexander | 37:f0fcc0341654 | 225 | // make parameter to send over Lora |
dev_alexander | 37:f0fcc0341654 | 226 | onDataWritten_curr_ble_to_slave[0] = direction; |
dev_alexander | 37:f0fcc0341654 | 227 | onDataWritten_curr_ble_to_slave[1] = button_state; |
dev_alexander | 37:f0fcc0341654 | 228 | |
dev_alexander | 37:f0fcc0341654 | 229 | //dprintf("direction: %d\n", direction); |
dev_alexander | 37:f0fcc0341654 | 230 | //dprintf("button_state: %d\n", button_state); |
dev_alexander | 37:f0fcc0341654 | 231 | } |
dev_alexander | 37:f0fcc0341654 | 232 | } |
dev_alexander | 37:f0fcc0341654 | 233 | #elif defined(TARGET_MAX32620FTHR) // Slave Device: LoRa Controlled Robot |
dev_alexander | 37:f0fcc0341654 | 234 | // No BLE chip on the MAX32620FTHR so this is not needed |
dev_alexander | 37:f0fcc0341654 | 235 | #endif |
dev_alexander | 37:f0fcc0341654 | 236 | |
dev_alexander | 37:f0fcc0341654 | 237 | /*************************************************************************** |
dev_alexander | 37:f0fcc0341654 | 238 | * Motor Controller Instatiation and Related Functions |
dev_alexander | 37:f0fcc0341654 | 239 | **************************************************************************/ |
dev_alexander | 37:f0fcc0341654 | 240 | #if defined(TARGET_MAX32630FTHR) // Master Device: MAX32630FTHR BLE-to-LoRa Gateway |
dev_alexander | 37:f0fcc0341654 | 241 | // There is no motor on this device. |
dev_alexander | 37:f0fcc0341654 | 242 | #elif defined(TARGET_MAX32620FTHR) // Slave Device: LoRa Controlled Robot |
dev_alexander | 37:f0fcc0341654 | 243 | /* This is a port of a library that was developed by Adafruit for the Arduino. |
dev_alexander | 37:f0fcc0341654 | 244 | * This port was done by mbed user syundo0730. */ |
dev_alexander | 37:f0fcc0341654 | 245 | #include "Adafruit_MotorShield.h" |
dev_alexander | 37:f0fcc0341654 | 246 | #include "Adafruit_PWMServoDriver.h" |
dev_alexander | 37:f0fcc0341654 | 247 | |
dev_alexander | 37:f0fcc0341654 | 248 | // These are the defined speeds that are selected out of the number range (0, 255). |
dev_alexander | 37:f0fcc0341654 | 249 | #define MOTOR_OFF 0 |
dev_alexander | 37:f0fcc0341654 | 250 | #define MOTOR_FORWARD 150 |
dev_alexander | 37:f0fcc0341654 | 251 | #define MOTOR_BACKWARD 150 |
dev_alexander | 37:f0fcc0341654 | 252 | #define MOTOR_TURN 100 |
dev_alexander | 37:f0fcc0341654 | 253 | |
dev_alexander | 37:f0fcc0341654 | 254 | // Create the motor shield object with the default I2C address |
dev_alexander | 37:f0fcc0341654 | 255 | Adafruit_MotorShield AFMS = Adafruit_MotorShield(P3_4, P3_5, 0x60 << 1); // You have to shift it over by one due to how mbed does its I2C Addressing. |
dev_alexander | 37:f0fcc0341654 | 256 | // Or, create it with a different I2C address (say for stacking) |
dev_alexander | 37:f0fcc0341654 | 257 | // Adafruit_MotorShield AFMS = Adafruit_MotorShield(0x61); |
dev_alexander | 37:f0fcc0341654 | 258 | // Select which 'port' M1, M2, M3 or M4. In this case, M1 |
dev_alexander | 37:f0fcc0341654 | 259 | Adafruit_DCMotor *rightMotor = AFMS.getMotor(1); |
dev_alexander | 37:f0fcc0341654 | 260 | // You can also make another motor on port M4 |
dev_alexander | 37:f0fcc0341654 | 261 | Adafruit_DCMotor *leftMotor = AFMS.getMotor(4); |
dev_alexander | 37:f0fcc0341654 | 262 | |
dev_alexander | 37:f0fcc0341654 | 263 | |
dev_alexander | 37:f0fcc0341654 | 264 | void MotorController(uint8_t (BLE_data_server)[2]) |
dev_alexander | 37:f0fcc0341654 | 265 | { |
dev_alexander | 37:f0fcc0341654 | 266 | uint8_t button_state; |
dev_alexander | 37:f0fcc0341654 | 267 | uint8_t direction; |
dev_alexander | 37:f0fcc0341654 | 268 | /*Set up constants for direction of motion */ |
dev_alexander | 37:f0fcc0341654 | 269 | const char FRONT = '5'; |
dev_alexander | 37:f0fcc0341654 | 270 | const char BACK = '6'; |
dev_alexander | 37:f0fcc0341654 | 271 | const char LEFT = '7'; |
dev_alexander | 37:f0fcc0341654 | 272 | const char RIGHT = '8'; |
dev_alexander | 37:f0fcc0341654 | 273 | |
dev_alexander | 37:f0fcc0341654 | 274 | /*Set up constants for button state */ |
dev_alexander | 37:f0fcc0341654 | 275 | const char PRESSED = '1'; |
dev_alexander | 37:f0fcc0341654 | 276 | const char RELEASED = '0'; |
dev_alexander | 37:f0fcc0341654 | 277 | |
dev_alexander | 37:f0fcc0341654 | 278 | |
dev_alexander | 37:f0fcc0341654 | 279 | button_state = BLE_data_server[1]; |
dev_alexander | 37:f0fcc0341654 | 280 | direction = BLE_data_server[0]; |
dev_alexander | 37:f0fcc0341654 | 281 | |
dev_alexander | 37:f0fcc0341654 | 282 | switch (button_state) |
dev_alexander | 37:f0fcc0341654 | 283 | { |
dev_alexander | 37:f0fcc0341654 | 284 | case PRESSED: |
dev_alexander | 37:f0fcc0341654 | 285 | switch (direction) |
dev_alexander | 37:f0fcc0341654 | 286 | { |
dev_alexander | 37:f0fcc0341654 | 287 | case FRONT: |
dev_alexander | 37:f0fcc0341654 | 288 | rightMotor->run(FORWARD); |
dev_alexander | 37:f0fcc0341654 | 289 | leftMotor->run(FORWARD); |
dev_alexander | 37:f0fcc0341654 | 290 | rightMotor->setSpeed(MOTOR_FORWARD); |
dev_alexander | 37:f0fcc0341654 | 291 | leftMotor->setSpeed(MOTOR_FORWARD); |
dev_alexander | 37:f0fcc0341654 | 292 | break; |
dev_alexander | 37:f0fcc0341654 | 293 | case BACK: |
dev_alexander | 37:f0fcc0341654 | 294 | rightMotor->run(BACKWARD); |
dev_alexander | 37:f0fcc0341654 | 295 | leftMotor->run(BACKWARD); |
dev_alexander | 37:f0fcc0341654 | 296 | rightMotor->setSpeed(MOTOR_BACKWARD); |
dev_alexander | 37:f0fcc0341654 | 297 | leftMotor->setSpeed(MOTOR_BACKWARD); |
dev_alexander | 37:f0fcc0341654 | 298 | break; |
dev_alexander | 37:f0fcc0341654 | 299 | case LEFT: |
dev_alexander | 37:f0fcc0341654 | 300 | rightMotor->run(FORWARD); |
dev_alexander | 37:f0fcc0341654 | 301 | leftMotor->run(BACKWARD); |
dev_alexander | 37:f0fcc0341654 | 302 | rightMotor->setSpeed(MOTOR_TURN); |
dev_alexander | 37:f0fcc0341654 | 303 | leftMotor->setSpeed(MOTOR_TURN); |
dev_alexander | 37:f0fcc0341654 | 304 | break; |
dev_alexander | 37:f0fcc0341654 | 305 | case RIGHT: |
dev_alexander | 37:f0fcc0341654 | 306 | rightMotor->run(BACKWARD); |
dev_alexander | 37:f0fcc0341654 | 307 | leftMotor->run(FORWARD); |
dev_alexander | 37:f0fcc0341654 | 308 | rightMotor->setSpeed(MOTOR_TURN); |
dev_alexander | 37:f0fcc0341654 | 309 | leftMotor->setSpeed(MOTOR_TURN); |
dev_alexander | 37:f0fcc0341654 | 310 | break; |
dev_alexander | 37:f0fcc0341654 | 311 | } |
dev_alexander | 37:f0fcc0341654 | 312 | break; |
dev_alexander | 37:f0fcc0341654 | 313 | case RELEASED: |
dev_alexander | 37:f0fcc0341654 | 314 | rightMotor->setSpeed(MOTOR_OFF); |
dev_alexander | 37:f0fcc0341654 | 315 | leftMotor->setSpeed(MOTOR_OFF); |
dev_alexander | 37:f0fcc0341654 | 316 | break; |
dev_alexander | 37:f0fcc0341654 | 317 | } |
dev_alexander | 37:f0fcc0341654 | 318 | } |
dev_alexander | 37:f0fcc0341654 | 319 | #endif |
dev_alexander | 37:f0fcc0341654 | 320 | |
dev_alexander | 37:f0fcc0341654 | 321 | |
dev_alexander | 37:f0fcc0341654 | 322 | |
dev_alexander | 37:f0fcc0341654 | 323 | |
dev_alexander | 37:f0fcc0341654 | 324 | |
dev_alexander | 37:f0fcc0341654 | 325 | |
dev_alexander | 23:f74a50977593 | 326 | int main() |
dev_alexander | 23:f74a50977593 | 327 | { |
dev_alexander | 32:b108ed6096b0 | 328 | /* Setup begins here: */ |
dev_alexander | 32:b108ed6096b0 | 329 | #if defined(TARGET_MAX32630FTHR) // Master Device: BLE-to-LoRa Gateway |
dev_alexander | 32:b108ed6096b0 | 330 | dprintf("MAX32630FTHR: Master"); |
dev_alexander | 32:b108ed6096b0 | 331 | #elif defined(TARGET_MAX32620FTHR) // Slave Device: LoRa Controlled Robot |
dev_alexander | 32:b108ed6096b0 | 332 | dprintf("MAX32620FTHR: Slave"); |
dev_alexander | 32:b108ed6096b0 | 333 | #endif |
dev_alexander | 32:b108ed6096b0 | 334 | |
dev_alexander | 32:b108ed6096b0 | 335 | |
dev_alexander | 32:b108ed6096b0 | 336 | #if defined(TARGET_MAX32620FTHR) // Slave Device: LoRa Controlled Robot |
dev_alexander | 32:b108ed6096b0 | 337 | //Set Power Hold High for battery operation MAX77650 on MAX32620FTHR |
dev_alexander | 32:b108ed6096b0 | 338 | pw_Hold = POWER_HOLD_ON; |
dev_alexander | 32:b108ed6096b0 | 339 | #endif |
dev_alexander | 32:b108ed6096b0 | 340 | |
Helmut64 | 17:98f2528e8399 | 341 | /* |
Helmut64 | 17:98f2528e8399 | 342 | * inits the Serial or USBSerial when available (230400 baud). |
Helmut64 | 17:98f2528e8399 | 343 | * If the serial uart is not is not connected it swiches to USB Serial |
Helmut64 | 17:98f2528e8399 | 344 | * blinking LED means USBSerial detected, waiting for a connect. |
Helmut64 | 17:98f2528e8399 | 345 | * It waits up to 30 seconds for a USB terminal connections |
Helmut64 | 17:98f2528e8399 | 346 | */ |
Helmut64 | 17:98f2528e8399 | 347 | InitSerial(30*1000, &myled); |
Helmut64 | 17:98f2528e8399 | 348 | dprintf("Welcome to the SX1276GenericLib"); |
Helmut64 | 18:d5527ce82e6b | 349 | |
Helmut64 | 17:98f2528e8399 | 350 | dprintf("Starting a simple LoRa PingPong"); |
dev_alexander | 23:f74a50977593 | 351 | |
dev_alexander | 32:b108ed6096b0 | 352 | |
dev_alexander | 26:69aba05f010f | 353 | |
dev_alexander | 23:f74a50977593 | 354 | |
dev_alexander | 23:f74a50977593 | 355 | /*************************************************************************** |
dev_alexander | 23:f74a50977593 | 356 | * Grid Eye Sensor: Non-Buffer Program Variables |
dev_alexander | 23:f74a50977593 | 357 | **************************************************************************/ |
dev_alexander | 23:f74a50977593 | 358 | #if defined(TARGET_MAX32630FTHR) // Master Device: BLE-to-LoRa Gateway |
dev_alexander | 23:f74a50977593 | 359 | int frame_idx = 0; |
dev_alexander | 24:e8d03912f303 | 360 | #elif defined(TARGET_MAX32620FTHR) // Slave Device: LoRa Controlled Robot |
dev_alexander | 32:b108ed6096b0 | 361 | #if defined(DEBUG_GRID_EYE_SLAVE) |
dev_alexander | 32:b108ed6096b0 | 362 | int frame_idx = 0; |
dev_alexander | 32:b108ed6096b0 | 363 | #endif |
dev_alexander | 23:f74a50977593 | 364 | #endif |
dev_alexander | 23:f74a50977593 | 365 | |
dev_alexander | 23:f74a50977593 | 366 | |
dev_alexander | 28:0ed92c590607 | 367 | /*************************************************************************** |
dev_alexander | 28:0ed92c590607 | 368 | * Combined Payload Buffers for LoRa Communications |
dev_alexander | 28:0ed92c590607 | 369 | **************************************************************************/ |
dev_alexander | 28:0ed92c590607 | 370 | uint8_t BufferTx[BufferSizeTx]; |
dev_alexander | 28:0ed92c590607 | 371 | uint8_t BufferRx[BufferSizeRx]; |
dev_alexander | 28:0ed92c590607 | 372 | |
dev_alexander | 28:0ed92c590607 | 373 | /*************************************************************************** |
dev_alexander | 32:b108ed6096b0 | 374 | * Identification Buffers |
dev_alexander | 32:b108ed6096b0 | 375 | **************************************************************************/ |
dev_alexander | 32:b108ed6096b0 | 376 | #if defined(TARGET_MAX32630FTHR) // Master Device: BLE-to-LoRa Gateway |
dev_alexander | 32:b108ed6096b0 | 377 | uint8_t ID_of_slave[size_signature]; |
dev_alexander | 32:b108ed6096b0 | 378 | #elif defined(TARGET_MAX32620FTHR) // Slave Device: LoRa Controlled Robot |
dev_alexander | 32:b108ed6096b0 | 379 | uint8_t ID_of_master[size_signature]; |
dev_alexander | 32:b108ed6096b0 | 380 | #endif |
dev_alexander | 32:b108ed6096b0 | 381 | |
dev_alexander | 32:b108ed6096b0 | 382 | /*************************************************************************** |
dev_alexander | 28:0ed92c590607 | 383 | * BLE Data Buffers |
dev_alexander | 28:0ed92c590607 | 384 | **************************************************************************/ |
dev_alexander | 28:0ed92c590607 | 385 | #if defined(TARGET_MAX32630FTHR) // Master Device: BLE-to-LoRa Gateway |
dev_alexander | 31:f15747cffb20 | 386 | uint8_t curr_ble_to_slave[size_of_ble]; |
dev_alexander | 28:0ed92c590607 | 387 | #elif defined(TARGET_MAX32620FTHR) // Slave Device: LoRa Controlled Robot |
dev_alexander | 28:0ed92c590607 | 388 | uint8_t curr_ble_from_master[size_of_ble]; |
dev_alexander | 28:0ed92c590607 | 389 | uint8_t prev_ble_from_master[size_of_ble]; |
dev_alexander | 28:0ed92c590607 | 390 | #endif |
dev_alexander | 28:0ed92c590607 | 391 | |
dev_alexander | 28:0ed92c590607 | 392 | /*************************************************************************** |
dev_alexander | 28:0ed92c590607 | 393 | * Grid Eye Sensor Data Buffers |
dev_alexander | 28:0ed92c590607 | 394 | **************************************************************************/ |
dev_alexander | 28:0ed92c590607 | 395 | #if defined(TARGET_MAX32630FTHR) // Master Device: BLE-to-LoRa Gateway |
dev_alexander | 28:0ed92c590607 | 396 | char curr_raw_frame_from_slave[size_of_grid_eye]; |
dev_alexander | 28:0ed92c590607 | 397 | char prev_raw_frame_from_slave[size_of_grid_eye]; |
dev_alexander | 28:0ed92c590607 | 398 | int16_t conv_frame_from_slave[64]; |
dev_alexander | 28:0ed92c590607 | 399 | #elif defined(TARGET_MAX32620FTHR) // Client Device: LoRa Controlled Robot |
dev_alexander | 28:0ed92c590607 | 400 | char curr_raw_frame_to_master[size_of_grid_eye]; |
dev_alexander | 28:0ed92c590607 | 401 | char prev_raw_frame_to_master[size_of_grid_eye]; |
dev_alexander | 28:0ed92c590607 | 402 | int16_t conv_frame_to_master[64]; |
dev_alexander | 28:0ed92c590607 | 403 | #endif |
dev_alexander | 28:0ed92c590607 | 404 | |
dev_alexander | 28:0ed92c590607 | 405 | /*************************************************************************** |
dev_alexander | 28:0ed92c590607 | 406 | * GPS Data Buffers |
dev_alexander | 28:0ed92c590607 | 407 | **************************************************************************/ |
dev_alexander | 28:0ed92c590607 | 408 | #if defined(TARGET_MAX32630FTHR) // Master Device: BLE-to-LoRa Gateway |
dev_alexander | 28:0ed92c590607 | 409 | uint8_t curr_gps_from_slave[size_of_gps]; |
dev_alexander | 28:0ed92c590607 | 410 | uint8_t prev_gps_from_slave[size_of_gps]; |
dev_alexander | 28:0ed92c590607 | 411 | #elif defined(TARGET_MAX32620FTHR) // Slave Device: LoRa Controlled Robot |
dev_alexander | 28:0ed92c590607 | 412 | uint8_t curr_gps_to_master[size_of_gps]; |
dev_alexander | 28:0ed92c590607 | 413 | #endif |
dev_alexander | 28:0ed92c590607 | 414 | |
dev_alexander | 28:0ed92c590607 | 415 | /*************************************************************************** |
dev_alexander | 28:0ed92c590607 | 416 | * MAX17055 Data Buffers |
dev_alexander | 28:0ed92c590607 | 417 | **************************************************************************/ |
dev_alexander | 28:0ed92c590607 | 418 | #if defined(TARGET_MAX32630FTHR) // Master Device: BLE-to-LoRa Gateway |
dev_alexander | 28:0ed92c590607 | 419 | uint8_t curr_MAX17055_from_slave[size_of_MAX17055]; |
dev_alexander | 28:0ed92c590607 | 420 | uint8_t prev_MAX17055_from_slave[size_of_MAX17055]; |
dev_alexander | 38:c10d2a04a0c2 | 421 | |
dev_alexander | 28:0ed92c590607 | 422 | #elif defined(TARGET_MAX32620FTHR) // Slave Device: LoRa Controlled Robot |
dev_alexander | 28:0ed92c590607 | 423 | uint8_t curr_MAX17055_to_master[size_of_MAX17055]; |
dev_alexander | 28:0ed92c590607 | 424 | #endif |
dev_alexander | 28:0ed92c590607 | 425 | |
dev_alexander | 28:0ed92c590607 | 426 | /*************************************************************************** |
dev_alexander | 28:0ed92c590607 | 427 | * MAX77650 Data Buffers |
dev_alexander | 28:0ed92c590607 | 428 | **************************************************************************/ |
dev_alexander | 28:0ed92c590607 | 429 | #if defined(TARGET_MAX32630FTHR) // Master Device: BLE-to-LoRa Gateway |
dev_alexander | 28:0ed92c590607 | 430 | uint8_t curr_MAX77650_from_slave[size_of_MAX77650]; |
dev_alexander | 28:0ed92c590607 | 431 | uint8_t prev_MAX77650_from_slave[size_of_MAX77650]; |
dev_alexander | 28:0ed92c590607 | 432 | #elif defined(TARGET_MAX32620FTHR) // Slave Device: LoRa Controlled Robot |
dev_alexander | 28:0ed92c590607 | 433 | uint8_t curr_MAX77650_to_master[size_of_MAX77650]; |
dev_alexander | 28:0ed92c590607 | 434 | #endif |
dev_alexander | 38:c10d2a04a0c2 | 435 | |
dev_alexander | 28:0ed92c590607 | 436 | |
dev_alexander | 28:0ed92c590607 | 437 | /*************************************************************************** |
dev_alexander | 28:0ed92c590607 | 438 | * Finish Setting up LoRa Radios: This passes in pointers to Buffers to send |
dev_alexander | 28:0ed92c590607 | 439 | **************************************************************************/ |
dev_alexander | 28:0ed92c590607 | 440 | SX1276PingPongSetup(BufferTx, BufferRx); |
dev_alexander | 28:0ed92c590607 | 441 | |
dev_alexander | 32:b108ed6096b0 | 442 | /*************************************************************************** |
dev_alexander | 32:b108ed6096b0 | 443 | * Finish Setting up BLE Radio on the MAX32630FTHR: Only on the Master Device |
dev_alexander | 32:b108ed6096b0 | 444 | **************************************************************************/ |
dev_alexander | 32:b108ed6096b0 | 445 | #if defined(TARGET_MAX32630FTHR) // Master Device: BLE-to-LoRa Gateway |
dev_alexander | 32:b108ed6096b0 | 446 | BLE &ble = BLE::Instance(); |
dev_alexander | 32:b108ed6096b0 | 447 | /* Create alias for the BLE data to be saved in function above that |
dev_alexander | 32:b108ed6096b0 | 448 | * writes data to this buffer when function onDataWritten is called |
dev_alexander | 32:b108ed6096b0 | 449 | */ |
dev_alexander | 32:b108ed6096b0 | 450 | onDataWritten_curr_ble_to_slave = curr_ble_to_slave; |
dev_alexander | 32:b108ed6096b0 | 451 | |
dev_alexander | 32:b108ed6096b0 | 452 | /* Initialize BLE */ |
dev_alexander | 32:b108ed6096b0 | 453 | ble.init(); |
dev_alexander | 32:b108ed6096b0 | 454 | ble.gap().onDisconnection(disconnectionCallback); |
dev_alexander | 32:b108ed6096b0 | 455 | ble.gattServer().onDataWritten(onDataWritten); |
dev_alexander | 32:b108ed6096b0 | 456 | uart = new UARTService(ble); |
dev_alexander | 32:b108ed6096b0 | 457 | /* setup advertising */ |
dev_alexander | 32:b108ed6096b0 | 458 | ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED); |
dev_alexander | 32:b108ed6096b0 | 459 | ble.gap().setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED); |
dev_alexander | 32:b108ed6096b0 | 460 | ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::SHORTENED_LOCAL_NAME, |
dev_alexander | 32:b108ed6096b0 | 461 | (const uint8_t *)"BLE UART", sizeof("BLE UART") - 1); |
dev_alexander | 32:b108ed6096b0 | 462 | ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LIST_128BIT_SERVICE_IDS, |
dev_alexander | 32:b108ed6096b0 | 463 | (const uint8_t *)UARTServiceUUID_reversed, sizeof(UARTServiceUUID_reversed)); |
dev_alexander | 32:b108ed6096b0 | 464 | ble.gap().setAdvertisingInterval(160); /* 100ms; in multiples of 0.625ms. */ |
dev_alexander | 32:b108ed6096b0 | 465 | ble.gap().startAdvertising(); |
dev_alexander | 32:b108ed6096b0 | 466 | #elif defined(TARGET_MAX32620FTHR) // Slave Device: LoRa Controlled Robot |
dev_alexander | 32:b108ed6096b0 | 467 | /* There is no BLE device that is integrated into the MAX32620FTHR. Also |
dev_alexander | 32:b108ed6096b0 | 468 | * Also this program is meant to use the BLE gateway on the MAX32630FTHR |
dev_alexander | 32:b108ed6096b0 | 469 | */ |
dev_alexander | 32:b108ed6096b0 | 470 | #endif |
dev_alexander | 32:b108ed6096b0 | 471 | |
dev_alexander | 32:b108ed6096b0 | 472 | /*************************************************************************** |
dev_alexander | 38:c10d2a04a0c2 | 473 | * Finish Setting up the MAX77650 on the MAX32620FTHR: Only on the Slave Device |
dev_alexander | 38:c10d2a04a0c2 | 474 | **************************************************************************/ |
dev_alexander | 38:c10d2a04a0c2 | 475 | #if defined(TARGET_MAX32630FTHR) // Master Device: BLE-to-LoRa Gateway |
dev_alexander | 38:c10d2a04a0c2 | 476 | // No MAX77650 on the MAX32630FTHR |
dev_alexander | 38:c10d2a04a0c2 | 477 | #elif defined(TARGET_MAX32620FTHR) // Slave Device: LoRa Controlled Robot |
dev_alexander | 38:c10d2a04a0c2 | 478 | //Set Power Hold High for battery operation MAX77650 on MAX32620FTHR |
dev_alexander | 38:c10d2a04a0c2 | 479 | pw_Hold = POWER_HOLD_ON; |
dev_alexander | 38:c10d2a04a0c2 | 480 | //Simo Pmic MAX77650 init |
dev_alexander | 38:c10d2a04a0c2 | 481 | simo_pmic.initCharger(); |
dev_alexander | 38:c10d2a04a0c2 | 482 | simoIRQ.fall( &charger_Detect ); |
dev_alexander | 38:c10d2a04a0c2 | 483 | simo_pmic.enCharger(); |
dev_alexander | 38:c10d2a04a0c2 | 484 | bool chrg_status; //True = ON False = OFF |
dev_alexander | 38:c10d2a04a0c2 | 485 | #endif |
dev_alexander | 38:c10d2a04a0c2 | 486 | /*************************************************************************** |
dev_alexander | 38:c10d2a04a0c2 | 487 | * Finish Setting up the MAX17650 on the MAX32620FTHR: Only on the Slave Device |
dev_alexander | 38:c10d2a04a0c2 | 488 | **************************************************************************/ |
dev_alexander | 38:c10d2a04a0c2 | 489 | #if defined(TARGET_MAX32630FTHR) // Master Device: BLE-to-LoRa Gateway |
dev_alexander | 38:c10d2a04a0c2 | 490 | // No MAX17055 on the MAX32630FTHR |
dev_alexander | 38:c10d2a04a0c2 | 491 | #elif defined(TARGET_MAX32620FTHR) // Slave Device: LoRa Controlled Robot |
dev_alexander | 38:c10d2a04a0c2 | 492 | //rsense 5mOhm for MAX32620FTHR |
dev_alexander | 38:c10d2a04a0c2 | 493 | design_param.designcap = 0x0069; //Design Battery Capacity mAh |
dev_alexander | 38:c10d2a04a0c2 | 494 | design_param.ichgterm = 0x0016; // Charge Termination Current for the Battery |
dev_alexander | 38:c10d2a04a0c2 | 495 | design_param.vempty = 0x9B00; // Battery Empty Voltage |
dev_alexander | 38:c10d2a04a0c2 | 496 | design_param.vcharge = 4200; // Battery Charge Voltage can be obtained from MAX77650 configuration |
dev_alexander | 38:c10d2a04a0c2 | 497 | design_param.rsense = 5; //5mOhms |
dev_alexander | 38:c10d2a04a0c2 | 498 | |
dev_alexander | 38:c10d2a04a0c2 | 499 | int soc_FG, tte_FG, ttf_FG, curr_FG,volt_FG, status, alsValue, proxValue; |
dev_alexander | 38:c10d2a04a0c2 | 500 | int oper_f1, volt_mod_FG; |
dev_alexander | 38:c10d2a04a0c2 | 501 | int alsCAL; //Variables |
dev_alexander | 38:c10d2a04a0c2 | 502 | uint8_t prox_data; |
dev_alexander | 38:c10d2a04a0c2 | 503 | uint8_t proxCAL; //Prox Sensor |
dev_alexander | 38:c10d2a04a0c2 | 504 | int sensor_Case_value; |
dev_alexander | 38:c10d2a04a0c2 | 505 | //serial.printf("Test Init and Temp Functions \r\n"); |
dev_alexander | 38:c10d2a04a0c2 | 506 | //status = fuelGauge.forcedExitHyberMode(); |
dev_alexander | 38:c10d2a04a0c2 | 507 | status = fuelGauge.init(design_param); |
dev_alexander | 38:c10d2a04a0c2 | 508 | pc.printf("Init FuelGauge Function Status= %X \r\n",status); |
dev_alexander | 38:c10d2a04a0c2 | 509 | #endif |
dev_alexander | 38:c10d2a04a0c2 | 510 | |
dev_alexander | 38:c10d2a04a0c2 | 511 | /*************************************************************************** |
dev_alexander | 38:c10d2a04a0c2 | 512 | * Finish Setting up the SSD1306 OLED on the MAX32630FTHR: Only on the Master Device |
dev_alexander | 38:c10d2a04a0c2 | 513 | **************************************************************************/ |
dev_alexander | 38:c10d2a04a0c2 | 514 | #if defined(TARGET_MAX32630FTHR) // Master Device: BLE-to-LoRa Gateway |
dev_alexander | 38:c10d2a04a0c2 | 515 | displayOled.setTextColor(1); |
dev_alexander | 38:c10d2a04a0c2 | 516 | displayOled.setTextSize(1); |
dev_alexander | 38:c10d2a04a0c2 | 517 | displayOled.setTextWrap(false); |
dev_alexander | 38:c10d2a04a0c2 | 518 | |
dev_alexander | 38:c10d2a04a0c2 | 519 | displayOled.clearDisplay(); |
dev_alexander | 38:c10d2a04a0c2 | 520 | displayOled.printf("%ux%u OLED Display\r\n", displayOled.width(), displayOled.height()); |
dev_alexander | 38:c10d2a04a0c2 | 521 | //displayOled.drawBitmap(0,0,maximLarge,128,32,1); |
dev_alexander | 38:c10d2a04a0c2 | 522 | displayOled.display(); |
dev_alexander | 38:c10d2a04a0c2 | 523 | displayOled.display(); |
dev_alexander | 38:c10d2a04a0c2 | 524 | wait(1.0); |
dev_alexander | 38:c10d2a04a0c2 | 525 | |
dev_alexander | 38:c10d2a04a0c2 | 526 | displayOled.startscrollright(0x00, 0x0F); |
dev_alexander | 38:c10d2a04a0c2 | 527 | #elif defined(TARGET_MAX32620FTHR) // Slave Device: LoRa Controlled Robot |
dev_alexander | 38:c10d2a04a0c2 | 528 | // No oled on the MAX32620FTHR |
dev_alexander | 38:c10d2a04a0c2 | 529 | #endif |
dev_alexander | 38:c10d2a04a0c2 | 530 | |
dev_alexander | 38:c10d2a04a0c2 | 531 | /*************************************************************************** |
dev_alexander | 32:b108ed6096b0 | 532 | * Finish Setting up the motor controller on the MAX32620FTHR: Only on the Slave Device |
dev_alexander | 32:b108ed6096b0 | 533 | **************************************************************************/ |
dev_alexander | 32:b108ed6096b0 | 534 | #if defined(TARGET_MAX32630FTHR) // Master Device: BLE-to-LoRa Gateway |
dev_alexander | 32:b108ed6096b0 | 535 | // No setup on the master device |
dev_alexander | 32:b108ed6096b0 | 536 | #elif defined(TARGET_MAX32620FTHR) // Slave Device: LoRa Controlled Robot |
dev_alexander | 32:b108ed6096b0 | 537 | AFMS.begin(); // create with the default frequency 1.6KHz |
dev_alexander | 32:b108ed6096b0 | 538 | //AFMS.begin(1000); // OR with a different frequency, say 1KHz |
dev_alexander | 32:b108ed6096b0 | 539 | |
dev_alexander | 32:b108ed6096b0 | 540 | // Set the speed to start, from 0 (off) to 255 (max speed) |
dev_alexander | 32:b108ed6096b0 | 541 | rightMotor->setSpeed(150); |
dev_alexander | 32:b108ed6096b0 | 542 | rightMotor->run(FORWARD); |
dev_alexander | 32:b108ed6096b0 | 543 | // turn on motor |
dev_alexander | 32:b108ed6096b0 | 544 | rightMotor->run(RELEASE); |
dev_alexander | 32:b108ed6096b0 | 545 | |
dev_alexander | 32:b108ed6096b0 | 546 | leftMotor->setSpeed(150); |
dev_alexander | 32:b108ed6096b0 | 547 | leftMotor->run(FORWARD); |
dev_alexander | 32:b108ed6096b0 | 548 | // turn on motor |
dev_alexander | 32:b108ed6096b0 | 549 | leftMotor->run(RELEASE); |
dev_alexander | 32:b108ed6096b0 | 550 | #endif |
dev_alexander | 32:b108ed6096b0 | 551 | |
dev_alexander | 32:b108ed6096b0 | 552 | |
dev_alexander | 22:abca9d17d13d | 553 | while(1) |
dev_alexander | 28:0ed92c590607 | 554 | { |
dev_alexander | 23:f74a50977593 | 555 | /*************************************************************************** |
dev_alexander | 30:66f9750cc44c | 556 | * BLE Radio Data |
dev_alexander | 30:66f9750cc44c | 557 | **************************************************************************/ |
dev_alexander | 30:66f9750cc44c | 558 | #if defined(TARGET_MAX32630FTHR) // Master Device: BLE-to-LoRa Gateway |
dev_alexander | 30:66f9750cc44c | 559 | #if defined(COMPILE_BLE) |
dev_alexander | 30:66f9750cc44c | 560 | ble.waitForEvent(); |
dev_alexander | 30:66f9750cc44c | 561 | #endif |
dev_alexander | 30:66f9750cc44c | 562 | #elif defined(TARGET_MAX32620FTHR) // Slave Device: LoRa Controlled Robot |
dev_alexander | 32:b108ed6096b0 | 563 | memcpy(curr_ble_from_master, prev_ble_from_master, sizeof(curr_ble_from_master)); |
dev_alexander | 30:66f9750cc44c | 564 | #endif |
dev_alexander | 30:66f9750cc44c | 565 | |
dev_alexander | 30:66f9750cc44c | 566 | /*************************************************************************** |
dev_alexander | 23:f74a50977593 | 567 | * Grid Eye Sensor |
dev_alexander | 23:f74a50977593 | 568 | **************************************************************************/ |
dev_alexander | 23:f74a50977593 | 569 | #if defined(TARGET_MAX32630FTHR) // Master Device: BLE-to-LoRa Gateway |
dev_alexander | 28:0ed92c590607 | 570 | // Check to see if the contents of the previous scan are the same. If they are different then continue with converting |
dev_alexander | 32:b108ed6096b0 | 571 | #if defined(RASPBERRY_PI) |
dev_alexander | 32:b108ed6096b0 | 572 | if( memcmp(prev_raw_frame_from_slave, curr_raw_frame_from_slave, sizeof(curr_raw_frame_from_slave)) != 0 ) |
dev_alexander | 32:b108ed6096b0 | 573 | { |
dev_alexander | 32:b108ed6096b0 | 574 | char grid_eye_msg[130]; |
dev_alexander | 32:b108ed6096b0 | 575 | grid_eye_msg[0]=0x55; |
dev_alexander | 32:b108ed6096b0 | 576 | grid_eye_msg[1]=0xaa; |
dev_alexander | 32:b108ed6096b0 | 577 | for (int idx = 0; idx < 128; idx++) |
dev_alexander | 32:b108ed6096b0 | 578 | grid_eye_msg[idx+2] = curr_raw_frame_from_slave[idx]; |
dev_alexander | 32:b108ed6096b0 | 579 | //pc.printf(grid_eye_msg); |
dev_alexander | 32:b108ed6096b0 | 580 | for (int idx = 0; idx < 130; idx++) |
dev_alexander | 32:b108ed6096b0 | 581 | pc.putc(grid_eye_msg[idx]); |
dev_alexander | 35:bae9b236070b | 582 | pc.printf("\r\n"); // seperate the lines |
dev_alexander | 32:b108ed6096b0 | 583 | } |
dev_alexander | 35:bae9b236070b | 584 | #endif |
dev_alexander | 35:bae9b236070b | 585 | #if defined(DEBUG_GRID_EYE) |
dev_alexander | 32:b108ed6096b0 | 586 | if( memcmp(prev_raw_frame_from_slave, curr_raw_frame_from_slave, sizeof(curr_raw_frame_from_slave)) != 0 ) |
dev_alexander | 32:b108ed6096b0 | 587 | { |
dev_alexander | 32:b108ed6096b0 | 588 | // Convert raw data sent from slave to a 16 bit integer array by calling this |
dev_alexander | 32:b108ed6096b0 | 589 | convRaw8x8Data2Point25degC(curr_raw_frame_from_slave, conv_frame_from_slave); |
dev_alexander | 32:b108ed6096b0 | 590 | |
dev_alexander | 32:b108ed6096b0 | 591 | // Next Print off the Converted data |
dev_alexander | 32:b108ed6096b0 | 592 | pc.printf("\r\nFrame %d data: \r\n", frame_idx); |
dev_alexander | 32:b108ed6096b0 | 593 | uint8_t idx; |
dev_alexander | 32:b108ed6096b0 | 594 | float pixel_data; |
dev_alexander | 32:b108ed6096b0 | 595 | for (int y = 0; y < 8; y++) { |
dev_alexander | 32:b108ed6096b0 | 596 | for (int x = 0; x < 8; x++) { |
dev_alexander | 32:b108ed6096b0 | 597 | idx = y*8 + x; |
dev_alexander | 32:b108ed6096b0 | 598 | pixel_data = ((float)conv_frame_from_slave[idx])/4.0; |
dev_alexander | 32:b108ed6096b0 | 599 | pc.printf("%.2f \t", pixel_data); |
dev_alexander | 32:b108ed6096b0 | 600 | } |
dev_alexander | 32:b108ed6096b0 | 601 | pc.printf("\r\n\r\n"); |
dev_alexander | 23:f74a50977593 | 602 | } |
dev_alexander | 32:b108ed6096b0 | 603 | pc.printf("\r\n"); |
dev_alexander | 32:b108ed6096b0 | 604 | |
dev_alexander | 32:b108ed6096b0 | 605 | // Increment frame counter |
dev_alexander | 32:b108ed6096b0 | 606 | frame_idx = frame_idx +1; |
dev_alexander | 23:f74a50977593 | 607 | } |
dev_alexander | 32:b108ed6096b0 | 608 | #endif |
dev_alexander | 32:b108ed6096b0 | 609 | /* Next copy in data received from current data into buffer used for |
dev_alexander | 32:b108ed6096b0 | 610 | * comparison next time the memcmp above is called. This prevents the |
dev_alexander | 32:b108ed6096b0 | 611 | * program from converting the same raw data aquired by the grid eye |
dev_alexander | 32:b108ed6096b0 | 612 | * sensor on the slave device to the floating point array with the |
dev_alexander | 32:b108ed6096b0 | 613 | * 0.25 degrees celsius precision level when there is not new data. |
dev_alexander | 32:b108ed6096b0 | 614 | */ |
dev_alexander | 32:b108ed6096b0 | 615 | |
dev_alexander | 28:0ed92c590607 | 616 | memcpy(prev_raw_frame_from_slave, curr_raw_frame_from_slave, sizeof(curr_raw_frame_from_slave)); |
dev_alexander | 24:e8d03912f303 | 617 | #elif defined(TARGET_MAX32620FTHR) // Slave Device: LoRa Controlled Robot |
dev_alexander | 23:f74a50977593 | 618 | // Aquire raw data about 8x8 frame from the grid eye sensor in this function call |
dev_alexander | 28:0ed92c590607 | 619 | gridEye.getRaw8x8FrameData(curr_raw_frame_to_master); |
dev_alexander | 36:09e8b51fc91d | 620 | // wait_ms( 10 ); |
dev_alexander | 35:bae9b236070b | 621 | #if defined(RASPBERRY_PI) |
dev_alexander | 35:bae9b236070b | 622 | if( memcmp(prev_raw_frame_to_master, curr_raw_frame_to_master, sizeof(curr_raw_frame_to_master)) != 0 ) |
dev_alexander | 35:bae9b236070b | 623 | { |
dev_alexander | 35:bae9b236070b | 624 | char grid_eye_msg[130]; |
dev_alexander | 35:bae9b236070b | 625 | grid_eye_msg[0]=0x55; |
dev_alexander | 35:bae9b236070b | 626 | grid_eye_msg[1]=0xaa; |
dev_alexander | 35:bae9b236070b | 627 | for (int idx = 0; idx < 128; idx++) |
dev_alexander | 35:bae9b236070b | 628 | grid_eye_msg[idx+2] = curr_raw_frame_to_master[idx]; |
dev_alexander | 35:bae9b236070b | 629 | //pc.printf(grid_eye_msg); |
dev_alexander | 35:bae9b236070b | 630 | for (int idx = 0; idx < 130; idx++) |
dev_alexander | 35:bae9b236070b | 631 | pc.putc(grid_eye_msg[idx]); |
dev_alexander | 35:bae9b236070b | 632 | pc.printf("\r\n"); // seperate the lines |
dev_alexander | 35:bae9b236070b | 633 | } |
dev_alexander | 35:bae9b236070b | 634 | #endif |
dev_alexander | 35:bae9b236070b | 635 | #if defined(DEBUG_GRID_EYE) |
dev_alexander | 32:b108ed6096b0 | 636 | if( memcmp(prev_raw_frame_to_master, curr_raw_frame_to_master, sizeof(curr_raw_frame_to_master)) != 0 ) |
dev_alexander | 32:b108ed6096b0 | 637 | { |
dev_alexander | 32:b108ed6096b0 | 638 | // Convert raw data sent from slave to a 16 bit integer array by calling this |
dev_alexander | 32:b108ed6096b0 | 639 | convRaw8x8Data2Point25degC(curr_raw_frame_to_master, conv_frame_to_master); |
dev_alexander | 32:b108ed6096b0 | 640 | |
dev_alexander | 32:b108ed6096b0 | 641 | |
dev_alexander | 32:b108ed6096b0 | 642 | // Next Print off the Converted data |
dev_alexander | 32:b108ed6096b0 | 643 | pc.printf("\r\nFrame %d data: \r\n", frame_idx); |
dev_alexander | 32:b108ed6096b0 | 644 | uint8_t idx; |
dev_alexander | 32:b108ed6096b0 | 645 | float pixel_data; |
dev_alexander | 32:b108ed6096b0 | 646 | for (int y = 0; y < 8; y++) { |
dev_alexander | 32:b108ed6096b0 | 647 | for (int x = 0; x < 8; x++) { |
dev_alexander | 32:b108ed6096b0 | 648 | idx = y*8 + x; |
dev_alexander | 32:b108ed6096b0 | 649 | pixel_data = ((float)conv_frame_to_master[idx])/4.0; |
dev_alexander | 32:b108ed6096b0 | 650 | pc.printf("%.2f \t", pixel_data); |
dev_alexander | 32:b108ed6096b0 | 651 | } |
dev_alexander | 32:b108ed6096b0 | 652 | pc.printf("\r\n\r\n"); |
dev_alexander | 25:1a031add188a | 653 | } |
dev_alexander | 32:b108ed6096b0 | 654 | pc.printf("\r\n"); |
dev_alexander | 32:b108ed6096b0 | 655 | |
dev_alexander | 32:b108ed6096b0 | 656 | // Increment frame counter |
dev_alexander | 32:b108ed6096b0 | 657 | frame_idx = frame_idx +1; |
dev_alexander | 25:1a031add188a | 658 | } |
dev_alexander | 32:b108ed6096b0 | 659 | #endif |
dev_alexander | 36:09e8b51fc91d | 660 | // wait_ms( 10 ); |
dev_alexander | 33:52c898aca207 | 661 | memcpy(prev_raw_frame_to_master, curr_raw_frame_to_master, sizeof(curr_raw_frame_to_master)); |
dev_alexander | 31:f15747cffb20 | 662 | #endif |
dev_alexander | 31:f15747cffb20 | 663 | |
dev_alexander | 31:f15747cffb20 | 664 | /*************************************************************************** |
dev_alexander | 31:f15747cffb20 | 665 | * GPS Sensor |
dev_alexander | 31:f15747cffb20 | 666 | **************************************************************************/ |
dev_alexander | 31:f15747cffb20 | 667 | #if defined(TARGET_MAX32630FTHR) // Master Device: BLE-to-LoRa Gateway |
dev_alexander | 31:f15747cffb20 | 668 | //None yet |
dev_alexander | 31:f15747cffb20 | 669 | #elif defined(TARGET_MAX32620FTHR) // Slave Device: LoRa Controlled Robot |
dev_alexander | 31:f15747cffb20 | 670 | // The testing hasnt been done yet for the GPS Module. Will do this when more parts come in. |
dev_alexander | 31:f15747cffb20 | 671 | /* |
dev_alexander | 31:f15747cffb20 | 672 | if(gps.sample()){ |
dev_alexander | 31:f15747cffb20 | 673 | pc.printf("%f\t%c\t%f\t%c\t%f\t%f\t%f\n\r",gps.longitude, gps.ns,gps.latitude,gps.ew, gps.alt, gps.geoid, gps.time); |
dev_alexander | 31:f15747cffb20 | 674 | pc.printf("%d:%d:%d",gps.hour,gps.minute,gps.seconed); |
dev_alexander | 31:f15747cffb20 | 675 | } |
dev_alexander | 31:f15747cffb20 | 676 | */ |
dev_alexander | 31:f15747cffb20 | 677 | #endif |
dev_alexander | 28:0ed92c590607 | 678 | |
dev_alexander | 23:f74a50977593 | 679 | /*************************************************************************** |
dev_alexander | 28:0ed92c590607 | 680 | * Fill Payload Buffer With Data From Sensors for LoRa Transmition |
dev_alexander | 28:0ed92c590607 | 681 | **************************************************************************/ |
dev_alexander | 28:0ed92c590607 | 682 | #if defined(TARGET_MAX32630FTHR) // Master Device: BLE-to-LoRa Gateway |
dev_alexander | 28:0ed92c590607 | 683 | memcpy(&BufferTx[tx_idx_signature], PingMsg, size_signature); |
dev_alexander | 28:0ed92c590607 | 684 | memcpy(&BufferTx[tx_idx_ble], curr_ble_to_slave, size_of_ble); |
dev_alexander | 28:0ed92c590607 | 685 | #elif defined(TARGET_MAX32620FTHR) // Slave Device: LoRa Controlled Robot |
dev_alexander | 28:0ed92c590607 | 686 | memcpy(&BufferTx[tx_idx_signature], PongMsg, size_signature); |
dev_alexander | 28:0ed92c590607 | 687 | memcpy(&BufferTx[tx_idx_grid_eye], curr_raw_frame_to_master, size_of_grid_eye); |
dev_alexander | 28:0ed92c590607 | 688 | memcpy(&BufferTx[tx_idx_gps], curr_gps_to_master, size_of_gps); |
dev_alexander | 28:0ed92c590607 | 689 | memcpy(&BufferTx[tx_idx_MAX17055], curr_MAX17055_to_master, size_of_MAX17055); |
dev_alexander | 28:0ed92c590607 | 690 | memcpy(&BufferTx[tx_idx_MAX77650], curr_MAX77650_to_master, size_of_MAX77650); |
dev_alexander | 28:0ed92c590607 | 691 | #endif |
dev_alexander | 28:0ed92c590607 | 692 | |
dev_alexander | 28:0ed92c590607 | 693 | |
dev_alexander | 28:0ed92c590607 | 694 | |
dev_alexander | 32:b108ed6096b0 | 695 | |
dev_alexander | 28:0ed92c590607 | 696 | /*************************************************************************** |
dev_alexander | 28:0ed92c590607 | 697 | * Lora Communications |
dev_alexander | 28:0ed92c590607 | 698 | **************************************************************************/ |
dev_alexander | 36:09e8b51fc91d | 699 | // wait_ms( 10 ); |
dev_alexander | 22:abca9d17d13d | 700 | SX1276PingPong(); |
dev_alexander | 28:0ed92c590607 | 701 | |
dev_alexander | 28:0ed92c590607 | 702 | /*************************************************************************** |
dev_alexander | 28:0ed92c590607 | 703 | * Fill Global Buffers With Data From Received Payload Buffer |
dev_alexander | 28:0ed92c590607 | 704 | **************************************************************************/ |
dev_alexander | 28:0ed92c590607 | 705 | /* The master and slave devices will have different requirements for offloading payload */ |
dev_alexander | 28:0ed92c590607 | 706 | #if defined(TARGET_MAX32630FTHR) // Master Device: BLE-to-LoRa Gateway |
dev_alexander | 32:b108ed6096b0 | 707 | memcpy(ID_of_slave, &BufferRx[rx_idx_signature], size_signature); |
dev_alexander | 32:b108ed6096b0 | 708 | memcpy(curr_raw_frame_from_slave, &BufferRx[rx_idx_grid_eye], size_of_grid_eye); |
dev_alexander | 32:b108ed6096b0 | 709 | memcpy(curr_gps_from_slave, &BufferRx[rx_idx_gps], size_of_gps); |
dev_alexander | 32:b108ed6096b0 | 710 | memcpy(curr_MAX17055_from_slave, &BufferRx[rx_idx_MAX17055], size_of_MAX17055); |
dev_alexander | 32:b108ed6096b0 | 711 | memcpy(curr_MAX77650_from_slave, &BufferRx[rx_idx_MAX77650], size_of_MAX77650); |
dev_alexander | 28:0ed92c590607 | 712 | #elif defined(TARGET_MAX32620FTHR) // Slave Device: LoRa Controlled Robot |
dev_alexander | 32:b108ed6096b0 | 713 | memcpy(ID_of_master, &BufferRx[rx_idx_signature], size_signature); |
dev_alexander | 32:b108ed6096b0 | 714 | memcpy(curr_ble_from_master, &BufferRx[rx_idx_ble], size_of_ble); |
dev_alexander | 28:0ed92c590607 | 715 | #endif |
dev_alexander | 23:f74a50977593 | 716 | |
dev_alexander | 32:b108ed6096b0 | 717 | /*************************************************************************** |
dev_alexander | 32:b108ed6096b0 | 718 | * Motor Controller controlls go here |
dev_alexander | 32:b108ed6096b0 | 719 | **************************************************************************/ |
dev_alexander | 32:b108ed6096b0 | 720 | #if defined(TARGET_MAX32630FTHR) // Master Device: BLE-to-LoRa Gateway |
dev_alexander | 32:b108ed6096b0 | 721 | // No motor controller on master |
dev_alexander | 32:b108ed6096b0 | 722 | #elif defined(TARGET_MAX32620FTHR) // Slave Device: LoRa Controlled Robot |
dev_alexander | 32:b108ed6096b0 | 723 | // Check to see if the contents of the previous ble sdata received are the same. If they are different then change motor controllers registers |
dev_alexander | 32:b108ed6096b0 | 724 | if( memcmp(prev_ble_from_master, curr_ble_from_master, sizeof(curr_ble_from_master)) != 0 ) |
dev_alexander | 32:b108ed6096b0 | 725 | { |
dev_alexander | 32:b108ed6096b0 | 726 | MotorController(curr_ble_from_master); |
dev_alexander | 32:b108ed6096b0 | 727 | } |
dev_alexander | 32:b108ed6096b0 | 728 | #endif |
dev_alexander | 23:f74a50977593 | 729 | |
dev_alexander | 23:f74a50977593 | 730 | |
dev_alexander | 23:f74a50977593 | 731 | |
dev_alexander | 22:abca9d17d13d | 732 | } |
dev_alexander | 22:abca9d17d13d | 733 | |
Helmut64 | 0:c43b6919ae15 | 734 | } |