![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
fuck this
Dependencies: BMP280
Serial.h@25:a2aedb498b27, 2018-01-10 (annotated)
- Committer:
- mwthewsey
- Date:
- Wed Jan 10 03:57:59 2018 +0000
- Revision:
- 25:a2aedb498b27
- Parent:
- 21:6e733076f49c
Final Submission
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Swaggie | 2:5a38ae8459d5 | 1 | #ifndef __Serial__ |
Swaggie | 2:5a38ae8459d5 | 2 | #define __Serial__ |
mwthewsey | 10:261f2b69c4c7 | 3 | /* |
mwthewsey | 21:6e733076f49c | 4 | *This module handles all serial communications with a PC over USB. |
mwthewsey | 21:6e733076f49c | 5 | *Serial code is attached to its own thread and is run when the RX interrupt is triggered. |
mwthewsey | 21:6e733076f49c | 6 | *The RX interrupt is triggered when someone starts typing in a PC terminal. |
mwthewsey | 21:6e733076f49c | 7 | *The Scanf function is then started to capture the input. |
mwthewsey | 21:6e733076f49c | 8 | *There are a list of commands that are used with serial: |
mwthewsey | 21:6e733076f49c | 9 | |
mwthewsey | 21:6e733076f49c | 10 | * readall |
mwthewsey | 21:6e733076f49c | 11 | * deleteall |
mwthewsey | 21:6e733076f49c | 12 | * read <n> |
mwthewsey | 21:6e733076f49c | 13 | * delete <n> |
mwthewsey | 21:6e733076f49c | 14 | * setdate <dd><mm><yyyy> |
mwthewsey | 21:6e733076f49c | 15 | * settime <hh><mm><ss> |
mwthewsey | 21:6e733076f49c | 16 | * sett <T> |
mwthewsey | 21:6e733076f49c | 17 | * state <x> |
mwthewsey | 21:6e733076f49c | 18 | * logging <x> |
mwthewsey | 21:6e733076f49c | 19 | |
mwthewsey | 10:261f2b69c4c7 | 20 | */ |
Swaggie | 2:5a38ae8459d5 | 21 | |
mwthewsey | 10:261f2b69c4c7 | 22 | #include "mbed.h" |
mwthewsey | 10:261f2b69c4c7 | 23 | #include "Sampling.h" |
mwthewsey | 21:6e733076f49c | 24 | #include "Logging.h" |
mwthewsey | 10:261f2b69c4c7 | 25 | |
mwthewsey | 10:261f2b69c4c7 | 26 | //Variables |
mwthewsey | 21:6e733076f49c | 27 | extern int DateTimeVar[3]; //Used for reading date or time from serial |
mwthewsey | 21:6e733076f49c | 28 | extern bool SerialState; //Used for toggling sampling |
mwthewsey | 21:6e733076f49c | 29 | extern char InputBufferText[128]; //Buffer for incoming chars |
mwthewsey | 21:6e733076f49c | 30 | extern unsigned short InputBufferNum; //Buffer for incoming numbers |
mwthewsey | 21:6e733076f49c | 31 | extern unsigned short internalIndex; //Used for incrementing out sample data |
mwthewsey | 10:261f2b69c4c7 | 32 | |
mwthewsey | 10:261f2b69c4c7 | 33 | //Objects |
mwthewsey | 21:6e733076f49c | 34 | extern Thread SampleThread; |
mwthewsey | 10:261f2b69c4c7 | 35 | extern Serial PC; |
mwthewsey | 10:261f2b69c4c7 | 36 | |
mwthewsey | 10:261f2b69c4c7 | 37 | //Functions |
mwthewsey | 10:261f2b69c4c7 | 38 | |
mwthewsey | 10:261f2b69c4c7 | 39 | void SerialStart(void); |
mwthewsey | 10:261f2b69c4c7 | 40 | //Initialising serial interface |
mwthewsey | 10:261f2b69c4c7 | 41 | |
mwthewsey | 10:261f2b69c4c7 | 42 | void RXInterruptISR(void); |
mwthewsey | 10:261f2b69c4c7 | 43 | //Function attached to the RX interrupt, sets SerialThread signal. |
mwthewsey | 10:261f2b69c4c7 | 44 | |
mwthewsey | 10:261f2b69c4c7 | 45 | void SerialCode(void); |
mwthewsey | 10:261f2b69c4c7 | 46 | //Code that runs in the SerialThread |
mwthewsey | 10:261f2b69c4c7 | 47 | |
Swaggie | 2:5a38ae8459d5 | 48 | |
Swaggie | 2:5a38ae8459d5 | 49 | |
Swaggie | 2:5a38ae8459d5 | 50 | #endif |