C12832 by dreschpe modified to work with the DOGL128-6 LCD Display (ST7565R based)
Fork of C12832_lcd by
Diff: DOGL128.h
- Revision:
- 15:2e1423772e77
- Parent:
- 14:a68c1c6d125a
- Child:
- 16:3b6865c11663
--- a/DOGL128.h Sat Jul 16 19:06:00 2016 +0000 +++ b/DOGL128.h Sat Jul 16 20:43:50 2016 +0000 @@ -1,14 +1,8 @@ -/* mbed library for the mbed Lab Board 128*64 pixel LCD - * Copyright (c) 2012 Peter Drescher - DC2PD - * Released under the MIT License: http://mbed.org/license/mit - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. +/* mbed library DOGL128-6 128*64 pixel LCD + * Copyright (c) 2012 Peter Drescher - DC2PD, + * Copyright (c) 2016 Łukasz Godziejewski + * + * MIT License */ #ifndef DOGL128_H @@ -22,17 +16,6 @@ * #define debug_lcd 1 enable infos to PC_USB */ -// some defines for the DMA use -#define DMA_CHANNEL_ENABLE 1 -#define DMA_TRANSFER_TYPE_M2P (1UL << 11) -#define DMA_CHANNEL_TCIE (1UL << 31) -#define DMA_CHANNEL_SRC_INC (1UL << 26) -#define DMA_MASK_IE (1UL << 14) -#define DMA_MASK_ITC (1UL << 15) -#define DMA_SSP1_TX (1UL << 2) -#define DMA_SSP0_TX (0) -#define DMA_DEST_SSP1_TX (2UL << 6) -#define DMA_DEST_SSP0_TX (0UL << 6) /** Draw mode * NORMAl @@ -131,7 +114,6 @@ /** copy display buffer to lcd * */ - void copy_to_lcd(void); /** set the orienation of the screen @@ -144,7 +126,6 @@ * * @param o contrast 0-63 */ - void set_contrast(unsigned int o); /** read the contrast level @@ -169,7 +150,6 @@ * * @param mode NORMAl or XOR */ - void setmode(int mode); virtual int columns(void); @@ -275,6 +255,11 @@ */ void vline(int y0, int y1, int x, int colour); + /** Configure LCD registers. + + */ + void configure(); + /** Init the DOGL128 LCD controller * */ @@ -295,6 +280,12 @@ void wr_cmd(unsigned char value); void wr_cnt(unsigned char cmd); + + /** Write buffer content to provided page. + + @param page_number Page to write to. + */ + void write_to_page(uint8_t page_number); unsigned int orientation; unsigned int char_x; @@ -302,10 +293,41 @@ unsigned char buffer[1024]; unsigned int contrast; unsigned int auto_up; - + + static const uint8_t kPageCount = 8; + + // commands values + enum Display { + kDisplayOn = 0xAF, + kDisplayOff = 0xAE + }; + enum ADCMode { + kADCModeNormal = 0xA0, + kADCModeReverse = 0xA1 + }; + enum DisplayMode { + kDisplayModeNormal = 0xA6, + kDisplayModeReverse = 0xA7 + }; + enum DisplayAllPoints { + kDisplayAllPointsOff = 0xA4, + kDisplayAllPointsOn = 0xA5 + }; + enum LCDBias { + kLCDBiasOneNinth = 0xA2, + kLCDBiasOneSeventh = 0xA3 + }; + enum CommonOutputMode { + kCommonOutputModeNormal = 0xC0, + kCommonOutputModeReverse = 0xC8 + }; + enum StaticIndicator { + kStaticIndicatorOff = 0xAC, + kStaticIndicatorOn = 0xAD + }; + + static const uint8_t kReset = 0xE2; + static const uint8_t kSetContrast = 0x81; }; - - - -#endif +#endif /* DOGL128_H */