Nathaniel Honka / Mbed 2 deprecated Data-Management-Honka

Dependencies:   ExoController MODSERIAL SDFileSystem_HelloWorld UI-Honka mbed

Fork of Data Management by HEL's Angels

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers initDatabed.cpp Source File

initDatabed.cpp

00001 #include "mbed.h"
00002 #include "MODSERIAL.h"
00003 #include "BluetoothComm.h"
00004 #include "SDFile.h"
00005 
00006 MODSERIAL xbeeUI(p28, p27); //XBee UI crutch communication
00007 
00008 Serial pc(USBTX, USBRX);
00009 SPISlave comm(p5, p6, p7, p8); // mosi, miso, sclk, ssel
00010 
00011 // amplifier power on
00012 DigitalOut mainPower(p26); // power to board/motors etc
00013 
00014 //inhibit pins
00015 DigitalOut inhibit_L(p24);
00016 DigitalOut inhibit_R(p25);
00017 
00018 // various LEDs
00019 DigitalOut statusLed(p15);
00020 DigitalOut boardLed1(LED1);
00021 DigitalOut boardLed2(LED2);
00022 DigitalOut boardLed3(LED3);
00023 DigitalOut boardLed4(LED4);
00024 
00025 //Amplifier fault pins
00026 DigitalIn leftFault(p21);
00027 DigitalIn rightFault(p22);
00028 SDFileSystem sd(p11, p12, p13, p14, "sd");
00029 //SDFileSystem sd(p5, p6, p7, p19, "sd");
00030 SDFile err("/sd/", "error.txt", true);
00031 SDFile readData("/sd/", "data.txt", false);
00032 SDFile param("/sd/", "param.txt", false);
00033 SDFile testFile("/sd/", "test.txt", false);
00034 CAN BMS(p30, p29);
00035 CANMessage msg;
00036 Ticker interrupt;
00037 
00038 BluetoothComm phone(p9, p10);
00039 //BluetoothComm phone(p13, p14);
00040 void initializeDatabed() {
00041     xbeeUI.baud(115200);
00042    // printf("setting pc baud ...\r\n");
00043     pc.baud(921600);
00044     //printf("setting comm freq\r\n");   
00045     comm.frequency(1000000);
00046     comm.format(8,1);
00047     inhibit_L=1;
00048     inhibit_R=1;
00049     BMS.frequency(250000);
00050 
00051     wait(1);
00052     printf("Starting databed...\r\n");
00053 
00054 }