| 1 | /***************************************************************************//** |
| 2 | * @file ST7565R.h |
| 3 | * @brief Header file of ST7565R Driver. |
| 4 | * @author DBogdan ([email protected]) |
| 5 | ******************************************************************************** |
| 6 | * Copyright 2013(c) Analog Devices, Inc. |
| 7 | * |
| 8 | * All rights reserved. |
| 9 | * |
| 10 | * Redistribution and use in source and binary forms, with or without |
| 11 | * modification, are permitted provided that the following conditions are met: |
| 12 | * - Redistributions of source code must retain the above copyright |
| 13 | * notice, this list of conditions and the following disclaimer. |
| 14 | * - Redistributions in binary form must reproduce the above copyright |
| 15 | * notice, this list of conditions and the following disclaimer in |
| 16 | * the documentation and/or other materials provided with the |
| 17 | * distribution. |
| 18 | * - Neither the name of Analog Devices, Inc. nor the names of its |
| 19 | * contributors may be used to endorse or promote products derived |
| 20 | * from this software without specific prior written permission. |
| 21 | * - The use of this software may or may not infringe the patent rights |
| 22 | * of one or more patent holders. This license does not release you |
| 23 | * from the requirement that you obtain separate licenses from these |
| 24 | * patent holders to use this software. |
| 25 | * - Use of the software either in source or binary form, must be run |
| 26 | * on or directly connected to an Analog Devices Inc. component. |
| 27 | * |
| 28 | * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR |
| 29 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, |
| 30 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| 31 | * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 32 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 33 | * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 34 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| 35 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 36 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 37 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 38 | *******************************************************************************/ |
| 39 | #ifndef __ST7565R_H__ |
| 40 | #define __ST7565R_H__ |
| 41 | |
| 42 | /******************************************************************************/ |
| 43 | /***************************** Include Files **********************************/ |
| 44 | /******************************************************************************/ |
| 45 | #include <ADuC7023.h> |
| 46 | |
| 47 | /******************************************************************************/ |
| 48 | /******************** Macros and Constants Definitions ************************/ |
| 49 | /******************************************************************************/ |
| 50 | |
| 51 | /* ST7565R definitions */ |
| 52 | #define ST7565R_SLAVE_ID 1 |
| 53 | #define ST7565R_PAGE_ADDR(x) (0xB0 | (x & 0x0F)) |
| 54 | #define ST7565R_COLUMN_ADDR_H(x) (0x10 | (x & 0x0F)) |
| 55 | #define ST7565R_COLUMN_ADDR_L(x) (0x00 | (x & 0x0F)) |
| 56 | |
| 57 | /* GPIOs definitions */ |
| 58 | #define ST7565R_A0_PIN_OUT GP0DAT |= 0x40000000 |
| 59 | #define ST7565R_A0_LOW GP0DAT &= ~0x00400000 |
| 60 | #define ST7565R_A0_HIGH GP0DAT |= 0x00400000 |
| 61 | #define ST7565R_RST_PIN_OUT GP0DAT |= 0x20000000 |
| 62 | #define ST7565R_RST_LOW GP0DAT &= ~0x00200000 |
| 63 | #define ST7565R_RST_HIGH GP0DAT |= 0x00200000 |
| 64 | |
| 65 | /******************************************************************************/ |
| 66 | /************************ Functions Declarations ******************************/ |
| 67 | /******************************************************************************/ |
| 68 | |
| 69 | /*! Initializes the ST7565R controller. */ |
| 70 | char ST7565R_Init(void); |
| 71 | |
| 72 | /*! Sends a character to ST7565R controller. */ |
| 73 | void ST7565R_Char(unsigned char pageAddr, |
| 74 | unsigned char columnAddr, |
| 75 | char character, |
| 76 | unsigned char bigFont); |
| 77 | |
| 78 | /*! Sends a string to ST7565R controller. */ |
| 79 | void ST7565R_String(unsigned char pageAddr, |
| 80 | unsigned char columnAddr, |
| 81 | char* string, |
| 82 | unsigned char bigFont); |
| 83 | |
| 84 | /* Sends an image array to ST7565R controller. */ |
| 85 | void ST7565R_Image(unsigned char pageAddr, |
| 86 | unsigned char columnAddr, |
| 87 | const unsigned char image[], |
| 88 | unsigned char width, |
| 89 | unsigned char height); |
| 90 | |
| 91 | /*! Sends an integer number to ST7565R controller. */ |
| 92 | void ST7565R_Number(unsigned char pageAddr, |
| 93 | unsigned char columnAddr, |
| 94 | long number, |
| 95 | unsigned char bigFont); |
| 96 | /*! Clears the screen. */ |
| 97 | void ClearScreen(void); |
| 98 | |
| 99 | /*! Sends a float number to ST7565R controller. */ |
| 100 | void ST7565R_FloatNumber(unsigned char pageAddr, |
| 101 | unsigned char columnAddr, |
| 102 | float number, |
| 103 | unsigned char resolution, |
| 104 | unsigned char bigFont); |
| 105 | |
| 106 | #endif // __ST7565R_H__ |