Bayley Wang
/
analoghalls
potato
Fork of analoghalls by
main.cpp@1:70eed554399b, 2015-02-21 (annotated)
- Committer:
- bwang
- Date:
- Sat Feb 21 21:39:33 2015 +0000
- Revision:
- 1:70eed554399b
- Parent:
- 0:9753f3c2e5ca
- Child:
- 2:b5c19d4eddcc
potato
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
nki | 0:9753f3c2e5ca | 1 | #include "mbed.h" |
nki | 0:9753f3c2e5ca | 2 | #include "constants.h" |
nki | 0:9753f3c2e5ca | 3 | #include "shared.h" |
nki | 0:9753f3c2e5ca | 4 | #include "util.h" |
nki | 0:9753f3c2e5ca | 5 | #include "math.h" |
bwang | 1:70eed554399b | 6 | #include "isr.h" |
nki | 0:9753f3c2e5ca | 7 | |
nki | 0:9753f3c2e5ca | 8 | Serial pc(SERIAL_TX, SERIAL_RX); |
nki | 0:9753f3c2e5ca | 9 | |
nki | 0:9753f3c2e5ca | 10 | PwmOut pha(_PH_A); |
nki | 0:9753f3c2e5ca | 11 | PwmOut phb(_PH_B); |
nki | 0:9753f3c2e5ca | 12 | PwmOut phc(_PH_C); |
nki | 0:9753f3c2e5ca | 13 | |
nki | 0:9753f3c2e5ca | 14 | DigitalOut en(_EN); |
nki | 0:9753f3c2e5ca | 15 | |
nki | 0:9753f3c2e5ca | 16 | AnalogIn throttle(_THROTTLE); |
nki | 0:9753f3c2e5ca | 17 | AnalogIn analoga(_ANALOGA); |
nki | 0:9753f3c2e5ca | 18 | AnalogIn analogb(_ANALOGB); |
nki | 0:9753f3c2e5ca | 19 | |
nki | 0:9753f3c2e5ca | 20 | Motor* motor; |
nki | 0:9753f3c2e5ca | 21 | |
bwang | 1:70eed554399b | 22 | Ticker dtc_upd_ticker, throttle_upd_ticker; |
nki | 0:9753f3c2e5ca | 23 | |
bwang | 1:70eed554399b | 24 | float throttle_read; |
nki | 0:9753f3c2e5ca | 25 | |
nki | 0:9753f3c2e5ca | 26 | int main() { |
nki | 0:9753f3c2e5ca | 27 | en = 1; |
nki | 0:9753f3c2e5ca | 28 | |
nki | 0:9753f3c2e5ca | 29 | initTimers(); |
nki | 0:9753f3c2e5ca | 30 | initPins(); |
nki | 0:9753f3c2e5ca | 31 | initData(); |
nki | 0:9753f3c2e5ca | 32 | |
nki | 0:9753f3c2e5ca | 33 | while(1) { |
bwang | 1:70eed554399b | 34 | throttle_read = throttle; |
bwang | 1:70eed554399b | 35 | pos_update(); |
nki | 0:9753f3c2e5ca | 36 | } |
nki | 0:9753f3c2e5ca | 37 | } |