test

Dependencies:   MODDMA MODSERIAL mbed

Fork of IRIS_MBED by IRIS

Committer:
JonathanAshworth
Date:
Thu Mar 26 12:02:10 2015 +0000
Revision:
4:1017848d2fe1
Parent:
0:2676c97df44e
Child:
6:8ffc6d3a7c1d
Tested working version using dma ISRs

Who changed what in which revision?

UserRevisionLine numberNew contents of line
JonathanAshworth 4:1017848d2fe1 1 /*
JonathanAshworth 0:2676c97df44e 2
JonathanAshworth 0:2676c97df44e 3 void serialTx (void);
JonathanAshworth 0:2676c97df44e 4 void usbTimeout(void);
JonathanAshworth 0:2676c97df44e 5 void shutdown(void);
JonathanAshworth 0:2676c97df44e 6 void serialRx_ISR(void);
JonathanAshworth 0:2676c97df44e 7 void usbTimer_ISR(void);
JonathanAshworth 4:1017848d2fe1 8
JonathanAshworth 4:1017848d2fe1 9 */
JonathanAshworth 4:1017848d2fe1 10
JonathanAshworth 4:1017848d2fe1 11 #include "MODSERIAL/MODSERIAL.h"
JonathanAshworth 4:1017848d2fe1 12
JonathanAshworth 4:1017848d2fe1 13 enum servoStatus {ToBeMoved = 0, Moving = 1, InPosition = 2};
JonathanAshworth 4:1017848d2fe1 14 enum dataErrors {Timeout = 0, RequestDataBad = 1};
JonathanAshworth 4:1017848d2fe1 15
JonathanAshworth 4:1017848d2fe1 16 struct Flags
JonathanAshworth 4:1017848d2fe1 17 {
JonathanAshworth 4:1017848d2fe1 18 bool rxNewData;
JonathanAshworth 4:1017848d2fe1 19 bool txSentData;
JonathanAshworth 4:1017848d2fe1 20 bool PCTimeout;
JonathanAshworth 4:1017848d2fe1 21 };
JonathanAshworth 4:1017848d2fe1 22
JonathanAshworth 4:1017848d2fe1 23 struct Servo
JonathanAshworth 4:1017848d2fe1 24 {
JonathanAshworth 4:1017848d2fe1 25 char channel;
JonathanAshworth 4:1017848d2fe1 26 int position;
JonathanAshworth 4:1017848d2fe1 27 int speed;
JonathanAshworth 4:1017848d2fe1 28 int time;
JonathanAshworth 4:1017848d2fe1 29 servoStatus status;
JonathanAshworth 4:1017848d2fe1 30 };
JonathanAshworth 4:1017848d2fe1 31
JonathanAshworth 4:1017848d2fe1 32 struct DriveMotor
JonathanAshworth 4:1017848d2fe1 33 {
JonathanAshworth 4:1017848d2fe1 34 float demandPulseWidth;
JonathanAshworth 4:1017848d2fe1 35 };
JonathanAshworth 4:1017848d2fe1 36
JonathanAshworth 4:1017848d2fe1 37 struct AccelerometerSensor
JonathanAshworth 4:1017848d2fe1 38 {
JonathanAshworth 4:1017848d2fe1 39
JonathanAshworth 4:1017848d2fe1 40 };
JonathanAshworth 4:1017848d2fe1 41
JonathanAshworth 4:1017848d2fe1 42 struct GyroSensor
JonathanAshworth 4:1017848d2fe1 43 {
JonathanAshworth 4:1017848d2fe1 44
JonathanAshworth 4:1017848d2fe1 45 };
JonathanAshworth 4:1017848d2fe1 46
JonathanAshworth 4:1017848d2fe1 47 struct MagnetometerSensor
JonathanAshworth 4:1017848d2fe1 48 {
JonathanAshworth 4:1017848d2fe1 49
JonathanAshworth 4:1017848d2fe1 50 };
JonathanAshworth 4:1017848d2fe1 51
JonathanAshworth 4:1017848d2fe1 52 struct GPSSensor
JonathanAshworth 4:1017848d2fe1 53 {
JonathanAshworth 4:1017848d2fe1 54 float latitudeN;
JonathanAshworth 4:1017848d2fe1 55 float longitudeW;
JonathanAshworth 4:1017848d2fe1 56 float speedOverGroundKMPH;
JonathanAshworth 4:1017848d2fe1 57 };
JonathanAshworth 4:1017848d2fe1 58
JonathanAshworth 4:1017848d2fe1 59 struct TemperatureSensor
JonathanAshworth 4:1017848d2fe1 60 {
JonathanAshworth 4:1017848d2fe1 61 float tempCelsius;
JonathanAshworth 4:1017848d2fe1 62 };
JonathanAshworth 4:1017848d2fe1 63
JonathanAshworth 4:1017848d2fe1 64 struct HumiditySensor
JonathanAshworth 4:1017848d2fe1 65 {
JonathanAshworth 4:1017848d2fe1 66 float humidityPercentage;
JonathanAshworth 4:1017848d2fe1 67 };
JonathanAshworth 4:1017848d2fe1 68
JonathanAshworth 4:1017848d2fe1 69 struct BatteryVoltageSensor
JonathanAshworth 4:1017848d2fe1 70 {
JonathanAshworth 4:1017848d2fe1 71 float voltageVolts;
JonathanAshworth 4:1017848d2fe1 72 };
JonathanAshworth 4:1017848d2fe1 73
JonathanAshworth 4:1017848d2fe1 74 struct BatteryCurrentSensor
JonathanAshworth 4:1017848d2fe1 75 {
JonathanAshworth 4:1017848d2fe1 76 float currentAmps;
JonathanAshworth 4:1017848d2fe1 77 };
JonathanAshworth 4:1017848d2fe1 78
JonathanAshworth 4:1017848d2fe1 79 struct PIRSensor
JonathanAshworth 4:1017848d2fe1 80 {
JonathanAshworth 4:1017848d2fe1 81 bool alarmStatus;
JonathanAshworth 4:1017848d2fe1 82 };
JonathanAshworth 4:1017848d2fe1 83
JonathanAshworth 4:1017848d2fe1 84 struct UltrasoundSensor
JonathanAshworth 4:1017848d2fe1 85 {
JonathanAshworth 4:1017848d2fe1 86 char muxChannel;
JonathanAshworth 4:1017848d2fe1 87 float distanceMillimeters;
JonathanAshworth 4:1017848d2fe1 88 };
JonathanAshworth 4:1017848d2fe1 89
JonathanAshworth 4:1017848d2fe1 90
JonathanAshworth 4:1017848d2fe1 91 void getServoData(Servo *servo);
JonathanAshworth 4:1017848d2fe1 92 void initialise(void);
JonathanAshworth 4:1017848d2fe1 93 void dmaPCSerialRx(MODSERIAL_IRQ_INFO *q);
JonathanAshworth 4:1017848d2fe1 94 void dmaSSC32SerialRx(MODSERIAL_IRQ_INFO *q);
JonathanAshworth 4:1017848d2fe1 95 void dmaGPSSerialRx(MODSERIAL_IRQ_INFO *q);
JonathanAshworth 4:1017848d2fe1 96 void PCTimeout(void);
JonathanAshworth 4:1017848d2fe1 97 void timerISR(void);
JonathanAshworth 4:1017848d2fe1 98 void sendSerialData(void);