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