Modified version of the DmTftLibrary, optimized for the LPC4088 Experiment Base Board

Dependents:   lpc4088_ebb_dm_calc lpc4088_ebb_dm_bubbles

Fork of DmTftLibrary by Display Module

Revision:
3:02c19cbc707c
Parent:
2:59be7fca4581
Child:
4:92d019216e28
--- a/dm_platform.h	Tue May 20 12:21:43 2014 +0200
+++ b/dm_platform.h	Wed May 21 14:43:08 2014 +0000
@@ -60,11 +60,27 @@
   // Clear bit, Set bit, High pulse, Low pulse, Boundary limits and Delay macros
   #define sbi(reg, _bitmask) (*(reg) = 1)
   #define cbi(reg, _bitmask) (*(reg) = 0)
-  #define pulse_high(reg, _bitmask) do { *(reg) = 1; *(reg) = 0; } while(0)
-  #define pulse_low(reg, _bitmask) do { *(reg) = 0; *(reg) = 1; } while(0)
   #define constrain(amt,low,high) ((amt)<=(low)?(low):((amt)>(high)?(high):(amt)))
   #define delay(ms) wait_ms(ms)
 
+  // On Arduino no extra delay is needed, but on faster platforms the simulated
+  // SPI bus may get a too high frequency so a delay here will lower it. This
+  // delay should ideally be configurable per platform but for now it will have
+  // to be ok to lower the frequency to 500KHz  
+  #define pulse_delay()  wait_us(1)
+  #define pulse_high(reg, _bitmask) do {\
+       *(reg) = 1;    \
+       pulse_delay(); \
+       *(reg) = 0;    \
+       pulse_delay(); \
+    } while(0)
+  #define pulse_low(reg, _bitmask) do {\
+       *(reg) = 0;    \
+       pulse_delay(); \
+       *(reg) = 1;    \
+       pulse_delay(); \
+    } while(0)
+
   // Map of mandatory pin names, from Arduino names to D* and A*
   #if defined(__LPC407x_8x_177x_8x_H__)
     #define D0   p10