X-Git-Url: https://git.defcon.no/?a=blobdiff_plain;f=source%2FRCTXDuino%2FRCTXDuino.pde;h=f4661da586946b160b07bce027fcb1ee5c7e145f;hb=49c14ececbf03a67b8ff1fa76c55489a7ad10371;hp=ebe62ad503afde00aea28315d61861a35b48b52e;hpb=9553d62397f79611e4d4f96cf9f224e4193038e3;p=rctxduino diff --git a/source/RCTXDuino/RCTXDuino.pde b/source/RCTXDuino/RCTXDuino.pde index ebe62ad..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(); } @@ -696,6 +705,7 @@ void ISR_timer(void) } } + #ifdef DEBUG void serial_debug() { @@ -720,6 +730,8 @@ void serial_debug() Serial.print("Average loop time:"); Serial.println(avg_loop_time); + Serial.print("Free RAM:"); + Serial.print( FreeRam() ); Serial.println(); } #endif @@ -732,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); @@ -768,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 :"); @@ -792,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; @@ -817,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(__brkval) == 0) { + // if no heap use from end of bss section + free_memory = reinterpret_cast(&free_memory) + - reinterpret_cast(&__bss_end); + } else { + // use from top of stack to heap + free_memory = reinterpret_cast(&free_memory) + - reinterpret_cast(__brkval); + } + return free_memory; +} +#endif