From 49c14ececbf03a67b8ff1fa76c55489a7ad10371 Mon Sep 17 00:00:00 2001 From: Jon Langseth Date: Thu, 8 Sep 2011 00:47:45 +0200 Subject: [PATCH] Moved code to using the PCD8544 Arduino library from http://code.google.com/p/pcd8544/ Download the latest and greatest version of the library, dump the PCD8544 directory to your Arduino libraries folder, restart the Arduino IDE. The display needs to be connected as follows: SCLK 8, SDIN 9, D/C 10, RST 11, SCE 12. --- source/RCTXDuino/RCTXDuino.pde | 90 ++++++++++++++++++++++++---------- 1 file changed, 63 insertions(+), 27 deletions(-) diff --git a/source/RCTXDuino/RCTXDuino.pde b/source/RCTXDuino/RCTXDuino.pde index 0c63499..f4661da 100644 --- a/source/RCTXDuino/RCTXDuino.pde +++ b/source/RCTXDuino/RCTXDuino.pde @@ -1,4 +1,8 @@ -#include +// No longer using HD44780-comaptible display, +// Moving to a brand new world of dot-matrix display tech! +// Using LCD library from http://code.google.com/p/pcd8544/ +#include + #include #include @@ -71,8 +75,8 @@ volatile model_t model; unsigned char current_model; // Using uchar to spend a single byte of mem.. // ----------------- Display related stuffs -------------------- -LiquidCrystal lcd( 12, 11, 10, 6, 7, 8, 9); -// Parameters are: rs, rw, enable, d4, d5, d6, d7 pin numbers. +PCD8544 lcd( 8, 9, 10, 11, 12); +// Param: sclk, sdin, dc, reset, sce // ----------------- PPM related stuffs ------------------------ // The PPM generation is handled by Timer0 interrupts, and needs @@ -176,11 +180,14 @@ void setup(){ pinMode(4, OUTPUT); // s2 pinMode(5, OUTPUT); // e - lcd.begin(16,2); + lcd.begin(84, 48); lcd.print("Starting...."); +#ifdef DEBUG Serial.begin(9600); Serial.println("Starting...."); +#endif + delay(500); model_defaults(); @@ -212,6 +219,8 @@ void setup(){ set_timer( seplength ); Timer1.initialize(framelength); Timer1.attachInterrupt(ISR_timer); + + lcd.clear(); } @@ -735,7 +744,10 @@ void dr_inputselect( int no, int in ) lcd.setCursor(0 , 0); lcd.print("D/R switch "); lcd.print( no + 1 ); - lcd.print(" "); + //lcd.print(" "); + + lcd.setCursor(0 , 1); + lcd.print(" "); lcd.setCursor(0 , 1); lcd.print("Input "); lcd.print(in+1); @@ -771,7 +783,10 @@ void dr_value() lcd.setCursor(0 , 0); lcd.print("D/R switch "); lcd.print( menu_substate - 3 ); - lcd.print(" "); + + + lcd.setCursor(0 , 1); + lcd.print(" "); lcd.setCursor(0 , 1); lcd.print( state ? "HI" : "LO" ); lcd.print(" Value :"); @@ -795,6 +810,9 @@ void ui_handler() int col; scan_keys(); + if ( check_key( KEY_UP) || check_key(KEY_DOWN)) + lcd.clear(); + if ( displaystate != MENU ) { menu_substate = 0; @@ -820,45 +838,46 @@ void ui_handler() return; } } - + digitalWrite(13, digitalRead(13) ^ 1 ); switch ( displaystate ) { case VALUES: int current_input; + row = 1; + col = 0; + for (current_input=0; current_input