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

Revision:
17:98f2528e8399
Parent:
16:675f4d0ee9e9
Child:
18:d5527ce82e6b
--- a/main.cpp	Thu Feb 22 11:12:24 2018 +0000
+++ b/main.cpp	Fri Feb 23 12:57:25 2018 +0000
@@ -1,77 +1,29 @@
 /*
- * Copyright (c) 2017 Helmut Tschemernjak
+ * Copyright (c) 2018 HELIOS Software GmbH
  * 30826 Garbsen (Hannover) Germany
  * Licensed under the Apache License, Version 2.0);
  */
  #include "main.h"
 
-/*
- * IMPORTANT NOTE
- * Use the Nucleo-L073RZ target for the STM B_L072Z_LRWAN1 LoRa board 
- */
-DigitalOut myled(LED2);
-BufferedSerial *ser;
 
-int main() {
-    ser = new BufferedSerial(USBTX, USBRX);
-    ser->baud(230400);
-    ser->format(8);
-    ser->printf("Hello World\n\r");
-    myled = 1;
-
-    SX1276PingPong();
-}
+DigitalOut myled(LED);
 
 
-void dump(const char *title, const void *data, int len, bool dwords)
-{
-    dprintf("dump(\"%s\", 0x%x, %d bytes)", title, data, len);
-
-    int i, j, cnt;
-    unsigned char *u;
-    const int width = 16;
-    const int seppos = 7;
+int main() {
+#ifdef HELTEC_STM32L4
+    DigitalOut vext(POWER_VEXT);
+    vext = POWER_VEXT_ON;
+#endif    
+    /*
+     * inits the Serial or USBSerial when available (230400 baud).
+     * If the serial uart is not is not connected it swiches to USB Serial
+     * blinking LED means USBSerial detected, waiting for a connect.
+     * It waits up to 30 seconds for a USB terminal connections 
+     */
+    InitSerial(30*1000, &myled);
+    dprintf("Welcome to the SX1276GenericLib");
+    myled = 1;
 
-    cnt = 0;
-    u = (unsigned char *)data;
-    while (len > 0) {
-        ser->printf("%08x: ", (unsigned int)data + cnt);
-        if (dwords) {
-            unsigned int *ip = ( unsigned int *)u;
-            ser->printf(" 0x%08x\r\n", *ip);
-            u+= 4;
-            len -= 4;
-            cnt += 4;
-            continue;
-        }
-        cnt += width;
-        j = len < width ? len : width;
-        for (i = 0; i < j; i++) {
-            ser->printf("%2.2x ", *(u + i));
-            if (i == seppos)
-                ser->putc(' ');
-        }
-        ser->putc(' ');
-        if (j < width) {
-            i = width - j;
-            if (i > seppos + 1)
-                ser->putc(' ');
-            while (i--) {
-                printf("%s", "   ");
-            }
-        }
-        for (i = 0; i < j; i++) {
-            int c = *(u + i);
-            if (c >= ' ' && c <= '~')
-                ser->putc(c);
-            else
-                ser->putc('.');
-            if (i == seppos)
-                ser->putc(' ');
-        }
-        len -= width;
-        u += width;
-        ser->printf("\r\n");
-    }
-    ser->printf("--\r\n");
+    dprintf("Starting a simple LoRa PingPong");
+    SX1276PingPong();
 }