TFC-Mentoring-Matters-Abstraction
RaceCar/Inits.cpp@0:0699eb71778e, 2014-07-16 (annotated)
- Committer:
- mrkeithcyr
- Date:
- Wed Jul 16 15:36:33 2014 +0000
- Revision:
- 0:0699eb71778e
First code commit.; Note known issue: in modes 1, 4, and 5 - The motor outputs are severely retarded by serial connection.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mrkeithcyr | 0:0699eb71778e | 1 | #include "TFC.h" |
mrkeithcyr | 0:0699eb71778e | 2 | #include "common.h" |
mrkeithcyr | 0:0699eb71778e | 3 | |
mrkeithcyr | 0:0699eb71778e | 4 | /****** TFC_TickerUpdate() ***************************************************** |
mrkeithcyr | 0:0699eb71778e | 5 | Purpose: This ticker code is used to maintain compatibility with the CodeWarrior |
mrkeithcyr | 0:0699eb71778e | 6 | version of the sample. This code uses an MBED Ticker for background timing. |
mrkeithcyr | 0:0699eb71778e | 7 | Parameters: None |
mrkeithcyr | 0:0699eb71778e | 8 | Returns: None |
mrkeithcyr | 0:0699eb71778e | 9 | *******************************************************************************/ |
mrkeithcyr | 0:0699eb71778e | 10 | void TFC_TickerUpdate() |
mrkeithcyr | 0:0699eb71778e | 11 | { |
mrkeithcyr | 0:0699eb71778e | 12 | int i; |
mrkeithcyr | 0:0699eb71778e | 13 | |
mrkeithcyr | 0:0699eb71778e | 14 | for(i=0; i<NUM_TFC_TICKERS; i++) |
mrkeithcyr | 0:0699eb71778e | 15 | { |
mrkeithcyr | 0:0699eb71778e | 16 | if(TFC_Ticker[i]<0xFFFFFFFF) |
mrkeithcyr | 0:0699eb71778e | 17 | { |
mrkeithcyr | 0:0699eb71778e | 18 | TFC_Ticker[i]++; |
mrkeithcyr | 0:0699eb71778e | 19 | } |
mrkeithcyr | 0:0699eb71778e | 20 | } |
mrkeithcyr | 0:0699eb71778e | 21 | } |
mrkeithcyr | 0:0699eb71778e | 22 | |
mrkeithcyr | 0:0699eb71778e | 23 | /****** WhatToTurnOn() ********************************************************* |
mrkeithcyr | 0:0699eb71778e | 24 | Purpose: This function initializes the interfaces between the controller |
mrkeithcyr | 0:0699eb71778e | 25 | board and the hardware. |
mrkeithcyr | 0:0699eb71778e | 26 | Parameters: None |
mrkeithcyr | 0:0699eb71778e | 27 | Returns: None |
mrkeithcyr | 0:0699eb71778e | 28 | *******************************************************************************/ |
mrkeithcyr | 0:0699eb71778e | 29 | void WhatToTurnOn() |
mrkeithcyr | 0:0699eb71778e | 30 | { |
mrkeithcyr | 0:0699eb71778e | 31 | // set baud rate for serial output based on terminal type |
mrkeithcyr | 0:0699eb71778e | 32 | // 115200 works with Excel, TeraTerm, and Putty |
mrkeithcyr | 0:0699eb71778e | 33 | // 9600 works with USB Serial Monitor Lite |
mrkeithcyr | 0:0699eb71778e | 34 | // USB Serial Monitor Lite does not work above 9600 |
mrkeithcyr | 0:0699eb71778e | 35 | PC.baud(115200); |
mrkeithcyr | 0:0699eb71778e | 36 | |
mrkeithcyr | 0:0699eb71778e | 37 | // start counter for this hardware |
mrkeithcyr | 0:0699eb71778e | 38 | TFC_TickerObj.attach_us(&TFC_TickerUpdate,2000); |
mrkeithcyr | 0:0699eb71778e | 39 | |
mrkeithcyr | 0:0699eb71778e | 40 | // initialize camera, servo, and motor systems |
mrkeithcyr | 0:0699eb71778e | 41 | TFC_Init(); |
mrkeithcyr | 0:0699eb71778e | 42 | } |