@@ -22,8 +22,19 | |||
|
22 | 22 | #ifndef ILI9328_H |
|
23 | 23 | #define ILI9328_H |
|
24 | 24 | |
|
25 | /** | |
|
26 | @todo Make an abstract layer for framebuffer devices and a painting api for it. | |
|
27 | */ | |
|
28 | ||
|
29 | ||
|
25 | 30 | #include <genericLCD_Controler.h> |
|
26 | 31 | |
|
32 | /** | |
|
33 | * @brief ili9328init | |
|
34 | * @param LCD | |
|
35 | * @return | |
|
36 | */ | |
|
37 | ||
|
27 | 38 | extern int ili9328init(struct LCD_t* LCD); |
|
28 | 39 | extern void ili9328setFrame(LCD_t* LCD,uint16_t X,uint16_t Y,uint16_t W,uint16_t H); |
|
29 | 40 | extern void ili9328setGRAMaddress(LCD_t* LCD,uint16_t Haddress,uint16_t Vaddress); |
@@ -1,4 +1,4 | |||
|
1 | /*------------------------------------------------------------------------------ | |
|
1 | /** ------------------------------------------------------------------------------ | |
|
2 | 2 | -- This file is a part of the libuc, microcontroler library |
|
3 | 3 | -- Copyright (C) 2012, Alexis Jeandet |
|
4 | 4 | -- |
@@ -16,8 +16,8 | |||
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | ------------------------------------------------------------------------------- |
|
19 | -- Author : Alexis Jeandet | |
|
20 |
-- |
|
|
19 | -- @Author : Alexis Jeandet | |
|
20 | -- @Mail : alexis.jeandet@gmail.com | |
|
21 | 21 | -------------------------------------------------------------------------------*/ |
|
22 | 22 | |
|
23 | 23 | /*! \file gpio.h |
@@ -51,38 +51,77 A simple example to drive PA0 and read P | |||
|
51 | 51 | extern "C" { |
|
52 | 52 | #endif |
|
53 | 53 | |
|
54 | ||
|
54 | /** | |
|
55 | * @brief gpio handle | |
|
56 | * | |
|
57 | *gpio_t is the handle type you will use for all | |
|
58 | *gpio related functions. | |
|
59 | */ | |
|
55 | 60 | typedef uint32_t gpio_t; |
|
56 | 61 | |
|
62 | ||
|
63 | /** | |
|
64 | * @brief GPIO speed enum | |
|
65 | * | |
|
66 | * Use gpiospeed_t values to configure the speed of your GPIO pin with | |
|
67 | * gpiosetspeed(gpio_t* gpio,gpiospeed_t speed) function or gpiosetconfig(gpio_t* gpio). | |
|
68 | * The speed values are realy platform dependant check for each target if you whant to | |
|
69 | * know the meaning of each speed. | |
|
70 | * Don't try to use numerical values directly! | |
|
71 | * @sa gpiosetspeed(gpio_t* gpio,gpiospeed_t speed),gpiosetconfig(gpio_t* gpio) | |
|
72 | */ | |
|
57 | 73 | typedef enum gpiospeed_t |
|
58 | 74 | { |
|
59 | gpiolowspeed = 0x00000, | |
|
60 | gpiomediumspeed = 0x10000, | |
|
61 | gpiofastspeed = 0x20000, | |
|
62 | gpiohighspeed = 0x30000 | |
|
75 | gpiolowspeed = 0x00000, /**< Lowest speed value*/ | |
|
76 | gpiomediumspeed = 0x10000, /**< Normal or medium speed value*/ | |
|
77 | gpiofastspeed = 0x20000, /**< Higher speed value*/ | |
|
78 | gpiohighspeed = 0x30000 /**< Highest speed value*/ | |
|
63 | 79 | }gpiospeed_t; |
|
64 | 80 | |
|
65 | 81 | |
|
66 | 82 | |
|
83 | /** | |
|
84 | * @brief GPIO direction enum | |
|
85 | * | |
|
86 | * Use gpiodir_t values to configure the direction of your GPIO pin with | |
|
87 | * gpiosetdir(gpio_t* gpio,gpiodir_t dir) function or gpiosetconfig(gpio_t* gpio). | |
|
88 | * Don't try to use numerical values directly! | |
|
89 | * @sa gpiosetdir(gpio_t* gpio,gpiodir_t dir),gpiosetconfig(gpio_t* gpio) | |
|
90 | */ | |
|
67 | 91 | typedef enum gpiodir_t |
|
68 | 92 | { |
|
69 | gpioindir = 0x00000, | |
|
70 | gpiooutdir = 0x40000, | |
|
71 | gpioaf = 0x80000, | |
|
72 | gpioan = 0xC0000 | |
|
93 | gpioindir = 0x00000, /**< Input direction*/ | |
|
94 | gpiooutdir = 0x40000, /**< Output direction*/ | |
|
95 | gpioaf = 0x80000, /**< Alternate function such as spi, uart, ...*/ | |
|
96 | gpioan = 0xC0000 /**< Configure the pin for analogic mode*/ | |
|
73 | 97 | }gpiodir_t; |
|
74 | 98 | |
|
75 | 99 | |
|
76 | 100 | |
|
77 | ||
|
101 | /** | |
|
102 | * @brief GPIO output type enum | |
|
103 | * | |
|
104 | * Use gpioouttype_t values to configure the kind of output you want with | |
|
105 | * gpiosetouttype(gpio_t* gpio, gpioouttype_t outtype) function or gpiosetconfig(gpio_t* gpio). | |
|
106 | * Don't try to use numerical values directly! | |
|
107 | * @sa gpiosetouttype(gpio_t* gpio, gpioouttype_t outtype),gpiosetconfig(gpio_t* gpio) | |
|
108 | */ | |
|
78 | 109 | typedef enum gpioouttype_t |
|
79 | 110 | { |
|
80 | gpiopushpulltype = 0x000000, | |
|
81 | gpioopendraintype = 0x100000 | |
|
111 | gpiopushpulltype = 0x000000, /**< Pushpull output*/ | |
|
112 | gpioopendraintype = 0x100000 /**< Open drain output*/ | |
|
82 | 113 | }gpioouttype_t; |
|
83 | 114 | |
|
84 | 115 | |
|
85 | 116 | |
|
117 | /** | |
|
118 | * @brief GPIO pull resistor configuration enum | |
|
119 | * | |
|
120 | * Use gpiopulltype_t values to configure the pull resistor of your GPIO pin with | |
|
121 | * gpiosetpulltype(gpio_t* gpio,gpiopulltype_t pulltype) function or gpiosetconfig(gpio_t* gpio). | |
|
122 | * Don't try to use numerical values directly! | |
|
123 | * @sa gpiosetpulltype(gpio_t* gpio,gpiopulltype_t pulltype),gpiosetconfig(gpio_t* gpio) | |
|
124 | */ | |
|
86 | 125 | typedef enum gpiopulltype_t |
|
87 | 126 | { |
|
88 | 127 | gpionopulltype = 0x000000, |
@@ -97,17 +136,73 typedef enum gpiopulltype_t | |||
|
97 | 136 | #define GPIOPULLTYPEMASK 0x600000 |
|
98 | 137 | #endif |
|
99 | 138 | |
|
100 | ||
|
139 | /** | |
|
140 | * @brief gpioopen | |
|
141 | * @param gpio | |
|
142 | * @return | |
|
143 | * @sa gpioclose(gpio_t gpio) | |
|
144 | */ | |
|
101 | 145 | extern gpio_t gpioopen(uint32_t gpio); |
|
146 | /** | |
|
147 | * @brief gpioclose | |
|
148 | * @param gpio | |
|
149 | * @sa gpioopen(uint32_t gpio) | |
|
150 | */ | |
|
102 | 151 | extern void gpioclose(gpio_t gpio); |
|
152 | /** | |
|
153 | * @brief gpiosetconfig | |
|
154 | * @param gpio | |
|
155 | */ | |
|
103 | 156 | extern void gpiosetconfig(gpio_t* gpio); |
|
157 | /** | |
|
158 | * @brief gpiosetdir | |
|
159 | * @param gpio | |
|
160 | * @param dir | |
|
161 | */ | |
|
104 | 162 | extern void gpiosetdir(gpio_t* gpio,gpiodir_t dir); |
|
163 | /** | |
|
164 | * @brief gpiosetouttype | |
|
165 | * @param gpio | |
|
166 | * @param outtype | |
|
167 | * @sa gpiosetconfig(gpio_t* gpio) | |
|
168 | */ | |
|
105 | 169 | extern void gpiosetouttype(gpio_t* gpio, gpioouttype_t outtype); |
|
170 | /** | |
|
171 | * @brief gpiosetpulltype | |
|
172 | * @param gpio | |
|
173 | * @param pulltype | |
|
174 | * @sa gpiosetconfig(gpio_t* gpio) | |
|
175 | */ | |
|
106 | 176 | extern void gpiosetpulltype(gpio_t* gpio,gpiopulltype_t pulltype); |
|
177 | /** | |
|
178 | * @brief gpiosetspeed | |
|
179 | * @param gpio | |
|
180 | * @param speed | |
|
181 | * @sa gpiosetconfig(gpio_t* gpio) | |
|
182 | */ | |
|
107 | 183 | extern void gpiosetspeed(gpio_t* gpio,gpiospeed_t speed); |
|
184 | /** | |
|
185 | * @brief gpioset | |
|
186 | * @param gpio | |
|
187 | * @sa gpiosetconfig(gpio_t* gpio) | |
|
188 | */ | |
|
108 | 189 | extern void gpioset(gpio_t gpio); |
|
190 | /** | |
|
191 | * @brief gpioclr | |
|
192 | * @param gpio | |
|
193 | */ | |
|
109 | 194 | extern void gpioclr(gpio_t gpio); |
|
195 | /** | |
|
196 | * @brief gpiosetval | |
|
197 | * @param gpio | |
|
198 | * @param val | |
|
199 | */ | |
|
110 | 200 | extern void gpiosetval(gpio_t gpio,int val); |
|
201 | /** | |
|
202 | * @brief gpiogetval | |
|
203 | * @param gpio | |
|
204 | * @return | |
|
205 | */ | |
|
111 | 206 | extern int gpiogetval(gpio_t gpio); |
|
112 | 207 | |
|
113 | 208 | #define GPIOISINPUT(gpio) (((gpio) & GPIODIRMASK)==gpioindir) |
General Comments 0
You need to be logged in to leave comments.
Login now