@@ -1,99 +1,110 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 2 | -- This file is a part of the libuc, microcontroler library |
|
3 | 3 | -- Copyright (C) 2012, Alexis Jeandet |
|
4 | 4 | -- |
|
5 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 3 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
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 | 19 | -- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@gmail.com |
|
21 | 21 | -------------------------------------------------------------------------------*/ |
|
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); |
|
30 | 41 | extern void ili9328paint(LCD_t* LCD,void* buffer,uint16_t Xpos,uint16_t Ypos,uint16_t Width,uint16_t Height); |
|
31 | 42 | extern void ili9328paintText(LCD_t* LCD,char* buffer,uint16_t Xpos,uint16_t Ypos,sFONT *font,uint32_t color); |
|
32 | 43 | extern void ili9328paintFilRect(LCD_t* LCD,uint16_t Xpos,uint16_t Ypos,uint16_t w,uint16_t h,uint32_t contColor,uint16_t contSz,uint32_t fillColor); |
|
33 | 44 | extern void ili9328paintFilCirc(LCD_t* LCD,uint16_t Xpos,uint16_t Ypos,uint16_t r,uint32_t contColor,uint16_t contSz,uint32_t fillColor); |
|
34 | 45 | extern void ili9328paintFilCircMidPoint(LCD_t* LCD,uint16_t Xpos,uint16_t Ypos,uint16_t r,uint32_t contColor,uint16_t contSz,uint32_t fillColor); |
|
35 | 46 | extern void ili9328getPix(struct LCD_t* LCD,uint16_t* buffer,uint16_t Xpos,uint16_t Ypos,uint16_t w,uint16_t h); |
|
36 | 47 | extern void ili9328refreshenable(struct LCD_t* LCD,int enable); |
|
37 | 48 | extern void ili9328paintChar(LCD_t* LCD,char buffer,uint16_t Xpos,uint16_t Ypos,sFONT* font,uint32_t color); |
|
38 | 49 | |
|
39 | 50 | #define ILI9328_REGISTER_DRIVERCODEREAD ((uint32_t) 0x0000 ) |
|
40 | 51 | #define ILI9328_REGISTER_DRIVEROUTPUTCONTROL1 ((uint32_t) 0x0001 ) |
|
41 | 52 | #define ILI9328_REGISTER_LCDDRIVINGCONTROL ((uint32_t) 0x0002 ) |
|
42 | 53 | #define ILI9328_REGISTER_ENTRYMODE ((uint32_t) 0x0003 ) |
|
43 | 54 | #define ILI9328_REGISTER_RESIZECONTROL ((uint32_t) 0x0004 ) |
|
44 | 55 | #define ILI9328_REGISTER_DISPLAYCONTROL1 ((uint32_t) 0x0007 ) |
|
45 | 56 | #define ILI9328_REGISTER_DISPLAYCONTROL2 ((uint32_t) 0x0008 ) |
|
46 | 57 | #define ILI9328_REGISTER_DISPLAYCONTROL3 ((uint32_t) 0x0009 ) |
|
47 | 58 | #define ILI9328_REGISTER_DISPLAYCONTROL4 ((uint32_t) 0x000A ) |
|
48 | 59 | #define ILI9328_REGISTER_RGBDISPLAYINTERFACECONTROL1 ((uint32_t) 0x000C ) |
|
49 | 60 | #define ILI9328_REGISTER_FRAMEMAKERPOSITION ((uint32_t) 0x000D ) |
|
50 | 61 | #define ILI9328_REGISTER_RGBDISPLAYINTERFACECONTROL2 ((uint32_t) 0x000F ) |
|
51 | 62 | #define ILI9328_REGISTER_POWERCONTROL1 ((uint32_t) 0x0010 ) |
|
52 | 63 | #define ILI9328_REGISTER_POWERCONTROL2 ((uint32_t) 0x0011 ) |
|
53 | 64 | #define ILI9328_REGISTER_POWERCONTROL3 ((uint32_t) 0x0012 ) |
|
54 | 65 | #define ILI9328_REGISTER_POWERCONTROL4 ((uint32_t) 0x0013 ) |
|
55 | 66 | #define ILI9328_REGISTER_HORIZONTALGRAMADDRESSSET ((uint32_t) 0x0020 ) |
|
56 | 67 | #define ILI9328_REGISTER_VERTICALGRAMADDRESSSET ((uint32_t) 0x0021 ) |
|
57 | 68 | #define ILI9328_REGISTER_WRITEDATATOGRAM ((uint32_t) 0x0022 ) |
|
58 | 69 | #define ILI9328_REGISTER_POWERCONTROL7 ((uint32_t) 0x0029 ) |
|
59 | 70 | #define ILI9328_REGISTER_FRAMERATEANDCOLORCONTROL ((uint32_t) 0x002B ) |
|
60 | 71 | #define ILI9328_REGISTER_GAMMACONTROL1 ((uint32_t) 0x0030 ) |
|
61 | 72 | #define ILI9328_REGISTER_GAMMACONTROL2 ((uint32_t) 0x0031 ) |
|
62 | 73 | #define ILI9328_REGISTER_GAMMACONTROL3 ((uint32_t) 0x0032 ) |
|
63 | 74 | #define ILI9328_REGISTER_GAMMACONTROL4 ((uint32_t) 0x0035 ) |
|
64 | 75 | #define ILI9328_REGISTER_GAMMACONTROL5 ((uint32_t) 0x0036 ) |
|
65 | 76 | #define ILI9328_REGISTER_GAMMACONTROL6 ((uint32_t) 0x0037 ) |
|
66 | 77 | #define ILI9328_REGISTER_GAMMACONTROL7 ((uint32_t) 0x0038 ) |
|
67 | 78 | #define ILI9328_REGISTER_GAMMACONTROL8 ((uint32_t) 0x0039 ) |
|
68 | 79 | #define ILI9328_REGISTER_GAMMACONTROL9 ((uint32_t) 0x003C ) |
|
69 | 80 | #define ILI9328_REGISTER_GAMMACONTROL10 ((uint32_t) 0x003D ) |
|
70 | 81 | #define ILI9328_REGISTER_HORIZONTALADDRESSSTARTPOSITION ((uint32_t) 0x0050 ) |
|
71 | 82 | #define ILI9328_REGISTER_HORIZONTALADDRESSENDPOSITION ((uint32_t) 0x0051 ) |
|
72 | 83 | #define ILI9328_REGISTER_VERTICALADDRESSSTARTPOSITION ((uint32_t) 0x0052 ) |
|
73 | 84 | #define ILI9328_REGISTER_VERTICALADDRESSENDPOSITION ((uint32_t) 0x0053 ) |
|
74 | 85 | #define ILI9328_REGISTER_DRIVEROUTPUTCONTROL2 ((uint32_t) 0x0060 ) |
|
75 | 86 | #define ILI9328_REGISTER_BASEIMAGEDISPLAYCONTROL ((uint32_t) 0x0061 ) |
|
76 | 87 | #define ILI9328_REGISTER_VERTICALSCROLLCONTROL ((uint32_t) 0x006A ) |
|
77 | 88 | #define ILI9328_REGISTER_PARTIALIMAGE1DISPLAYPOSITION ((uint32_t) 0x0080 ) |
|
78 | 89 | #define ILI9328_REGISTER_PARTIALIMAGE1AREASTARTLINE ((uint32_t) 0x0081 ) |
|
79 | 90 | #define ILI9328_REGISTER_PARTIALIMAGE1AREAENDLINE ((uint32_t) 0x0082 ) |
|
80 | 91 | #define ILI9328_REGISTER_PARTIALIMAGE2DISPLAYPOSITION ((uint32_t) 0x0083 ) |
|
81 | 92 | #define ILI9328_REGISTER_PARTIALIMAGE2AREASTARTLINE ((uint32_t) 0x0084 ) |
|
82 | 93 | #define ILI9328_REGISTER_PARTIALIMAGE2AREAENDLINE ((uint32_t) 0x0085 ) |
|
83 | 94 | #define ILI9328_REGISTER_PANELINTERFACECONTROL1 ((uint32_t) 0x0090 ) |
|
84 | 95 | #define ILI9328_REGISTER_PANELINTERFACECONTROL2 ((uint32_t) 0x0092 ) |
|
85 | 96 | #define ILI9328_REGISTER_PANELINTERFACECONTROL4 ((uint32_t) 0x0095 ) |
|
86 | 97 | #define ILI9328_REGISTER_OTPVCMPROGRAMMINGCONTROL ((uint32_t) 0x00A1 ) |
|
87 | 98 | #define ILI9328_REGISTER_OTPVCMSTATUSANDENABLE ((uint32_t) 0x00A2 ) |
|
88 | 99 | #define ILI9328_REGISTER_OTPPROGRAMMINGIDKEY ((uint32_t) 0x00A5 ) |
|
89 | 100 | |
|
90 | 101 | #ifdef _PRVATE_ILI9328_ |
|
91 | 102 | void ili9328cpFrame(LCD_t* LCD,void* buffer,int x,int y,int w, int h); |
|
92 | 103 | #endif |
|
93 | 104 | |
|
94 | 105 | #endif |
|
95 | 106 | |
|
96 | 107 | |
|
97 | 108 | |
|
98 | 109 | |
|
99 | 110 |
@@ -1,590 +1,685 | |||
|
1 | /*------------------------------------------------------------------------------ | |
|
1 | /** ------------------------------------------------------------------------------ | |
|
2 | 2 | -- This file is a part of the libuc, microcontroler library |
|
3 | 3 | -- Copyright (C) 2012, Alexis Jeandet |
|
4 | 4 | -- |
|
5 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 3 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
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 |
|
24 | 24 | \brief GPIO api. |
|
25 | 25 | |
|
26 | 26 | The gpio api gives you a standard way to drive any gpio on any processor. |
|
27 | 27 | With this api you will be able to open and configure your gpios and set/clear read them. |
|
28 | 28 | |
|
29 | 29 | A simple example to drive PA0 and read PA1. |
|
30 | 30 | \code |
|
31 | 31 | // lets open PA0 and PA1 |
|
32 | 32 | gpio_t mygpio1 gpioopen(PA0); |
|
33 | 33 | gpioopen(PA1); |
|
34 | 34 | mygpio1 |= gpiohighspeed | gpiooutdir | gpiopushpulltype | gpionopulltype; |
|
35 | 35 | gpiosetconfig(mygpio1); |
|
36 | 36 | //you can also configure with the pin name |
|
37 | 37 | gpiosetconfig(PA1|gpiohighspeed | gpioindir); |
|
38 | 38 | //to set PA0 |
|
39 | 39 | gpioset(mygpio1); |
|
40 | 40 | //to clear it |
|
41 | 41 | gpioclr(PA0); //PA0 also works and save 4 bytes! |
|
42 | 42 | //Let read PA1 and write it to PA0 |
|
43 | 43 | gpiosetval(PA0,gpiogetval(PA1)); |
|
44 | 44 | \endcode |
|
45 | 45 | |
|
46 | 46 | */ |
|
47 | 47 | #ifndef GPIO_H |
|
48 | 48 | #define GPIO_H |
|
49 | 49 | #include <stdint.h> |
|
50 | 50 | #ifdef __cplusplus |
|
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, |
|
89 | 128 | gpiopulluptype = 0x200000, |
|
90 | 129 | gpiopulldowntype = 0x400000 |
|
91 | 130 | }gpiopulltype_t; |
|
92 | 131 | |
|
93 | 132 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
|
94 | 133 | #define GPIOSPEEDMASK 0x30000 |
|
95 | 134 | #define GPIODIRMASK 0xC0000 |
|
96 | 135 | #define GPIOOUTTYPEMASK 0x100000 |
|
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) |
|
114 | 209 | #define GPIOISOUTPUT(gpio) (((gpio) & GPIOSPEEDMASK)==gpiooutdir) |
|
115 | 210 | |
|
116 | 211 | #define GPIOISLOWSPEED(gpio) (((gpio) & GPIOSPEEDMASK)==gpiolowspeed) |
|
117 | 212 | #define GPIOISMEDIUMSPEED(gpio) (((gpio) & GPIOSPEEDMASK)==gpiomediumspeed) |
|
118 | 213 | #define GPIOISFASTPEED(gpio) (((gpio) & GPIOSPEEDMASK)==gpiofastspeed) |
|
119 | 214 | #define GPIOISHIGHSPEED(gpio) (((gpio) & GPIOSPEEDMASK)==gpiohighspeeds) |
|
120 | 215 | |
|
121 | 216 | #define GPIOISPUSHPULL(gpio) (((gpio) & GPIOOUTTYPEMASK)==gpiopushpulltype) |
|
122 | 217 | #define GPIOISOPENDRAIN(gpio) (((gpio) & GPIOOUTTYPEMASK)==gpioopendraintype) |
|
123 | 218 | |
|
124 | 219 | #define GPIOISNOPULL(GPIO) (((gpio) & GPIOPULLTYPEMASK)==gpionopulltype) |
|
125 | 220 | #define GPIOISPULLUP(GPIO) (((gpio) & GPIOPULLTYPEMASK)==gpiopulluptype) |
|
126 | 221 | #define GPIOISPULLDOWN(GPIO) (((gpio) & GPIOPULLTYPEMASK)==gpiopulldowntype) |
|
127 | 222 | |
|
128 | 223 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
|
129 | 224 | |
|
130 | 225 | #define PA0 ((0<<8)+0) |
|
131 | 226 | #define PA1 ((0<<8)+1) |
|
132 | 227 | #define PA2 ((0<<8)+2) |
|
133 | 228 | #define PA3 ((0<<8)+3) |
|
134 | 229 | #define PA4 ((0<<8)+4) |
|
135 | 230 | #define PA5 ((0<<8)+5) |
|
136 | 231 | #define PA6 ((0<<8)+6) |
|
137 | 232 | #define PA7 ((0<<8)+7) |
|
138 | 233 | #define PA8 ((0<<8)+8) |
|
139 | 234 | #define PA9 ((0<<8)+9) |
|
140 | 235 | #define PA10 ((0<<8)+10) |
|
141 | 236 | #define PA11 ((0<<8)+11) |
|
142 | 237 | #define PA12 ((0<<8)+12) |
|
143 | 238 | #define PA13 ((0<<8)+13) |
|
144 | 239 | #define PA14 ((0<<8)+14) |
|
145 | 240 | #define PA15 ((0<<8)+15) |
|
146 | 241 | #define PAX ((0<<8)+255) |
|
147 | 242 | #define PB0 ((1<<8)+0) |
|
148 | 243 | #define PB1 ((1<<8)+1) |
|
149 | 244 | #define PB2 ((1<<8)+2) |
|
150 | 245 | #define PB3 ((1<<8)+3) |
|
151 | 246 | #define PB4 ((1<<8)+4) |
|
152 | 247 | #define PB5 ((1<<8)+5) |
|
153 | 248 | #define PB6 ((1<<8)+6) |
|
154 | 249 | #define PB7 ((1<<8)+7) |
|
155 | 250 | #define PB8 ((1<<8)+8) |
|
156 | 251 | #define PB9 ((1<<8)+9) |
|
157 | 252 | #define PB10 ((1<<8)+10) |
|
158 | 253 | #define PB11 ((1<<8)+11) |
|
159 | 254 | #define PB12 ((1<<8)+12) |
|
160 | 255 | #define PB13 ((1<<8)+13) |
|
161 | 256 | #define PB14 ((1<<8)+14) |
|
162 | 257 | #define PB15 ((1<<8)+15) |
|
163 | 258 | #define PBX ((1<<8)+255) |
|
164 | 259 | #define PC0 ((2<<8)+0) |
|
165 | 260 | #define PC1 ((2<<8)+1) |
|
166 | 261 | #define PC2 ((2<<8)+2) |
|
167 | 262 | #define PC3 ((2<<8)+3) |
|
168 | 263 | #define PC4 ((2<<8)+4) |
|
169 | 264 | #define PC5 ((2<<8)+5) |
|
170 | 265 | #define PC6 ((2<<8)+6) |
|
171 | 266 | #define PC7 ((2<<8)+7) |
|
172 | 267 | #define PC8 ((2<<8)+8) |
|
173 | 268 | #define PC9 ((2<<8)+9) |
|
174 | 269 | #define PC10 ((2<<8)+10) |
|
175 | 270 | #define PC11 ((2<<8)+11) |
|
176 | 271 | #define PC12 ((2<<8)+12) |
|
177 | 272 | #define PC13 ((2<<8)+13) |
|
178 | 273 | #define PC14 ((2<<8)+14) |
|
179 | 274 | #define PC15 ((2<<8)+15) |
|
180 | 275 | #define PCX ((2<<8)+255) |
|
181 | 276 | #define PD0 ((3<<8)+0) |
|
182 | 277 | #define PD1 ((3<<8)+1) |
|
183 | 278 | #define PD2 ((3<<8)+2) |
|
184 | 279 | #define PD3 ((3<<8)+3) |
|
185 | 280 | #define PD4 ((3<<8)+4) |
|
186 | 281 | #define PD5 ((3<<8)+5) |
|
187 | 282 | #define PD6 ((3<<8)+6) |
|
188 | 283 | #define PD7 ((3<<8)+7) |
|
189 | 284 | #define PD8 ((3<<8)+8) |
|
190 | 285 | #define PD9 ((3<<8)+9) |
|
191 | 286 | #define PD10 ((3<<8)+10) |
|
192 | 287 | #define PD11 ((3<<8)+11) |
|
193 | 288 | #define PD12 ((3<<8)+12) |
|
194 | 289 | #define PD13 ((3<<8)+13) |
|
195 | 290 | #define PD14 ((3<<8)+14) |
|
196 | 291 | #define PD15 ((3<<8)+15) |
|
197 | 292 | #define PDX ((3<<8)+255) |
|
198 | 293 | #define PE0 ((4<<8)+0) |
|
199 | 294 | #define PE1 ((4<<8)+1) |
|
200 | 295 | #define PE2 ((4<<8)+2) |
|
201 | 296 | #define PE3 ((4<<8)+3) |
|
202 | 297 | #define PE4 ((4<<8)+4) |
|
203 | 298 | #define PE5 ((4<<8)+5) |
|
204 | 299 | #define PE6 ((4<<8)+6) |
|
205 | 300 | #define PE7 ((4<<8)+7) |
|
206 | 301 | #define PE8 ((4<<8)+8) |
|
207 | 302 | #define PE9 ((4<<8)+9) |
|
208 | 303 | #define PE10 ((4<<8)+10) |
|
209 | 304 | #define PE11 ((4<<8)+11) |
|
210 | 305 | #define PE12 ((4<<8)+12) |
|
211 | 306 | #define PE13 ((4<<8)+13) |
|
212 | 307 | #define PE14 ((4<<8)+14) |
|
213 | 308 | #define PE15 ((4<<8)+15) |
|
214 | 309 | #define PEX ((4<<8)+255) |
|
215 | 310 | #define PF0 ((5<<8)+0) |
|
216 | 311 | #define PF1 ((5<<8)+1) |
|
217 | 312 | #define PF2 ((5<<8)+2) |
|
218 | 313 | #define PF3 ((5<<8)+3) |
|
219 | 314 | #define PF4 ((5<<8)+4) |
|
220 | 315 | #define PF5 ((5<<8)+5) |
|
221 | 316 | #define PF6 ((5<<8)+6) |
|
222 | 317 | #define PF7 ((5<<8)+7) |
|
223 | 318 | #define PF8 ((5<<8)+8) |
|
224 | 319 | #define PF9 ((5<<8)+9) |
|
225 | 320 | #define PF10 ((5<<8)+10) |
|
226 | 321 | #define PF11 ((5<<8)+11) |
|
227 | 322 | #define PF12 ((5<<8)+12) |
|
228 | 323 | #define PF13 ((5<<8)+13) |
|
229 | 324 | #define PF14 ((5<<8)+14) |
|
230 | 325 | #define PF15 ((5<<8)+15) |
|
231 | 326 | #define PFX ((5<<8)+255) |
|
232 | 327 | #define PG0 ((6<<8)+0) |
|
233 | 328 | #define PG1 ((6<<8)+1) |
|
234 | 329 | #define PG2 ((6<<8)+2) |
|
235 | 330 | #define PG3 ((6<<8)+3) |
|
236 | 331 | #define PG4 ((6<<8)+4) |
|
237 | 332 | #define PG5 ((6<<8)+5) |
|
238 | 333 | #define PG6 ((6<<8)+6) |
|
239 | 334 | #define PG7 ((6<<8)+7) |
|
240 | 335 | #define PG8 ((6<<8)+8) |
|
241 | 336 | #define PG9 ((6<<8)+9) |
|
242 | 337 | #define PG10 ((6<<8)+10) |
|
243 | 338 | #define PG11 ((6<<8)+11) |
|
244 | 339 | #define PG12 ((6<<8)+12) |
|
245 | 340 | #define PG13 ((6<<8)+13) |
|
246 | 341 | #define PG14 ((6<<8)+14) |
|
247 | 342 | #define PG15 ((6<<8)+15) |
|
248 | 343 | #define PGX ((6<<8)+255) |
|
249 | 344 | #define PH0 ((7<<8)+0) |
|
250 | 345 | #define PH1 ((7<<8)+1) |
|
251 | 346 | #define PH2 ((7<<8)+2) |
|
252 | 347 | #define PH3 ((7<<8)+3) |
|
253 | 348 | #define PH4 ((7<<8)+4) |
|
254 | 349 | #define PH5 ((7<<8)+5) |
|
255 | 350 | #define PH6 ((7<<8)+6) |
|
256 | 351 | #define PH7 ((7<<8)+7) |
|
257 | 352 | #define PH8 ((7<<8)+8) |
|
258 | 353 | #define PH9 ((7<<8)+9) |
|
259 | 354 | #define PH10 ((7<<8)+10) |
|
260 | 355 | #define PH11 ((7<<8)+11) |
|
261 | 356 | #define PH12 ((7<<8)+12) |
|
262 | 357 | #define PH13 ((7<<8)+13) |
|
263 | 358 | #define PH14 ((7<<8)+14) |
|
264 | 359 | #define PH15 ((7<<8)+15) |
|
265 | 360 | #define PHX ((7<<8)+255) |
|
266 | 361 | #define PI0 ((8<<8)+0) |
|
267 | 362 | #define PI1 ((8<<8)+1) |
|
268 | 363 | #define PI2 ((8<<8)+2) |
|
269 | 364 | #define PI3 ((8<<8)+3) |
|
270 | 365 | #define PI4 ((8<<8)+4) |
|
271 | 366 | #define PI5 ((8<<8)+5) |
|
272 | 367 | #define PI6 ((8<<8)+6) |
|
273 | 368 | #define PI7 ((8<<8)+7) |
|
274 | 369 | #define PI8 ((8<<8)+8) |
|
275 | 370 | #define PI9 ((8<<8)+9) |
|
276 | 371 | #define PI10 ((8<<8)+10) |
|
277 | 372 | #define PI11 ((8<<8)+11) |
|
278 | 373 | #define PI12 ((8<<8)+12) |
|
279 | 374 | #define PI13 ((8<<8)+13) |
|
280 | 375 | #define PI14 ((8<<8)+14) |
|
281 | 376 | #define PI15 ((8<<8)+15) |
|
282 | 377 | #define PIX ((8<<8)+255) |
|
283 | 378 | #define PJ0 ((9<<8)+0) |
|
284 | 379 | #define PJ1 ((9<<8)+1) |
|
285 | 380 | #define PJ2 ((9<<8)+2) |
|
286 | 381 | #define PJ3 ((9<<8)+3) |
|
287 | 382 | #define PJ4 ((9<<8)+4) |
|
288 | 383 | #define PJ5 ((9<<8)+5) |
|
289 | 384 | #define PJ6 ((9<<8)+6) |
|
290 | 385 | #define PJ7 ((9<<8)+7) |
|
291 | 386 | #define PJ8 ((9<<8)+8) |
|
292 | 387 | #define PJ9 ((9<<8)+9) |
|
293 | 388 | #define PJ10 ((9<<8)+10) |
|
294 | 389 | #define PJ11 ((9<<8)+11) |
|
295 | 390 | #define PJ12 ((9<<8)+12) |
|
296 | 391 | #define PJ13 ((9<<8)+13) |
|
297 | 392 | #define PJ14 ((9<<8)+14) |
|
298 | 393 | #define PJ15 ((9<<8)+15) |
|
299 | 394 | #define PJX ((9<<8)+255) |
|
300 | 395 | #define PK0 ((10<<8)+0) |
|
301 | 396 | #define PK1 ((10<<8)+1) |
|
302 | 397 | #define PK2 ((10<<8)+2) |
|
303 | 398 | #define PK3 ((10<<8)+3) |
|
304 | 399 | #define PK4 ((10<<8)+4) |
|
305 | 400 | #define PK5 ((10<<8)+5) |
|
306 | 401 | #define PK6 ((10<<8)+6) |
|
307 | 402 | #define PK7 ((10<<8)+7) |
|
308 | 403 | #define PK8 ((10<<8)+8) |
|
309 | 404 | #define PK9 ((10<<8)+9) |
|
310 | 405 | #define PK10 ((10<<8)+10) |
|
311 | 406 | #define PK11 ((10<<8)+11) |
|
312 | 407 | #define PK12 ((10<<8)+12) |
|
313 | 408 | #define PK13 ((10<<8)+13) |
|
314 | 409 | #define PK14 ((10<<8)+14) |
|
315 | 410 | #define PK15 ((10<<8)+15) |
|
316 | 411 | #define PKX ((10<<8)+255) |
|
317 | 412 | #define PL0 ((11<<8)+0) |
|
318 | 413 | #define PL1 ((11<<8)+1) |
|
319 | 414 | #define PL2 ((11<<8)+2) |
|
320 | 415 | #define PL3 ((11<<8)+3) |
|
321 | 416 | #define PL4 ((11<<8)+4) |
|
322 | 417 | #define PL5 ((11<<8)+5) |
|
323 | 418 | #define PL6 ((11<<8)+6) |
|
324 | 419 | #define PL7 ((11<<8)+7) |
|
325 | 420 | #define PL8 ((11<<8)+8) |
|
326 | 421 | #define PL9 ((11<<8)+9) |
|
327 | 422 | #define PL10 ((11<<8)+10) |
|
328 | 423 | #define PL11 ((11<<8)+11) |
|
329 | 424 | #define PL12 ((11<<8)+12) |
|
330 | 425 | #define PL13 ((11<<8)+13) |
|
331 | 426 | #define PL14 ((11<<8)+14) |
|
332 | 427 | #define PL15 ((11<<8)+15) |
|
333 | 428 | #define PLX ((11<<8)+255) |
|
334 | 429 | #define PM0 ((12<<8)+0) |
|
335 | 430 | #define PM1 ((12<<8)+1) |
|
336 | 431 | #define PM2 ((12<<8)+2) |
|
337 | 432 | #define PM3 ((12<<8)+3) |
|
338 | 433 | #define PM4 ((12<<8)+4) |
|
339 | 434 | #define PM5 ((12<<8)+5) |
|
340 | 435 | #define PM6 ((12<<8)+6) |
|
341 | 436 | #define PM7 ((12<<8)+7) |
|
342 | 437 | #define PM8 ((12<<8)+8) |
|
343 | 438 | #define PM9 ((12<<8)+9) |
|
344 | 439 | #define PM10 ((12<<8)+10) |
|
345 | 440 | #define PM11 ((12<<8)+11) |
|
346 | 441 | #define PM12 ((12<<8)+12) |
|
347 | 442 | #define PM13 ((12<<8)+13) |
|
348 | 443 | #define PM14 ((12<<8)+14) |
|
349 | 444 | #define PM15 ((12<<8)+15) |
|
350 | 445 | #define PMX ((12<<8)+255) |
|
351 | 446 | #define PN0 ((13<<8)+0) |
|
352 | 447 | #define PN1 ((13<<8)+1) |
|
353 | 448 | #define PN2 ((13<<8)+2) |
|
354 | 449 | #define PN3 ((13<<8)+3) |
|
355 | 450 | #define PN4 ((13<<8)+4) |
|
356 | 451 | #define PN5 ((13<<8)+5) |
|
357 | 452 | #define PN6 ((13<<8)+6) |
|
358 | 453 | #define PN7 ((13<<8)+7) |
|
359 | 454 | #define PN8 ((13<<8)+8) |
|
360 | 455 | #define PN9 ((13<<8)+9) |
|
361 | 456 | #define PN10 ((13<<8)+10) |
|
362 | 457 | #define PN11 ((13<<8)+11) |
|
363 | 458 | #define PN12 ((13<<8)+12) |
|
364 | 459 | #define PN13 ((13<<8)+13) |
|
365 | 460 | #define PN14 ((13<<8)+14) |
|
366 | 461 | #define PN15 ((13<<8)+15) |
|
367 | 462 | #define PNX ((13<<8)+255) |
|
368 | 463 | #define PO0 ((14<<8)+0) |
|
369 | 464 | #define PO1 ((14<<8)+1) |
|
370 | 465 | #define PO2 ((14<<8)+2) |
|
371 | 466 | #define PO3 ((14<<8)+3) |
|
372 | 467 | #define PO4 ((14<<8)+4) |
|
373 | 468 | #define PO5 ((14<<8)+5) |
|
374 | 469 | #define PO6 ((14<<8)+6) |
|
375 | 470 | #define PO7 ((14<<8)+7) |
|
376 | 471 | #define PO8 ((14<<8)+8) |
|
377 | 472 | #define PO9 ((14<<8)+9) |
|
378 | 473 | #define PO10 ((14<<8)+10) |
|
379 | 474 | #define PO11 ((14<<8)+11) |
|
380 | 475 | #define PO12 ((14<<8)+12) |
|
381 | 476 | #define PO13 ((14<<8)+13) |
|
382 | 477 | #define PO14 ((14<<8)+14) |
|
383 | 478 | #define PO15 ((14<<8)+15) |
|
384 | 479 | #define POX ((14<<8)+255) |
|
385 | 480 | #define PP0 ((15<<8)+0) |
|
386 | 481 | #define PP1 ((15<<8)+1) |
|
387 | 482 | #define PP2 ((15<<8)+2) |
|
388 | 483 | #define PP3 ((15<<8)+3) |
|
389 | 484 | #define PP4 ((15<<8)+4) |
|
390 | 485 | #define PP5 ((15<<8)+5) |
|
391 | 486 | #define PP6 ((15<<8)+6) |
|
392 | 487 | #define PP7 ((15<<8)+7) |
|
393 | 488 | #define PP8 ((15<<8)+8) |
|
394 | 489 | #define PP9 ((15<<8)+9) |
|
395 | 490 | #define PP10 ((15<<8)+10) |
|
396 | 491 | #define PP11 ((15<<8)+11) |
|
397 | 492 | #define PP12 ((15<<8)+12) |
|
398 | 493 | #define PP13 ((15<<8)+13) |
|
399 | 494 | #define PP14 ((15<<8)+14) |
|
400 | 495 | #define PP15 ((15<<8)+15) |
|
401 | 496 | #define PPX ((15<<8)+255) |
|
402 | 497 | #define PQ0 ((16<<8)+0) |
|
403 | 498 | #define PQ1 ((16<<8)+1) |
|
404 | 499 | #define PQ2 ((16<<8)+2) |
|
405 | 500 | #define PQ3 ((16<<8)+3) |
|
406 | 501 | #define PQ4 ((16<<8)+4) |
|
407 | 502 | #define PQ5 ((16<<8)+5) |
|
408 | 503 | #define PQ6 ((16<<8)+6) |
|
409 | 504 | #define PQ7 ((16<<8)+7) |
|
410 | 505 | #define PQ8 ((16<<8)+8) |
|
411 | 506 | #define PQ9 ((16<<8)+9) |
|
412 | 507 | #define PQ10 ((16<<8)+10) |
|
413 | 508 | #define PQ11 ((16<<8)+11) |
|
414 | 509 | #define PQ12 ((16<<8)+12) |
|
415 | 510 | #define PQ13 ((16<<8)+13) |
|
416 | 511 | #define PQ14 ((16<<8)+14) |
|
417 | 512 | #define PQ15 ((16<<8)+15) |
|
418 | 513 | #define PQX ((16<<8)+255) |
|
419 | 514 | #define PR0 ((17<<8)+0) |
|
420 | 515 | #define PR1 ((17<<8)+1) |
|
421 | 516 | #define PR2 ((17<<8)+2) |
|
422 | 517 | #define PR3 ((17<<8)+3) |
|
423 | 518 | #define PR4 ((17<<8)+4) |
|
424 | 519 | #define PR5 ((17<<8)+5) |
|
425 | 520 | #define PR6 ((17<<8)+6) |
|
426 | 521 | #define PR7 ((17<<8)+7) |
|
427 | 522 | #define PR8 ((17<<8)+8) |
|
428 | 523 | #define PR9 ((17<<8)+9) |
|
429 | 524 | #define PR10 ((17<<8)+10) |
|
430 | 525 | #define PR11 ((17<<8)+11) |
|
431 | 526 | #define PR12 ((17<<8)+12) |
|
432 | 527 | #define PR13 ((17<<8)+13) |
|
433 | 528 | #define PR14 ((17<<8)+14) |
|
434 | 529 | #define PR15 ((17<<8)+15) |
|
435 | 530 | #define PRX ((17<<8)+255) |
|
436 | 531 | #define PS0 ((18<<8)+0) |
|
437 | 532 | #define PS1 ((18<<8)+1) |
|
438 | 533 | #define PS2 ((18<<8)+2) |
|
439 | 534 | #define PS3 ((18<<8)+3) |
|
440 | 535 | #define PS4 ((18<<8)+4) |
|
441 | 536 | #define PS5 ((18<<8)+5) |
|
442 | 537 | #define PS6 ((18<<8)+6) |
|
443 | 538 | #define PS7 ((18<<8)+7) |
|
444 | 539 | #define PS8 ((18<<8)+8) |
|
445 | 540 | #define PS9 ((18<<8)+9) |
|
446 | 541 | #define PS10 ((18<<8)+10) |
|
447 | 542 | #define PS11 ((18<<8)+11) |
|
448 | 543 | #define PS12 ((18<<8)+12) |
|
449 | 544 | #define PS13 ((18<<8)+13) |
|
450 | 545 | #define PS14 ((18<<8)+14) |
|
451 | 546 | #define PS15 ((18<<8)+15) |
|
452 | 547 | #define PSX ((18<<8)+255) |
|
453 | 548 | #define PT0 ((19<<8)+0) |
|
454 | 549 | #define PT1 ((19<<8)+1) |
|
455 | 550 | #define PT2 ((19<<8)+2) |
|
456 | 551 | #define PT3 ((19<<8)+3) |
|
457 | 552 | #define PT4 ((19<<8)+4) |
|
458 | 553 | #define PT5 ((19<<8)+5) |
|
459 | 554 | #define PT6 ((19<<8)+6) |
|
460 | 555 | #define PT7 ((19<<8)+7) |
|
461 | 556 | #define PT8 ((19<<8)+8) |
|
462 | 557 | #define PT9 ((19<<8)+9) |
|
463 | 558 | #define PT10 ((19<<8)+10) |
|
464 | 559 | #define PT11 ((19<<8)+11) |
|
465 | 560 | #define PT12 ((19<<8)+12) |
|
466 | 561 | #define PT13 ((19<<8)+13) |
|
467 | 562 | #define PT14 ((19<<8)+14) |
|
468 | 563 | #define PT15 ((19<<8)+15) |
|
469 | 564 | #define PTX ((19<<8)+255) |
|
470 | 565 | #define PU0 ((20<<8)+0) |
|
471 | 566 | #define PU1 ((20<<8)+1) |
|
472 | 567 | #define PU2 ((20<<8)+2) |
|
473 | 568 | #define PU3 ((20<<8)+3) |
|
474 | 569 | #define PU4 ((20<<8)+4) |
|
475 | 570 | #define PU5 ((20<<8)+5) |
|
476 | 571 | #define PU6 ((20<<8)+6) |
|
477 | 572 | #define PU7 ((20<<8)+7) |
|
478 | 573 | #define PU8 ((20<<8)+8) |
|
479 | 574 | #define PU9 ((20<<8)+9) |
|
480 | 575 | #define PU10 ((20<<8)+10) |
|
481 | 576 | #define PU11 ((20<<8)+11) |
|
482 | 577 | #define PU12 ((20<<8)+12) |
|
483 | 578 | #define PU13 ((20<<8)+13) |
|
484 | 579 | #define PU14 ((20<<8)+14) |
|
485 | 580 | #define PU15 ((20<<8)+15) |
|
486 | 581 | #define PUX ((20<<8)+255) |
|
487 | 582 | #define PV0 ((21<<8)+0) |
|
488 | 583 | #define PV1 ((21<<8)+1) |
|
489 | 584 | #define PV2 ((21<<8)+2) |
|
490 | 585 | #define PV3 ((21<<8)+3) |
|
491 | 586 | #define PV4 ((21<<8)+4) |
|
492 | 587 | #define PV5 ((21<<8)+5) |
|
493 | 588 | #define PV6 ((21<<8)+6) |
|
494 | 589 | #define PV7 ((21<<8)+7) |
|
495 | 590 | #define PV8 ((21<<8)+8) |
|
496 | 591 | #define PV9 ((21<<8)+9) |
|
497 | 592 | #define PV10 ((21<<8)+10) |
|
498 | 593 | #define PV11 ((21<<8)+11) |
|
499 | 594 | #define PV12 ((21<<8)+12) |
|
500 | 595 | #define PV13 ((21<<8)+13) |
|
501 | 596 | #define PV14 ((21<<8)+14) |
|
502 | 597 | #define PV15 ((21<<8)+15) |
|
503 | 598 | #define PVX ((21<<8)+255) |
|
504 | 599 | #define PW0 ((22<<8)+0) |
|
505 | 600 | #define PW1 ((22<<8)+1) |
|
506 | 601 | #define PW2 ((22<<8)+2) |
|
507 | 602 | #define PW3 ((22<<8)+3) |
|
508 | 603 | #define PW4 ((22<<8)+4) |
|
509 | 604 | #define PW5 ((22<<8)+5) |
|
510 | 605 | #define PW6 ((22<<8)+6) |
|
511 | 606 | #define PW7 ((22<<8)+7) |
|
512 | 607 | #define PW8 ((22<<8)+8) |
|
513 | 608 | #define PW9 ((22<<8)+9) |
|
514 | 609 | #define PW10 ((22<<8)+10) |
|
515 | 610 | #define PW11 ((22<<8)+11) |
|
516 | 611 | #define PW12 ((22<<8)+12) |
|
517 | 612 | #define PW13 ((22<<8)+13) |
|
518 | 613 | #define PW14 ((22<<8)+14) |
|
519 | 614 | #define PW15 ((22<<8)+15) |
|
520 | 615 | #define PWX ((22<<8)+255) |
|
521 | 616 | #define PX0 ((23<<8)+0) |
|
522 | 617 | #define PX1 ((23<<8)+1) |
|
523 | 618 | #define PX2 ((23<<8)+2) |
|
524 | 619 | #define PX3 ((23<<8)+3) |
|
525 | 620 | #define PX4 ((23<<8)+4) |
|
526 | 621 | #define PX5 ((23<<8)+5) |
|
527 | 622 | #define PX6 ((23<<8)+6) |
|
528 | 623 | #define PX7 ((23<<8)+7) |
|
529 | 624 | #define PX8 ((23<<8)+8) |
|
530 | 625 | #define PX9 ((23<<8)+9) |
|
531 | 626 | #define PX10 ((23<<8)+10) |
|
532 | 627 | #define PX11 ((23<<8)+11) |
|
533 | 628 | #define PX12 ((23<<8)+12) |
|
534 | 629 | #define PX13 ((23<<8)+13) |
|
535 | 630 | #define PX14 ((23<<8)+14) |
|
536 | 631 | #define PX15 ((23<<8)+15) |
|
537 | 632 | #define PXX ((23<<8)+255) |
|
538 | 633 | #define PY0 ((24<<8)+0) |
|
539 | 634 | #define PY1 ((24<<8)+1) |
|
540 | 635 | #define PY2 ((24<<8)+2) |
|
541 | 636 | #define PY3 ((24<<8)+3) |
|
542 | 637 | #define PY4 ((24<<8)+4) |
|
543 | 638 | #define PY5 ((24<<8)+5) |
|
544 | 639 | #define PY6 ((24<<8)+6) |
|
545 | 640 | #define PY7 ((24<<8)+7) |
|
546 | 641 | #define PY8 ((24<<8)+8) |
|
547 | 642 | #define PY9 ((24<<8)+9) |
|
548 | 643 | #define PY10 ((24<<8)+10) |
|
549 | 644 | #define PY11 ((24<<8)+11) |
|
550 | 645 | #define PY12 ((24<<8)+12) |
|
551 | 646 | #define PY13 ((24<<8)+13) |
|
552 | 647 | #define PY14 ((24<<8)+14) |
|
553 | 648 | #define PY15 ((24<<8)+15) |
|
554 | 649 | #define PYX ((24<<8)+255) |
|
555 | 650 | #define PZ0 ((25<<8)+0) |
|
556 | 651 | #define PZ1 ((25<<8)+1) |
|
557 | 652 | #define PZ2 ((25<<8)+2) |
|
558 | 653 | #define PZ3 ((25<<8)+3) |
|
559 | 654 | #define PZ4 ((25<<8)+4) |
|
560 | 655 | #define PZ5 ((25<<8)+5) |
|
561 | 656 | #define PZ6 ((25<<8)+6) |
|
562 | 657 | #define PZ7 ((25<<8)+7) |
|
563 | 658 | #define PZ8 ((25<<8)+8) |
|
564 | 659 | #define PZ9 ((25<<8)+9) |
|
565 | 660 | #define PZ10 ((25<<8)+10) |
|
566 | 661 | #define PZ11 ((25<<8)+11) |
|
567 | 662 | #define PZ12 ((25<<8)+12) |
|
568 | 663 | #define PZ13 ((25<<8)+13) |
|
569 | 664 | #define PZ14 ((25<<8)+14) |
|
570 | 665 | #define PZ15 ((25<<8)+15) |
|
571 | 666 | #define PZX ((25<<8)+255) |
|
572 | 667 | |
|
573 | 668 | #endif |
|
574 | 669 | |
|
575 | 670 | #ifdef __cplusplus |
|
576 | 671 | } |
|
577 | 672 | #endif |
|
578 | 673 | #endif //GPIO_H |
|
579 | 674 | |
|
580 | 675 | |
|
581 | 676 | |
|
582 | 677 | |
|
583 | 678 | |
|
584 | 679 | |
|
585 | 680 | |
|
586 | 681 | |
|
587 | 682 | |
|
588 | 683 | |
|
589 | 684 | |
|
590 | 685 |
@@ -1,319 +1,310 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 2 | -- This file is a part of the libuc, microcontroler library |
|
3 | 3 | -- Copyright (C) 2012, Alexis Jeandet |
|
4 | 4 | -- |
|
5 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 3 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
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 | 19 | -- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@gmail.com |
|
21 | 21 | -------------------------------------------------------------------------------*/ |
|
22 | 22 | /*! \file uart.h |
|
23 | 23 | \brief UART api. |
|
24 | 24 | |
|
25 | 25 | The uart api gives you a standard way to drive any uart on any processor. |
|
26 | 26 | With this api you will be able to open and configure your UART define the |
|
27 | 27 | associated pins when applicable and read/write on it. Note that depending |
|
28 | 28 | on the target architecture you can have soft or hard UART. |
|
29 | 29 | |
|
30 | 30 | A simple example to read or writes on uart1. |
|
31 | 31 | \code |
|
32 | 32 | // lets open uart1 |
|
33 | 33 | //config : |
|
34 | 34 | // -parity = No |
|
35 | 35 | // -data bits = 8 |
|
36 | 36 | // -stop bits = 1 |
|
37 | 37 | // -speed = 115200 bauds |
|
38 | 38 | // -TX = PA9 |
|
39 | 39 | // -RX = PA10 |
|
40 | 40 | // -CTS = unused (-1) |
|
41 | 41 | // -RTS = unused (-1) |
|
42 | 42 | uart_t uart = uartopenandconfig(uart1,uartparitynone | uart8bits | uartonestop,115200,PA9,PA10,-1,-1); |
|
43 | 43 | //check that everything is ok |
|
44 | 44 | if(uart==uart1) |
|
45 | 45 | { |
|
46 | 46 | //to write 0xFF on uart1 |
|
47 | 47 | uartputc(uart,0xFF); |
|
48 | 48 | //you can also send a string on uart1 |
|
49 | 49 | char* buffer="hello"; |
|
50 | 50 | uartputs(uart,buffer); |
|
51 | 51 | //to read a char |
|
52 | 52 | char result = uartgetc(uart); |
|
53 | 53 | } |
|
54 | 54 | |
|
55 | 55 | \endcode |
|
56 | 56 | |
|
57 | 57 | */ |
|
58 | 58 | |
|
59 | 59 | #ifndef UART_H |
|
60 | 60 | #define UART_H |
|
61 | 61 | #include <streamdevices.h> |
|
62 | 62 | |
|
63 | 63 | #ifdef __cplusplus |
|
64 | 64 | extern "C" { |
|
65 | 65 | #endif |
|
66 | 66 | |
|
67 | /* | |
|
68 | typedef volatile struct uart_t | |
|
69 | { | |
|
70 | volatile void* _dev; | |
|
71 | volatile int cfg; | |
|
72 | volatile int speed; | |
|
73 | }uart_t; | |
|
74 | */ | |
|
75 | ||
|
76 | 67 | /** |
|
77 | 68 | * @brief uart handle |
|
78 | 69 | * |
|
79 | 70 | * uart_t is the handle type you will use for all uart related functions. |
|
80 | 71 | */ |
|
81 | 72 | typedef int uart_t; |
|
82 | 73 | |
|
83 | 74 | #define uart1 0 ///< uart1 |
|
84 | 75 | #define uart2 1 ///< uart2 |
|
85 | 76 | #define uart3 2 ///< uart3 |
|
86 | 77 | #define uart4 3 ///< uart4 |
|
87 | 78 | #define uart5 4 ///< uart5 |
|
88 | 79 | #define uart6 5 ///< uart6 |
|
89 | 80 | #define uart7 6 ///< uart7 |
|
90 | 81 | #define uart8 7 ///< uart8 |
|
91 | 82 | #define uart9 8 ///< uart9 |
|
92 | 83 | |
|
93 | 84 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
|
94 | 85 | #define UARTPARITYMASK 0x3 |
|
95 | 86 | #define UARTBITSMASK 0xC |
|
96 | 87 | #define UARTSTOPBITSMASK 0x70 |
|
97 | 88 | #endif |
|
98 | 89 | |
|
99 | 90 | /** |
|
100 | 91 | * @brief Uart parity enum |
|
101 | 92 | * |
|
102 | 93 | * Use uartparity_t values to configure the parity of your UART port with |
|
103 | 94 | * uartsetparity function or uartsetconfig. Don't try to use numerical values |
|
104 | 95 | * directly! |
|
105 | 96 | */ |
|
106 | 97 | typedef enum uartparity_t |
|
107 | 98 | { |
|
108 | 99 | uartparitynone = 0x1, /**< No parity */ |
|
109 | 100 | uartparityeven = 0x2, /**< Even parity */ |
|
110 | 101 | uartparityodd = 0x3 /**< Odd parity */ |
|
111 | 102 | }uartparity_t; |
|
112 | 103 | |
|
113 | 104 | /** |
|
114 | 105 | * @brief Uart data bits enum |
|
115 | 106 | * |
|
116 | 107 | * Use uartbits_t values to configure the number of data bits of your UART port with |
|
117 | 108 | * uartsetdatabits function or uartsetconfig. Don't try to use numerical values |
|
118 | 109 | * directly! |
|
119 | 110 | */ |
|
120 | 111 | typedef enum uartbits_t |
|
121 | 112 | { |
|
122 | 113 | uart7bits = 0x4, /**< 7 data bits communication */ |
|
123 | 114 | uart8bits = 0x8, /**< 8 data bits communication */ |
|
124 | 115 | uart9bits = 0xC /**< 9 data bits communication */ |
|
125 | 116 | }uartbits_t; |
|
126 | 117 | |
|
127 | 118 | /** |
|
128 | 119 | * @brief Uart stop bits enum |
|
129 | 120 | * |
|
130 | 121 | * Use uartstopbits_t values to configure the number of stop bits of your UART port with |
|
131 | 122 | * uartsetstopbits function or uartsetconfig. Don't try to use numerical values |
|
132 | 123 | * directly! |
|
133 | 124 | */ |
|
134 | 125 | typedef enum uartstopbits_t |
|
135 | 126 | { |
|
136 | 127 | uarthalfstop = 0x10, /**< 0.5 stop bits communication */ |
|
137 | 128 | uartonestop = 0x20, /**< 1 stop bits communication */ |
|
138 | 129 | uartonehalfstop = 0x30, /**< 1.5 stop bits communication */ |
|
139 | 130 | uarttwostop = 0x40 /**< 2 stop bits communication */ |
|
140 | 131 | }uartstopbits_t; |
|
141 | 132 | |
|
142 | 133 | |
|
143 | 134 | |
|
144 | 135 | /** |
|
145 | 136 | * @brief Uart open function |
|
146 | 137 | * |
|
147 | 138 | * This function opens the given uart, it should turn it ON iff needed and enable it. |
|
148 | 139 | * @param count The uart identifier uart1 for example |
|
149 | 140 | * @return The uart identifier on success or -1 if it fails. |
|
150 | 141 | */ |
|
151 | 142 | extern uart_t uartopen(int count); |
|
152 | 143 | /** |
|
153 | 144 | * @brief Uart open and configure function |
|
154 | 145 | * |
|
155 | 146 | * This function call uartopen and configure the UART with the given parameters. |
|
156 | 147 | * @param count The uart identifier uart1 for example |
|
157 | 148 | * @param cfg The configuration of the UART, build from an or mask. |
|
158 | 149 | * @param speed The target speed of the UART in bauds, the real speed depend on the implementation |
|
159 | 150 | * and the target. |
|
160 | 151 | * @param TXpin The TXpin look gpio api. |
|
161 | 152 | * @param RXpin The RXpin look gpio api. |
|
162 | 153 | * @param RTSpin The RTSpin look gpio api. |
|
163 | 154 | * @param CTSpin The CTSpin look gpio api. |
|
164 | 155 | * @return The uart identifier on success or -1 if it fails. |
|
165 | 156 | * @sa uartclose(uart_t uart), uartopenandconfig(int count ,uint32_t cfg,uint32_t speed,uint32_t TXpin,uint32_t RXpin,uint32_t RTSpin,uint32_t CTSpin), uartsetconfig(uart_t uart,uint32_t cfg,uint32_t speed) |
|
166 | 157 | */ |
|
167 | 158 | extern uart_t uartopenandconfig(int count ,uint32_t cfg,uint32_t speed,uint32_t TXpin,uint32_t RXpin,uint32_t RTSpin,uint32_t CTSpin); |
|
168 | 159 | /** |
|
169 | 160 | * @brief Uart close function |
|
170 | 161 | * |
|
171 | 162 | * This function should at least reset the UART configuration. |
|
172 | 163 | * @param uart The uart identifier uart1 for example. |
|
173 | 164 | * @return 1 on success or -1 on error. |
|
174 | 165 | */ |
|
175 | 166 | extern int uartclose(uart_t uart); |
|
176 | 167 | /** |
|
177 | 168 | * @brief uart set pins function |
|
178 | 169 | * |
|
179 | 170 | * This function sets the Uart pins, you have to check for each target that the pins you selected |
|
180 | 171 | * are compatible with the desired function. |
|
181 | 172 | * @param uart The uart identifier uart1 for example. |
|
182 | 173 | * @param TXpin The TXpin look gpio api. |
|
183 | 174 | * @param RXpin The RXpin look gpio api. |
|
184 | 175 | * @param RTSpin The RTSpin look gpio api. |
|
185 | 176 | * @param CTSpin The CTSpin look gpio api. |
|
186 | 177 | * @return 1 on success or -1 on error. |
|
187 | 178 | * @sa uartopen(int count) |
|
188 | 179 | */ |
|
189 | 180 | extern int uartsetpins(uart_t uart,uint32_t TXpin,uint32_t RXpin,uint32_t RTSpin,uint32_t CTSpin); |
|
190 | 181 | /** |
|
191 | 182 | * @brief Enable uart functionnable |
|
192 | 183 | * |
|
193 | 184 | *This function enables given uart, it makes sens on target where you can enable or disable |
|
194 | 185 | *the uart. |
|
195 | 186 | * @param uart The uart identifier uart1 for example. |
|
196 | 187 | * @return 1 on success or -1 on error. |
|
197 | 188 | * @sa uartenable(uart_t uart) |
|
198 | 189 | */ |
|
199 | 190 | extern int uartenable(uart_t uart); |
|
200 | 191 | /** |
|
201 | 192 | * @brief Disable uart function |
|
202 | 193 | * |
|
203 | 194 | *This function disables given uart, it makes sens on target where you can enable or disable |
|
204 | 195 | *the uart. |
|
205 | 196 | * @param uart The uart identifier uart1 for example. |
|
206 | 197 | * @return 1 on success or -1 on error. |
|
207 | 198 | */ |
|
208 | 199 | extern int uartdisable(uart_t uart); |
|
209 | 200 | /** |
|
210 | 201 | * @brief uart set configuration function |
|
211 | 202 | * |
|
212 | 203 | * This function configure the given uart. |
|
213 | 204 | * @param uart The uart identifier uart1 for example. |
|
214 | 205 | * @param cfg |
|
215 | 206 | * @param speed |
|
216 | 207 | * @return |
|
217 | 208 | */ |
|
218 | 209 | extern int uartsetconfig(uart_t uart,uint32_t cfg,uint32_t speed); |
|
219 | 210 | /** |
|
220 | 211 | * @brief uartsetspeed |
|
221 | 212 | * @param uart The uart identifier uart1 for example. |
|
222 | 213 | * @param speed |
|
223 | 214 | * @return |
|
224 | 215 | */ |
|
225 | 216 | extern int uartsetspeed(uart_t uart,uint32_t speed); |
|
226 | 217 | /** |
|
227 | 218 | * @brief uartsetparity |
|
228 | 219 | * @param uart The uart identifier uart1 for example. |
|
229 | 220 | * @param parity |
|
230 | 221 | * @return |
|
231 | 222 | */ |
|
232 | 223 | extern int uartsetparity(uart_t uart,uartparity_t parity); |
|
233 | 224 | /** |
|
234 | 225 | * @brief uartsetdatabits |
|
235 | 226 | * @param uart The uart identifier uart1 for example. |
|
236 | 227 | * @param databits |
|
237 | 228 | * @return |
|
238 | 229 | */ |
|
239 | 230 | extern int uartsetdatabits(uart_t uart,uartbits_t databits); |
|
240 | 231 | /** |
|
241 | 232 | * @brief uartsetstopbits |
|
242 | 233 | * @param uart The uart identifier uart1 for example. |
|
243 | 234 | * @param stopbits |
|
244 | 235 | * @return |
|
245 | 236 | */ |
|
246 | 237 | extern int uartsetstopbits(uart_t uart,uartstopbits_t stopbits); |
|
247 | 238 | /** |
|
248 | 239 | * @brief uartputc |
|
249 | 240 | * @param uart The uart identifier uart1 for example. |
|
250 | 241 | * @param c |
|
251 | 242 | * @return |
|
252 | 243 | */ |
|
253 | 244 | extern int uartputc(uart_t uart,char c); |
|
254 | 245 | /** |
|
255 | 246 | * @brief uartgetc |
|
256 | 247 | * @param uart The uart identifier uart1 for example. |
|
257 | 248 | * @return |
|
258 | 249 | */ |
|
259 | 250 | extern char uartgetc(uart_t uart); |
|
260 | 251 | /** |
|
261 | 252 | * @brief uartputs |
|
262 | 253 | * @param uart The uart identifier uart1 for example. |
|
263 | 254 | * @param s |
|
264 | 255 | * @return |
|
265 | 256 | */ |
|
266 | 257 | extern int uartputs(uart_t uart,char* s); |
|
267 | 258 | /** |
|
268 | 259 | * @brief uartgets |
|
269 | 260 | * @param uart The uart identifier uart1 for example. |
|
270 | 261 | * @param s |
|
271 | 262 | * @return |
|
272 | 263 | */ |
|
273 | 264 | extern int uartgets(uart_t uart,char* s); |
|
274 | 265 | /** |
|
275 | 266 | * @brief uartputnc |
|
276 | 267 | * @param uart The uart identifier uart1 for example. |
|
277 | 268 | * @param c |
|
278 | 269 | * @param n |
|
279 | 270 | * @return |
|
280 | 271 | */ |
|
281 | 272 | extern int uartputnc(uart_t uart,char* c,int n); |
|
282 | 273 | /** |
|
283 | 274 | * @brief uartgetnc |
|
284 | 275 | * @param uart The uart identifier uart1 for example. |
|
285 | 276 | * @param c |
|
286 | 277 | * @param n |
|
287 | 278 | * @return |
|
288 | 279 | */ |
|
289 | 280 | extern int uartgetnc(uart_t uart,char* c,int n); |
|
290 | 281 | /** |
|
291 | 282 | * @brief uartavailiabledata |
|
292 | 283 | * @param uart The uart identifier uart1 for example. |
|
293 | 284 | * @return |
|
294 | 285 | */ |
|
295 | 286 | extern int uartavailiabledata(uart_t uart); |
|
296 | 287 | /** |
|
297 | 288 | * @brief uartmkstreamdev |
|
298 | 289 | * @param uart The uart identifier uart1 for example. |
|
299 | 290 | * @param strdev |
|
300 | 291 | * @return |
|
301 | 292 | */ |
|
302 | 293 | extern int uartmkstreamdev(uart_t uart,streamdevice* strdev); |
|
303 | 294 | |
|
304 | 295 | #ifdef __cplusplus |
|
305 | 296 | } |
|
306 | 297 | #endif |
|
307 | 298 | #endif //SPI_H |
|
308 | 299 | |
|
309 | 300 | |
|
310 | 301 | |
|
311 | 302 | |
|
312 | 303 | |
|
313 | 304 | |
|
314 | 305 | |
|
315 | 306 | |
|
316 | 307 | |
|
317 | 308 | |
|
318 | 309 | |
|
319 | 310 |
General Comments 0
You need to be logged in to leave comments.
Login now