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.h

Committer:
dreamselec
Date:
2015-11-24
Revision:
18:44a1c1a30166
Parent:
17:af373246bf80
Child:
20:4e0f0944f28f

File content as of revision 18:44a1c1a30166:




#ifndef _globals_h_
#define _globals_h_

#include "Block.h"
#include "mbed.h"
//#include "MCP23017.h"
//#include "fpga.h"

class FPGA;
class TCS3472_I2C;
class MCP23017;
class WattBob_TextLCD;

extern mbed::Serial pc;
extern MCP23017 *i2cport;
extern int kDefaultBaudRate;
extern WattBob_TextLCD *lcd;
//extern SerialBase gParity;
extern int gStopBits;
extern bool connectedToPC;
extern bool runServoTest;

const int kCommandBufferSize = 80;
const int kSmallBufferSize = 5;

#define FOREVER for(;;)

const char CommandTypeValue [3] = {'!', '?', ':'};
const char kCommandTerminator = ';';
enum CommandTypeRaw { InvalidType = -1, Set = 0, Query = 1, Reply = 2 };

const Block kDefaultHazBlock = Block(Block::Small);
extern Block _HazBlock;
extern FPGA *fpga;

extern TCS3472_I2C rgbSensor;

enum Servos {Stopping = 1, Sorting = 2};
enum StoppingServoPositions {Stop = 0, Go = 1};
enum SortingServoPositions {NonHaz = 1, Haz = 0};
enum Controls { Start = 0, Pause = 1};
enum PCModes { None = -1, Normal = 0, Maintanence = 1};

extern PCModes currentMode;
extern Controls currentState;

int readSwitches();

void connectToPC(CommandTypeRaw typeRaw=Set);
void disconnectToPC(CommandTypeRaw typeRaw=Set);
void hazBlock(CommandTypeRaw typeRaw);
void getCurrentBlock(CommandTypeRaw typeRaw=Query);

void setIntegrationTimeTo(float integrationTime);
void previewOnPC(bool on);
void readColourSensor ();

void testServos(Controls state);
void resetServos();

void getPortInfo();
void setPortBaudRate(int baudRate);
void setPortParity(int parity);


#endif