2014 sift / Mbed 2 deprecated TVDctrller2017_brdRev1_PandA

Dependencies:   mbed

Fork of TVDctrller2017_brdRev1_ver6 by 2014 sift

TVDcontrolDEMO_main.cpp

Committer:
sift
Date:
2016-07-09
Revision:
1:4d86ec2fe4b1
Parent:
0:276c1dab2d62
Child:
2:9d69f27a3d3b

File content as of revision 1:4d86ec2fe4b1:

#include "mbed.h"
#include "TVDCTRL.h"
#include "MCP4922.h"

////////////////////////////////////////
//IO宣言
SPI spi(p5,p6,p7);
MCP4922 mcp(p5,p7,p8);  // MOSI, SCLK, CS
Serial com2(p9, p10);   //xbeeとかデバッグ用
DigitalOut cs(p11);
//12
//13
//14
InterruptIn rightMotorPulse(p15);
InterruptIn leftMotorPulse(p16);

AnalogIn brake(p17);
AnalogOut ana(p18);
AnalogIn apsS(p19);     //"S"econdary
AnalogIn apsP(p20);     //"P"rimary
DigitalOut indicatorLed(p21);
DigitalOut shutDown(p22);
DigitalOut MotorPulse[] = {p23, p24};
DigitalIn RTDSW(p25);
DigitalIn SDState(p26);
Serial com1(p28, p27);  //インパネとの通信に使用するかも知れなくもないかもしれない

DigitalOut LED[] = {LED1, LED2, LED3, LED4};
//DigitalOut watchDog();
CAN can(p30, p29);

#define indicateSystem(x)       (indicatorLed.write(x))
#define shutdownSystem(void)    (shutDown.write(0))
#define bootSystem(void)        (shutDown.write(1))
#define isPressedRTD(void)      (!RTDSW.read())
#define isShutdownSystem(void)  (SDState.read())

void initIO(void)
{
    indicatorLed = 0;
    shutDown = 0;
    LED[0] = LED[1] = LED[2] = LED[3] = 0;

    RTDSW.mode(PullUp);
    SDState.mode(PullUp);
}

int main(void)
{
    printf("\r\nVersion:TVDCU_Alpha...start!!!!!\r\n");

    initIO();       //IOポート初期化

    initTVD();

    while(1) {

        printf("%f\r\n", getVelocity()*3.6f);
    }
}