|
|
|
|
@ -1,8 +1,9 @@
|
|
|
|
|
// *******************************************************************
|
|
|
|
|
// Arduino Nano 3.3V example code
|
|
|
|
|
// for https://github.com/EmanuelFeru/hoverboard-firmware-hack-FOC
|
|
|
|
|
// Arduino example code
|
|
|
|
|
// for https://mygit.jblb.net/jerome/hoverboard-firmware-hack-FOC
|
|
|
|
|
//
|
|
|
|
|
// Copyright (C) 2019-2020 Emanuel FERU <aerdronix@gmail.com>
|
|
|
|
|
// modified by jblb <jerome@jblb.net>
|
|
|
|
|
//
|
|
|
|
|
// *******************************************************************
|
|
|
|
|
// INFO:
|
|
|
|
|
@ -10,6 +11,11 @@
|
|
|
|
|
// • The built-in (HW) Serial interface is used for debugging and visualization. In case the debugging is not needed,
|
|
|
|
|
// it is recommended to use the built-in Serial interface for full speed perfomace.
|
|
|
|
|
// • The data packaging includes a Start Frame, checksum, and re-syncronization capability for reliable communication
|
|
|
|
|
//
|
|
|
|
|
// by JbLb
|
|
|
|
|
// • Converted to platformio
|
|
|
|
|
// • Adapted to Arduino leonardo to use CDC serail interface
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// CONFIGURATION on the hoverboard side in config.h:
|
|
|
|
|
// • Option 1: Serial on Left Sensor cable (long wired cable)
|
|
|
|
|
@ -30,8 +36,10 @@
|
|
|
|
|
#define SPEED_MAX_TEST 300 // [-] Maximum speed for testing
|
|
|
|
|
//#define DEBUG_RX // [-] Debug received data. Prints all bytes to serial (comment-out to disable)
|
|
|
|
|
|
|
|
|
|
#ifndef AVR_LEONARDO
|
|
|
|
|
#include <SoftwareSerial.h>
|
|
|
|
|
SoftwareSerial HoverSerial(2,3); // RX, TX
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
// Global variables
|
|
|
|
|
uint8_t idx = 0; // Index for new data pointer
|
|
|
|
|
|