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
- Committer:
- Helmut64
- Date:
- 2018-02-22
- Revision:
- 16:675f4d0ee9e9
- Parent:
- 13:5a32a1922fbc
- Child:
- 17:98f2528e8399
File content as of revision 16:675f4d0ee9e9:
/* * Copyright (c) 2017 Helmut Tschemernjak * 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(); } 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; 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"); }