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.
Dependencies: mbed DMX TextLCD mbed-rtos
Revision 19:e8b826ab28a8, committed 2016-03-09
- Comitter:
- Ayrton_L
- Date:
- Wed Mar 09 01:24:39 2016 +0000
- Parent:
- 18:8deebaf09ba3
- Child:
- 20:bcaba3ecc235
- Commit message:
- Optimized Screen.h (OOP Class)
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Screen.h Wed Mar 09 01:24:39 2016 +0000
@@ -0,0 +1,124 @@
+#include "string.h"
+#include "stdint.h"
+#include "TextLCD.h"
+
+TextLCD lcd(p10, p12, p15, p16, p29, p30); // rs, e, d4-d7
+class Screen
+{
+ public:
+ Screen();
+ ~Screen();
+
+ void V_Printit() const;
+
+ void V_SetRij(uint32_t I32_Rij);
+ void V_SetKolom(uint32_t I32_Kolom);
+ void V_SetTekst(char * C_Tekst);
+
+ private:
+ uint32_t I32_m_Rij;
+ uint32_t I32_m_Kolom;
+ char *C_m_Tekst[];
+
+};
+
+Screen::Screen()
+{
+ this->I32_m_Rij = 0;
+ this->I32_m_Kolom = 0;
+ *this->C_m_Tekst = "";
+ return;
+}
+
+Screen::~Screen()
+{
+ delete &I32_m_Rij;
+ delete &I32_m_Kolom;
+ delete C_m_Tekst;
+ return;
+}
+
+void Screen::V_SetRij(uint32_t I32_Rij)
+{
+ I32_m_Rij = (I32_Rij % 4) -1;
+}
+
+void Screen::V_SetKolom(uint32_t I32_Kolom)
+{
+ I32_m_Kolom = (I32_Kolom % 20) -1;
+}
+
+void Screen::V_SetTekst(char C_Tekst[])
+{
+ *C_m_Tekst = C_Tekst;
+}
+
+void Screen::V_Printit() const
+{
+ lcd.locate(I32_m_Kolom, I32_m_Rij);
+ lcd.printf(*C_m_Tekst);
+}
+
+/*
+void V_PutPointer()
+{
+ lcd.locate(0,0);
+ lcd.printf("%d", &I8_ScreenPointer[1]);
+ lcd.locate(1,0);
+ lcd.printf("%d", &I8_ScreenPointer[2]);
+ lcd.locate(2,0);
+ lcd.printf("%d", &I8_ScreenPointer[3]);
+ lcd.locate(3,0);
+ lcd.printf("%d", &I8_ScreenPointer[4]);
+}
+
+void V_Up()
+{
+ uint8_t help;
+ help = I8_ScreenPointer[0];
+ I8_ScreenPointer[0] = I8_ScreenPointer[1];
+ I8_ScreenPointer[1] = I8_ScreenPointer[2];
+ I8_ScreenPointer[2] = I8_ScreenPointer[3];
+ I8_ScreenPointer[3] = help;
+ V_PutPointer();
+}
+
+void V_Down()
+{
+ uint8_t help;
+ help = I8_ScreenPointer[3];
+ I8_ScreenPointer[3] = I8_ScreenPointer[2];
+ I8_ScreenPointer[2] = I8_ScreenPointer[1];
+ I8_ScreenPointer[1] = I8_ScreenPointer[0];
+ I8_ScreenPointer[0] = help;
+ V_PutPointer();
+}
+
+void V_Powerup()
+{
+ lcd.locate(3, 1);
+ lcd.printf("Art-Net to DMX/n");
+ lcd.locate(6, 3);
+ lcd.printf("B-00-01");
+ wait(1);
+ lcd.cls();
+}
+
+void V_ShowSTDMenuScreen()
+{
+ lcd.cls();
+
+ lcd.locate(19,1);
+ lcd.printf("^");
+ lcd.locate(19,3);
+ lcd.printf("v");
+
+ lcd.locate(1,1);
+ lcd.printf("Contrast");
+ lcd.locate(2,1);
+ lcd.printf("Netwerk");
+ lcd.locate(3,1);
+ lcd.printf("ArtNet");
+ lcd.locate(4,1);
+ lcd.printf("Info");
+}*/
\ No newline at end of file
--- a/main.cpp Tue Mar 08 23:51:11 2016 +0000
+++ b/main.cpp Wed Mar 09 01:24:39 2016 +0000
@@ -1,81 +1,13 @@
#include "main.h"
-InterruptIn Up(p5);
-InterruptIn Down(p5);
-InterruptIn Push(p5);
-void V_Up();
-void V_Down();
-void V_PutPointer();
-volatile uint8_t I8_ScreenPointer[4];
int main()
{
DMX_TIMING.attach_us(&V_DMX, 4);
- V_Powerup();
- Up.rise(&V_Up);
- Down.rise(&V_Down);
-}
-
-void V_PutPointer()
-{
- lcd.locate(0,0);
- lcd.printf("%d", &I8_ScreenPointer[1]);
- lcd.locate(1,0);
- lcd.printf("%d", &I8_ScreenPointer[2]);
- lcd.locate(2,0);
- lcd.printf("%d", &I8_ScreenPointer[3]);
- lcd.locate(3,0);
- lcd.printf("%d", &I8_ScreenPointer[4]);
-}
-
-void V_Up()
-{
- uint8_t help;
- help = I8_ScreenPointer[0];
- I8_ScreenPointer[0] = I8_ScreenPointer[1];
- I8_ScreenPointer[1] = I8_ScreenPointer[2];
- I8_ScreenPointer[2] = I8_ScreenPointer[3];
- I8_ScreenPointer[3] = help;
- V_PutPointer();
+ Screen *LCD;
+ LCD = new Screen;
+ //.....
+
}
-void V_Down()
-{
- uint8_t help;
- help = I8_ScreenPointer[3];
- I8_ScreenPointer[3] = I8_ScreenPointer[2];
- I8_ScreenPointer[2] = I8_ScreenPointer[1];
- I8_ScreenPointer[1] = I8_ScreenPointer[0];
- I8_ScreenPointer[0] = help;
- V_PutPointer();
-}
-
-void V_Powerup()
-{
- lcd.locate(3, 1);
- lcd.printf("Art-Net to DMX/n");
- lcd.locate(6, 3);
- lcd.printf("B-00-01");
- wait(1);
- lcd.cls();
-}
-
-void V_ShowSTDMenuScreen()
-{
- lcd.cls();
-
- lcd.locate(19,1);
- lcd.printf("^");
- lcd.locate(19,3);
- lcd.printf("v");
-
- lcd.locate(1,1);
- lcd.printf("Contrast");
- lcd.locate(2,1);
- lcd.printf("Netwerk");
- lcd.locate(3,1);
- lcd.printf("ArtNet");
- lcd.locate(4,1);
- lcd.printf("Info");
-}
\ No newline at end of file
--- a/main.h Tue Mar 08 23:51:11 2016 +0000 +++ b/main.h Wed Mar 09 01:24:39 2016 +0000 @@ -5,21 +5,21 @@ #include "mbed.h" #include "stdint.h" -#include "TextLCD.h" #define DMX_CHANNELS 512 uint8_t I8_Data1[DMX_CHANNELS]; uint8_t I8_Data2[DMX_CHANNELS]; uint8_t I8_Data3[DMX_CHANNELS]; -TextLCD lcd(p10, p12, p15, p16, p29, p30); // rs, e, d4-d7 + #include "DMX.h" #include "ArtNet.h" +#include "Screen.h" -void V_Powerup(); -void V_ShowSTDMenuScreen(); +/*void V_Powerup(); +void V_ShowSTDMenuScreen();*/ #endif