This driver is meant for the monochrome LCD display (model no: LS013B4DN04) from Sharp; but it should be easily adaptable to other Sharp displays.
Diff: SharpLCD.hpp
- Revision:
- 1:ffc1d1d55581
- Parent:
- 0:62d7cfac67ca
- Child:
- 2:270ee57c0367
--- a/SharpLCD.hpp Wed Jul 23 10:40:35 2014 +0000 +++ b/SharpLCD.hpp Wed Jul 30 07:29:17 2014 +0000 @@ -15,6 +15,7 @@ */ #include "mbed.h" +#include "core_cmInstr.h" #include "font.h" #ifndef __SHARP_LCD_HPP__ @@ -240,8 +241,8 @@ }; public: - SharpLCD(PinName _displayEnablePin, PinName mosi, PinName miso_unused, PinName sclk, PinName _unused=NC) : - displayEnable(_displayEnablePin), chipSelect(p8), spi(mosi, miso_unused, sclk, _unused) { + SharpLCD(PinName enable, PinName cs, PinName mosi, PinName miso_unused, PinName sclk, PinName _unused = NC) : + displayEnable(enable), chipSelect(cs), spi(mosi, miso_unused, sclk, _unused) { displayEnable = 0; chipSelect = 0; spi.frequency(1000000); @@ -279,7 +280,19 @@ void clear(void); static uint8_t bitReverse8(uint8_t byte) { - return (uint8_t)(__RBIT(byte) >> 24); + #if (__CORTEX_M >= 0x03) + return (uint8_t)(__RBIT(byte) >> 24); + #else /* #if (__CORTEX_M < 0x03) */ + uint8_t rev8 = 0; + + for (unsigned i = 0; i < 8; i++) { + if (byte & (1 << i)) { + rev8 |= 1 << (7 - i); + } + } + + return rev8; + #endif /* #if (__CORTEX_M >= 0x03) */ } /**