summaryrefslogtreecommitdiff
path: root/components/hx8347/hx8347.h
blob: 20254057a7af27f8fbe950a3cd3be1c960b89f30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/* ----------------------------------------------------------------------------
 *         ATMEL Microcontroller Software Support 
 * ----------------------------------------------------------------------------
 * Copyright (c) 2008, Atmel Corporation
 *
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * - Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the disclaimer below.
 *
 * Atmel's name may not be used to endorse or promote products derived from
 * this software without specific prior written permission.
 *
 * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
 * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * ----------------------------------------------------------------------------
 */

//------------------------------------------------------------------------------
/// \unit
///
/// !!!Purpose
///
/// Definition of methods for HX8347 driver.
///
/// !!!Usage
///
/// -# LCD_WriteReg
/// -# LCD_ReadReg
/// -# LCD_ReadStatus
/// -# LCD_DumpReg
/// -# LCD_WriteRAM_Prepare
/// -# LCD_WriteRAM
/// -# LCD_ReadRAM_Prepare
/// -# LCD_ReadRAM
/// -# LCD_Initialize
/// -# LCD_SetCursor
/// -# LCD_On
/// -# LCD_Off
//------------------------------------------------------------------------------

#ifndef HX8347_H
#define HX8347_H

//------------------------------------------------------------------------------
//         Headers
//------------------------------------------------------------------------------
#include <board.h>

#ifdef BOARD_LCD_HX8347

//------------------------------------------------------------------------------
//         Definitions
//------------------------------------------------------------------------------
/// Convert 24-bits color to 16-bits color
#define RGB24ToRGB16(color) (((color >> 8) & 0xF800) | \
    ((color >> 5) & 0x7E0) | \
    ((color >> 3) & 0x1F))

//------------------------------------------------------------------------------
//         Global functions
//------------------------------------------------------------------------------

void LCD_WriteReg(void *pLcdBase, unsigned char reg, unsigned short data);
unsigned short LCD_ReadReg(void *pLcdBase, unsigned char reg);
unsigned short LCD_ReadStatus(void *pLcdBase);
void LCD_DumpReg(void *pLcdBase, unsigned char startAddr, unsigned char endAddr);
void LCD_WriteRAM_Prepare(void *pLcdBase);
void LCD_WriteRAM(void *pLcdBase, unsigned short color);
void LCD_ReadRAM_Prepare(void *pLcdBase);
unsigned short LCD_ReadRAM(void *pLcdBase);
void LCD_Initialize(void *pLcdBase);
void LCD_SetCursor(void *pLcdBase, unsigned short x, unsigned short y);
void LCD_On(void *pLcdBase);
void LCD_Off(void *pLcdBase);
void LCD_SetWindow(void *pLcdBase,unsigned short x_start, unsigned short y_start,unsigned short x_end, unsigned short y_end);

#endif //#ifdef BOARD_LCD_HX8347
#endif //#ifndef HX8347_H
personal git repositories of Harald Welte. Your mileage may vary