potato

Dependencies:   mbed

Fork of analoghalls by N K

main.cpp

Committer:
bwang
Date:
2015-02-23
Revision:
2:b5c19d4eddcc
Parent:
1:70eed554399b
Child:
3:86ccde39f61b

File content as of revision 2:b5c19d4eddcc:

#include "mbed.h"


#include "constants.h"
#include "shared.h"
#include "util.h"
#include "math.h"
#include "isr.h"

Serial pc(SERIAL_TX, SERIAL_RX);

PwmOut pha(_PH_A);
PwmOut phb(_PH_B);
PwmOut phc(_PH_C);

DigitalOut en(_EN);

DigitalIn dummy(D5);

AnalogIn throttle(_THROTTLE);
AnalogIn analoga(_ANALOGA);
AnalogIn analogb(_ANALOGB);

Motor* motor;

#ifdef __USE_THROTTLE
    Ticker dtc_upd_ticker;
    Ticker throttle_upd_ticker;
#endif

float throttle_read;

int main() {    
    en = 1;
    
    initTimers();
    initPins();
    initData();
    
    while(1) {
#ifdef __USE_THROTTLE
        throttle_read = throttle;
#endif
        pos_update();
#ifndef __USE_THROTTLE
        dtc_update();
#endif
    }
}