![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
3rd year group project. Electronic and Electrical Engineering. Heriot-Watt University. This is the code for the mbed for the Automatic Little Object Organiser (ALOO).
Dependencies: MCP23017 TCS3472_I2C WattBob_TextLCD mbed
globals.cpp@8:e1da2ae62885, 2015-11-16 (annotated)
- Committer:
- dreamselec
- Date:
- Mon Nov 16 22:20:11 2015 +0000
- Revision:
- 8:e1da2ae62885
- Parent:
- 7:b6e31bfdb2af
- Child:
- 9:dc8f155b71c8
Ready for PC command parsing testing. Currently only prints command to PC.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dreamselec | 2:7a55cb10259f | 1 | #include "globals.h" |
dreamselec | 2:7a55cb10259f | 2 | |
dreamselec | 7:b6e31bfdb2af | 3 | int kDefaultBaudRate = 19200; |
dreamselec | 2:7a55cb10259f | 4 | //SerialBase gParity = SerialBase::None; |
dreamselec | 2:7a55cb10259f | 5 | int gStopBits = 1; |
dreamselec | 3:843b830ee8bd | 6 | |
dreamselec | 7:b6e31bfdb2af | 7 | Block _HazBlock = Block(kDefaultHazBlock); |
dreamselec |
8:e1da2ae62885 | 8 | |
dreamselec |
8:e1da2ae62885 | 9 | bool connectedToPC = false; |
dreamselec |
8:e1da2ae62885 | 10 | |
dreamselec |
8:e1da2ae62885 | 11 | void connectToPC(CommandTypeRaw typeRaw){ |
dreamselec |
8:e1da2ae62885 | 12 | pc.printf("pc told to connect\n"); |
dreamselec |
8:e1da2ae62885 | 13 | connectedToPC = true; |
dreamselec |
8:e1da2ae62885 | 14 | } |
dreamselec |
8:e1da2ae62885 | 15 | |
dreamselec |
8:e1da2ae62885 | 16 | void disconnectToPC(CommandTypeRaw typeRaw){ |
dreamselec |
8:e1da2ae62885 | 17 | pc.printf("pc told to disconnect\n"); |
dreamselec |
8:e1da2ae62885 | 18 | connectedToPC = false; |
dreamselec |
8:e1da2ae62885 | 19 | } |
dreamselec |
8:e1da2ae62885 | 20 | |
dreamselec |
8:e1da2ae62885 | 21 | void hazBlock(CommandTypeRaw typeRaw){ |
dreamselec |
8:e1da2ae62885 | 22 | if (typeRaw == Set) { |
dreamselec |
8:e1da2ae62885 | 23 | pc.printf("setting new haz block.\n"); |
dreamselec |
8:e1da2ae62885 | 24 | }else if (typeRaw == Query){ |
dreamselec |
8:e1da2ae62885 | 25 | pc.printf("priting current haz block settings.\n"); |
dreamselec |
8:e1da2ae62885 | 26 | } |
dreamselec |
8:e1da2ae62885 | 27 | } |
dreamselec |
8:e1da2ae62885 | 28 | |
dreamselec |
8:e1da2ae62885 | 29 | void getCurrentBlock(CommandTypeRaw typeRaw){ |
dreamselec |
8:e1da2ae62885 | 30 | pc.printf("getting current block readings\n"); |
dreamselec |
8:e1da2ae62885 | 31 | } |
dreamselec |
8:e1da2ae62885 | 32 | |
dreamselec |
8:e1da2ae62885 | 33 | void setIntegrationTime(int integrationTime){ |
dreamselec |
8:e1da2ae62885 | 34 | pc.printf("setting i-time to %i.\n", integrationTime); |
dreamselec |
8:e1da2ae62885 | 35 | } |
dreamselec |
8:e1da2ae62885 | 36 | |
dreamselec |
8:e1da2ae62885 | 37 | void previewOnPC(bool on){ |
dreamselec |
8:e1da2ae62885 | 38 | pc.printf("setting preview on pc to %i.\n", on); |
dreamselec |
8:e1da2ae62885 | 39 | } |
dreamselec |
8:e1da2ae62885 | 40 | |
dreamselec |
8:e1da2ae62885 | 41 | void testServos(){ |
dreamselec |
8:e1da2ae62885 | 42 | pc.printf("testing servos.\n"); |
dreamselec |
8:e1da2ae62885 | 43 | } |
dreamselec |
8:e1da2ae62885 | 44 | |
dreamselec |
8:e1da2ae62885 | 45 | void resetServos(){ |
dreamselec |
8:e1da2ae62885 | 46 | pc.printf("resetting servos.\n"); |
dreamselec |
8:e1da2ae62885 | 47 | } |
dreamselec |
8:e1da2ae62885 | 48 | |
dreamselec |
8:e1da2ae62885 | 49 | void getPortInfo(){ |
dreamselec |
8:e1da2ae62885 | 50 | pc.printf("getting port info.\n"); |
dreamselec |
8:e1da2ae62885 | 51 | } |
dreamselec |
8:e1da2ae62885 | 52 | |
dreamselec |
8:e1da2ae62885 | 53 | void setPortBaudRate(int baudRate){ |
dreamselec |
8:e1da2ae62885 | 54 | pc.printf("setting port baudrate to: %i\n", baudRate); |
dreamselec |
8:e1da2ae62885 | 55 | } |
dreamselec |
8:e1da2ae62885 | 56 |