Skip to content

Commit

Permalink
Initial pass at adding support for AdaFruit BLE. Most config is done but
Browse files Browse the repository at this point in the history
no parameter updating actually happens yet.
  • Loading branch information
collin80 committed Jul 19, 2016
1 parent 4d8738c commit fe5abbf
Show file tree
Hide file tree
Showing 9 changed files with 1,129 additions and 46 deletions.
57 changes: 57 additions & 0 deletions BluefruitConfig.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// COMMON SETTINGS
// ----------------------------------------------------------------------------------------------
// These settings are used in both SW UART, HW UART and SPI mode
// ----------------------------------------------------------------------------------------------
#define BUFSIZE 128 // Size of the read buffer for incoming data
#define VERBOSE_MODE false // If set to 'true' enables debug output


// SOFTWARE UART SETTINGS
// ----------------------------------------------------------------------------------------------
// The following macros declare the pins that will be used for 'SW' serial.
// You should use this option if you are connecting the UART Friend to an UNO
// ----------------------------------------------------------------------------------------------
#define BLUEFRUIT_SWUART_RXD_PIN 9 // Required for software serial!
#define BLUEFRUIT_SWUART_TXD_PIN 10 // Required for software serial!
#define BLUEFRUIT_UART_CTS_PIN 11 // Required for software serial!
#define BLUEFRUIT_UART_RTS_PIN -1 // Optional, set to -1 if unused


// HARDWARE UART SETTINGS
// ----------------------------------------------------------------------------------------------
// The following macros declare the HW serial port you are using. Uncomment
// this line if you are connecting the BLE to Leonardo/Micro or Flora
// ----------------------------------------------------------------------------------------------
#ifdef Serial1 // this makes it not complain on compilation if there's no Serial1
#define BLUEFRUIT_HWSERIAL_NAME Serial
#endif


// SHARED UART SETTINGS
// ----------------------------------------------------------------------------------------------
// The following sets the optional Mode pin, its recommended but not required
// ----------------------------------------------------------------------------------------------
#define BLUEFRUIT_UART_MODE_PIN -1 // Set to -1 if unused


// SHARED SPI SETTINGS
// ----------------------------------------------------------------------------------------------
// The following macros declare the pins to use for HW and SW SPI communication.
// SCK, MISO and MOSI should be connected to the HW SPI pins on the Uno when
// using HW SPI. These standard pins are MISO-74, MOSI-75, and SCK-76
//This should be used with nRF51822 based Bluefruit LE modules
// that use SPI (Bluefruit LE SPI Friend).
// ----------------------------------------------------------------------------------------------
#define BLUEFRUIT_SPI_CS 63
#define BLUEFRUIT_SPI_IRQ 27
#define BLUEFRUIT_SPI_RST 65 // Optional but recommended, set to -1 if unused

// SOFTWARE SPI SETTINGS
// ----------------------------------------------------------------------------------------------
// The following macros declare the pins to use for SW SPI communication.
// This should be used with nRF51822 based Bluefruit LE modules that use SPI
// (Bluefruit LE SPI Friend).
// ----------------------------------------------------------------------------------------------
#define BLUEFRUIT_SPI_SCK 13
#define BLUEFRUIT_SPI_MISO 12
#define BLUEFRUIT_SPI_MOSI 11
3 changes: 1 addition & 2 deletions CKMotorController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void CKMotorController::setup() {

running = false;
setSelectedGear(NEUTRAL);
setOpState(DISABLED );
setOpState(DISABLED);
CK_milli = millis();

TickHandler::getInstance()->attach(this, CFG_TICK_INTERVAL_MOTOR_CONTROLLER_DMOC);
Expand All @@ -69,7 +69,6 @@ void CKMotorController::setup() {
and also the checksum must match the one we calculate. Right now we'll just assume
everything has gone according to plan.
*/

void CKMotorController::handleCanFrame(CAN_FRAME *frame) {
int RotorTemp, invTemp, StatorTemp;
int temp;
Expand Down
1 change: 1 addition & 0 deletions DeviceTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ enum DeviceId { //unique device ID for every piece of hardware possible
CANBRAKEPEDAL = 0x1034,
EVICTUS = 0x4400,
ICHIP2128 = 0x1040,
ADABLUE = 0x1041,
DCDC = 0x1050,
THINKBMS = 0x2000,
FAULTSYS = 0x4000,
Expand Down
1 change: 1 addition & 0 deletions GEVCU.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "SerialConsole.h"
#include "ELM327_Emu.h"
#include "ichip_2128.h"
#include "adafruitBLE.h"
#include "Sys_Messages.h"
#include "CodaMotorController.h"
#include "FaultHandler.h"
Expand Down
5 changes: 3 additions & 2 deletions GEVCU.ino
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ byte i = 0;

void sendWiReach(char* message)
{
Serial2.println(message);
Serial2.println(message);
delay(700);
while (Serial2.available()) {SerialUSB.write(Serial2.read());}
}
Expand Down Expand Up @@ -223,7 +223,8 @@ void createObjects() {
BrusaMotorController *bmotorController = new BrusaMotorController();
ThinkBatteryManager *BMS = new ThinkBatteryManager();
ELM327Emu *emu = new ELM327Emu();
ICHIPWIFI *iChip = new ICHIPWIFI();
ICHIPWIFI *iChip = new ICHIPWIFI();
ADAFRUITBLE *ble = new ADAFRUITBLE();
EVIC *eVIC = new EVIC();
}
void initializeDevices() {
Expand Down
Loading

0 comments on commit fe5abbf

Please sign in to comment.