Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 17:b7cd66c5f845, committed 2018-11-09
- Comitter:
- BenRJG
- Date:
- Fri Nov 09 14:24:39 2018 +0000
- Parent:
- 16:df78620cb307
- Commit message:
- export to keil
Changed in this revision
--- a/Display.cpp Thu Nov 08 23:22:05 2018 +0000
+++ b/Display.cpp Fri Nov 09 14:24:39 2018 +0000
@@ -2,18 +2,17 @@
void Display::INIT()
{
- _lcd.INIT();
setTemperature(0);
setLightLevel(0);
setPressure(0);
+ _lcd.INIT();
- pageOne();
}
void Display::pageOne()
{
_lcd.clear();
- _lcd.disableCursor();
+ // _lcd.disableCursor();
//Temperature Display
_lcd.display("T: ",LINE1);
@@ -35,7 +34,7 @@
void Display::pageTwo()
{
_lcd.clear();
- _lcd.enableCursor();
+ // _lcd.enableCursor();
_lcd.display("01/01/2018 00:00",LINE1);
_lcd.display("dd/mm/yyyy hh:mm",LINE2);
@@ -43,7 +42,7 @@
_lcd.pos(LINE1);
}
-void Display::day10()
+/*void Display::day10()
{
}
@@ -101,7 +100,7 @@
void Display::minute1()
{
-}
+}*/
void Display::setTemperature(S_BYTE temp)
--- a/displayThread.cpp Thu Nov 08 23:22:05 2018 +0000
+++ b/displayThread.cpp Fri Nov 09 14:24:39 2018 +0000
@@ -1,6 +1,6 @@
#include "displayThread.h"
-InterruptIn button1(b1);
+/*InterruptIn button1(b1);
InterruptIn button2(b2);
U_BYTE buttonPressed;
@@ -12,14 +12,22 @@
button2.rise(&buttonTrigger2);
Display display(RS,E,d4,d5,d6,d7); //rs,e,d4,d5,d6,d7
display.INIT();
+ wait_us(4000);
+ display.pageOne();
while(1)
{
if((buttonPressed & 1) == 1)
{
display.pageTwo();
buttonPressed &= 2; //clear bit 1
- }
- }
+ }
+
+ if((buttonPressed & 2) == 2)
+ {
+ display.pageOne();
+ buttonPressed &= 1;
+ }
+ } //while(1);
}
void buttonTrigger1()
@@ -30,4 +38,4 @@
void buttonTrigger2()
{
buttonPressed |= 2; //set second bit
-}
\ No newline at end of file
+}*/
\ No newline at end of file
--- a/main.cpp Thu Nov 08 23:22:05 2018 +0000
+++ b/main.cpp Fri Nov 09 14:24:39 2018 +0000
@@ -4,9 +4,9 @@
#include "Terminal.hpp"
#include "displayThread.h"
-Thread tDisplay;
+//Thread tDisplay;
-int main(void) {
+/*int main(void) {
tDisplay.start(displayFunction);
Terminal PC(SERIAL_TX, SERIAL_RX);
@@ -20,4 +20,63 @@
//wait(0.5);
Thread::wait(osWaitForever);
}
+}*/
+InterruptIn button1(b1);
+InterruptIn button2(b2);
+
+volatile U_BYTE buttonPressed;
+
+ #define b1 PE_12
+ #define b2 PE_14
+
+ #define RS PD_15 //D9
+ #define E PF_12 //D8
+ #define d4 PF_13 //D7
+ #define d5 PE_9 //D6
+ #define d6 PF_14 //D4
+ #define d7 PF_15 //D2
+
+ void buttonTrigger1();
+ void buttonTrigger2();
+
+DigitalOut green(PB_11);
+
+Display display(RS,E,d4,d5,d6,d7); //rs,e,d4,d5,d6,d7
+
+int main(void)
+{
+ buttonPressed = 0;
+ button1.rise(&buttonTrigger1);
+ button2.rise(&buttonTrigger2);
+ wait_us(4000);
+ display.INIT();
+ wait_us(4000);
+ display.pageOne();
+ green = 0;
+ while(1)
+ {
+ if(buttonPressed == 1)
+ {
+ display.pageTwo();
+ buttonPressed &= 2; //clear bit 1
+ }else if(buttonPressed == 2)
+ {
+ display.pageOne();
+ buttonPressed &= 1;
+ }/*else if(buttonPressed == 3)
+ {
+ green = !green;
+ buttonPressed = 0;
+ }*/
+ } //while(1);
}
+
+void buttonTrigger1()
+{
+ buttonPressed |= 1; //set first bit
+}
+
+void buttonTrigger2()
+{
+ buttonPressed |= 2; //set second bit
+}
\ No newline at end of file