Library for Sure Electronics HT1632 based LED matrix displays. Supports multiple displays connected together.

Dependents:   HT1632MsgScroller SMS_LEDMatrixPrinter

Files at this revision

API Documentation at this revision

Comitter:
SomeRandomBloke
Date:
Fri Nov 09 08:48:49 2012 +0000
Parent:
0:b3e0f5bb3b87
Child:
2:3e477c909f7a
Commit message:
Updates to set unused CS lines to high

Changed in this revision

HT1632_LedMatrix.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/HT1632_LedMatrix.cpp	Thu Nov 08 21:41:33 2012 +0000
+++ b/HT1632_LedMatrix.cpp	Fri Nov 09 08:48:49 2012 +0000
@@ -116,6 +116,9 @@
   yMax = 8 * numYDevices-1;
 
   numDevices = numXDevices * numYDevices;
+  // Disable all display CS lines by taking high
+  for( uint8_t i = 0; i < 4; i++ )
+    ht1632_cs[i] = HIGH;
 
 //  HT1632_WRCLK_DDR |= _BV( HT1632_WRCLK );      // set pins to output
 //  HT1632_DATA_DDR |= _BV( HT1632_DATA );
@@ -145,25 +148,12 @@
  ***********************************************************************/
 void HT1632_LedMatrix::chipselect(uint8_t chipno)
 {
-#ifdef DIRECTIO
-//  output_low(*ht1632_cs_Port[chipno], ht1632_cs[chipno]);
-#else
-//  digitalWrite( ht1632_cs[chipno], LOW );
-  
-#endif
-//ht1632_cs4 = LOW;
     ht1632_cs[chipno] = LOW;
 }
 
 void HT1632_LedMatrix::chipfree(uint8_t chipno)
 {
-#ifdef DIRECTIO
-//  output_high(*ht1632_cs_Port[chipno], ht1632_cs[chipno]);
-#else
-//  digitalWrite( ht1632_cs[chipno], HIGH );
-#endif
     ht1632_cs[chipno] = HIGH;
-//ht1632_cs4 = HIGH;
 }
 
 /*
@@ -176,32 +166,12 @@
 void HT1632_LedMatrix::writebits (uint8_t bits, uint8_t firstbit)
 {
   while (firstbit) {
-#ifdef DIRECTIO
-//    output_low(HT1632_WRCLK_PORT, HT1632_WRCLK);
-#else
-//    digitalWrite( HT1632_WRCLK, LOW );
-#endif
     ht1632_wrclk = LOW;
     if (bits & firstbit) {
-#ifdef DIRECTIO
-//      output_high(HT1632_DATA_PORT,HT1632_DATA);
-#else
-//    digitalWrite( HT1632_DATA, HIGH);
-#endif
         ht1632_data = HIGH;
     } else {
-#ifdef DIRECTIO
-//      output_low(HT1632_DATA_PORT, HT1632_DATA);
-#else
-//    digitalWrite( HT1632_DATA, LOW);
-#endif
         ht1632_data = LOW;
     }
-#ifdef DIRECTIO
-//    output_high(HT1632_WRCLK_PORT, HT1632_WRCLK);
-#else
-//    digitalWrite( HT1632_WRCLK, HIGH);
-#endif
     ht1632_wrclk = HIGH;
     firstbit >>= 1;
   }
@@ -216,16 +186,12 @@
 void HT1632_LedMatrix::writedatabits (uint8_t bits, uint8_t count)
 {
   while (count) {
-//    output_low(HT1632_WRCLK_PORT, HT1632_WRCLK);
     ht1632_wrclk = LOW;
     if (bits & 1) {
-//      output_high(HT1632_DATA_PORT,HT1632_DATA);
         ht1632_data = HIGH;
     } else {
-//      output_low(HT1632_DATA_PORT, HT1632_DATA);
         ht1632_data = LOW;
     }
-//    output_high(HT1632_WRCLK_PORT, HT1632_WRCLK);
     ht1632_wrclk = HIGH;
     count--;
     bits >>= 1;