Sampling ldr temp and pressure data into 120 sample FIFO buffer.

Dependencies:   BME280 BMP280

Fork of Task690-mbed-os-FZ429ZI by University of Plymouth - Stages 1, 2 and 3

Committer:
osmith2
Date:
Sat Dec 23 18:44:37 2017 +0000
Revision:
6:c2299e3de428
used sprintf to put all info (date,time,temp,pressure,ldr) into a string of characters, called DaT; ; It is my recommendation that the addToBuffer function be changed from float to char, as the only thing that needs to go into the buffer is DaT.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
osmith2 6:c2299e3de428 1 #include "mbed.h"
osmith2 6:c2299e3de428 2 #include <string>
osmith2 6:c2299e3de428 3
osmith2 6:c2299e3de428 4 class NewLCD : public Stream {
osmith2 6:c2299e3de428 5
osmith2 6:c2299e3de428 6 public:
osmith2 6:c2299e3de428 7
osmith2 6:c2299e3de428 8 /* Create a new LCD interface
osmith2 6:c2299e3de428 9
osmith2 6:c2299e3de428 10 RS : Intruction/data register control pin. 0 = Instruction register. 1 = Data register.
osmith2 6:c2299e3de428 11 E : Start data read/write.
osmith2 6:c2299e3de428 12 D0-3 : Data lines.
osmith2 6:c2299e3de428 13
osmith2 6:c2299e3de428 14 */
osmith2 6:c2299e3de428 15 NewLCD(PinName RS, PinName E, PinName D0, PinName D1, PinName D2, PinName D3);
osmith2 6:c2299e3de428 16
osmith2 6:c2299e3de428 17 /* Write a character to the display
osmith2 6:c2299e3de428 18
osmith2 6:c2299e3de428 19 c : The character to display
osmith2 6:c2299e3de428 20
osmith2 6:c2299e3de428 21 */
osmith2 6:c2299e3de428 22 //int putc(int txt);
osmith2 6:c2299e3de428 23
osmith2 6:c2299e3de428 24 /* Write a string to the display
osmith2 6:c2299e3de428 25
osmith2 6:c2299e3de428 26 stringToDisplay : A string to display on the LCD, followed by potential variables that are
osmith2 6:c2299e3de428 27 used in the string.
osmith2 6:c2299e3de428 28
osmith2 6:c2299e3de428 29 */
osmith2 6:c2299e3de428 30 //int printf(const char* stringToDisplay, ...);
osmith2 6:c2299e3de428 31
osmith2 6:c2299e3de428 32 /* Move starting point of where the display will start printing
osmith2 6:c2299e3de428 33
osmith2 6:c2299e3de428 34 column : The horizontal position from the left, starting at 0
osmith2 6:c2299e3de428 35 row : The row selection from the top, starting at 0
osmith2 6:c2299e3de428 36
osmith2 6:c2299e3de428 37 */
osmith2 6:c2299e3de428 38 void cursorLocation(int column, int row);
osmith2 6:c2299e3de428 39
osmith2 6:c2299e3de428 40 /* Clear the screen */
osmith2 6:c2299e3de428 41 void clearScreen();
osmith2 6:c2299e3de428 42
osmith2 6:c2299e3de428 43 /* Function to shift the cursor left or right. 0 for left, 1 for right */
osmith2 6:c2299e3de428 44 void shiftCursor(string direction);
osmith2 6:c2299e3de428 45
osmith2 6:c2299e3de428 46 /* Variables used to set the time and date */
osmith2 6:c2299e3de428 47 char hours;
osmith2 6:c2299e3de428 48 char minutes;
osmith2 6:c2299e3de428 49 char day;
osmith2 6:c2299e3de428 50 char month;
osmith2 6:c2299e3de428 51 int year;
osmith2 6:c2299e3de428 52
osmith2 6:c2299e3de428 53 /* Function to set the time and date using the switches */
osmith2 6:c2299e3de428 54 void setDateAndTime(int sw1s, int sw2s);
osmith2 6:c2299e3de428 55 void updateClock();
osmith2 6:c2299e3de428 56 void startClock();
osmith2 6:c2299e3de428 57
osmith2 6:c2299e3de428 58 protected:
osmith2 6:c2299e3de428 59
osmith2 6:c2299e3de428 60 //Function to print characters. This gets called from printf.
osmith2 6:c2299e3de428 61 virtual int _putc(int txt);
osmith2 6:c2299e3de428 62 virtual int _getc();
osmith2 6:c2299e3de428 63 virtual int _repc(int txt);
osmith2 6:c2299e3de428 64
osmith2 6:c2299e3de428 65 //Sets DDRAM Address (this corresponds to the cursor location)
osmith2 6:c2299e3de428 66 int DDRAMAddress(int column, int row);
osmith2 6:c2299e3de428 67
osmith2 6:c2299e3de428 68 //Function to write a single character to the display in a given location
osmith2 6:c2299e3de428 69 void charDisp(int column, int row, char c);
osmith2 6:c2299e3de428 70
osmith2 6:c2299e3de428 71 //Function to send information down the data lines to instruction/data register
osmith2 6:c2299e3de428 72 void writeByte(char byteToSend);
osmith2 6:c2299e3de428 73
osmith2 6:c2299e3de428 74 //Function to set RS pin low and call writeByte to send command
osmith2 6:c2299e3de428 75 void writeCommand(char commandToSend);
osmith2 6:c2299e3de428 76
osmith2 6:c2299e3de428 77 //Function to set RS pin high and call writeByte to send data
osmith2 6:c2299e3de428 78 void writeData(char dataToSend);
osmith2 6:c2299e3de428 79
osmith2 6:c2299e3de428 80
osmith2 6:c2299e3de428 81 DigitalOut _RS, _E;
osmith2 6:c2299e3de428 82 BusOut _D;
osmith2 6:c2299e3de428 83
osmith2 6:c2299e3de428 84 int _column;
osmith2 6:c2299e3de428 85 int _row;
osmith2 6:c2299e3de428 86
osmith2 6:c2299e3de428 87 bool firstSet;
osmith2 6:c2299e3de428 88
osmith2 6:c2299e3de428 89 };
osmith2 6:c2299e3de428 90
osmith2 6:c2299e3de428 91