Fork of Silabs MemoryLCD library
Dependents: demoUI whrmDemoUI Host_Software_MAX32664GWEB_HR_EXTENDED Host_Software_MAX32664GWEC_SpO2_HR-_EXTE ... more
C++ library for Sharp Microelectronics 1.28 inch LCD TFT, LS013B7DH03, SPI bus. Forked from Silicon Labs MemoryLCD display driver.
Diff: LS013B7DH03.h
- Revision:
- 2:2f10f00fe56c
- Parent:
- 1:6332f3383fb6
- Child:
- 3:c34c3e4e33fc
--- a/LS013B7DH03.h Wed Mar 18 10:58:34 2015 -0500 +++ b/LS013B7DH03.h Tue Apr 14 15:25:58 2015 -0400 @@ -57,91 +57,29 @@ } LS013B7DH03_state_t; namespace silabs { -/** A driver for the Sharp LS013B7DH03 Memory LCD, present on some EFM32 Starter Kits. - * - * Currently supports LS013B7DH03 only, but should be easily modifiable. - * - * @code - * #include "mbed.h" - * #include "LS013B7DH03.h" - * #include "mbed_logo.h" - * - * #define SCK PE12 - * #define MOSI PE10 - * - * DigitalOut CS(PA10); - * DigitalOut EXTCOM(PF3); - * DigitalOut DISP(PA8); - * - * SPI displaySPI(MOSI, NC, SCK); - * silabs::LS013B7DH03 display(&displaySPI, &CS, &EXTCOM); - * - * volatile bool completed = false; - * - * void completionCallback( void ) { - * completed = true; - * } - * - * int main() { - * //Enable the LCD - * DISP = 1; - * - * // Reset the LCD to a blank state. (All white) - * completed = false; - * display.clearImmediate(completionCallback); - * while(completed == false) sleep(); - * - * printf("Initialization done! \n"); - * - * // Push update to the display - * uint32_t refreshCount = display.getRefreshTicks(); - * completed = false; - * display.update(completionCallback); - * - * // Sleep while doing the transmit - * while(refreshed == false) sleep(); - * - * // Calculate and print refresh duration - * refreshCount = display.getRefreshTicks() - refreshCount; - * printf("Refresh duration: %d cycles @ 125Hz \n", (int)refreshCount); - * - * // Sleep forever. - * while(1) sleep(); - * } - * @endcode - */ class LS013B7DH03 : public BufferedDisplay { + public: LS013B7DH03(SPI * spi, DigitalOut * CS, DigitalOut * ExtCom, const char *name=NULL); /** * Call this function to push all changes to the display - * - * @param callback void (void) type callback pointer to call on display update completion. - * @return Status code */ int update( cbptr_t callback = NULL ); /** * Immediately clear the display: set pixel buffer to zero and clear out the display. - * - * @param callback void (void) type callback pointer to call on display clear completion. - * @return Status code */ int clearImmediate( cbptr_t callback = NULL ); /** * Function to test display buffer - * - * @return Status code */ int showDemo(); /** - * Function to get internal 128Hz refresh counter. Can be useful for performance measurement. - * - * @return Number of display toggle ticks since init + * Function to get internal refresh counter */ uint32_t getRefreshTicks(); @@ -153,7 +91,7 @@ mbed::LowPowerTicker _displayToggler; mbed::LowPowerTimeout _csTimeout; - mbed::CallbackPointer _internalCallback; + event_callback_t _internalEventCallback; volatile uint32_t _refreshCount; uint8_t _lcdPolarity; LS013B7DH03_state_t _state; @@ -172,7 +110,7 @@ void _cbHandlerTimeout( void ); /** - * Call this function at 128 Hz to keep the display from losing contrast. + * Call this function at 55 ~ 65 Hz to keep the display from losing contrast. */ void toggle(); };