Heroic Robotics / SD600A

Fork of SD600A by Heroic Robotics

Revision:
18:a61600110235
Parent:
17:a625ffe26993
Child:
20:843cfd0d6adb
--- a/SD600A.cpp	Thu Oct 11 04:30:47 2012 +0000
+++ b/SD600A.cpp	Thu Oct 11 04:40:47 2012 +0000
@@ -16,7 +16,17 @@
  * there is no need to lock the buffer.
  */
 
-void SD600A::idle_function(void) {
+void SD600A::spi_isr(void) {
+    clk = 1;
+    dat = pixels[byte_index] & (0x80 >> bit_index);
+    clk = 0;
+    bit_index++;
+    if (bit_index == 8) {
+        byte_index++;
+        bit_index = 0;
+    }
+    if (byte_index == data_length)
+        byte_index = 0;
     clk = 1;
     dat = pixels[byte_index] & (0x80 >> bit_index);
     clk = 0;
@@ -45,7 +55,7 @@
         bit_index = 0;
     } else error("SD600A could not allocate memory!\r\n");
     NVIC_SetPriority(TIMER3_IRQn, 0);
-    idletoggle.attach_us(this, &SD600A::idle_function, IDLE_INTERVAL);
+    idletoggle.attach_us(this, &SD600A::spi_isr, INTERRUPT_INTERVAL);
 }
 
 void SD600A::begin(void) {