Caiou
Dependents: LCD_Proj LCD_imagetest LCD_Proj_rtc
Fork of DmTftLibrary by
Diff: dm_platform.h
- Revision:
- 4:92d019216e28
- Parent:
- 3:02c19cbc707c
- Child:
- 6:fde03297017b
--- a/dm_platform.h Wed May 21 14:43:08 2014 +0000 +++ b/dm_platform.h Thu May 22 09:14:49 2014 +0000 @@ -60,6 +60,8 @@ // 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) @@ -67,44 +69,23 @@ // 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 {\ + #if defined(__LPC407x_8x_177x_8x_H__) + #define slow_pulse_delay() wait_us(1) + #else + #define slow_pulse_delay() + #endif + #define slow_pulse_high(reg, _bitmask) do {\ *(reg) = 1; \ - pulse_delay(); \ + slow_pulse_delay(); \ *(reg) = 0; \ - pulse_delay(); \ - } while(0) - #define pulse_low(reg, _bitmask) do {\ - *(reg) = 0; \ - pulse_delay(); \ - *(reg) = 1; \ - pulse_delay(); \ + slow_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 - #define D1 p9 - #define D2 p31 - #define D3 p32 - #define D4 p33 - #define D5 p37 - #define D6 p38 - #define D7 p34 - #define D8 p8 - #define D9 p39 - #define D10 p14 - #define D11 p11 - #define D12 p12 - #define D13 p13 - - #define A0 p15 - #define A1 p16 - #define A2 p17 - #define A3 p18 - #define A4 p19 - #define A5 p20 - #endif + #define slow_pulse_low(reg, _bitmask) do {\ + *(reg) = 0; \ + slow_pulse_delay(); \ + *(reg) = 1; \ + slow_pulse_delay(); \ + } while(0) // Special handling for the LPC1549 LPCXpresso board with solder bump #ifdef LPC15XX_H