diff --git a/include/GRAPHIC/CONTROLERS/ili9328.h b/include/GRAPHIC/CONTROLERS/ili9328.h --- a/include/GRAPHIC/CONTROLERS/ili9328.h +++ b/include/GRAPHIC/CONTROLERS/ili9328.h @@ -22,8 +22,19 @@ #ifndef ILI9328_H #define ILI9328_H +/** + @todo Make an abstract layer for framebuffer devices and a painting api for it. +*/ + + #include +/** + * @brief ili9328init + * @param LCD + * @return + */ + extern int ili9328init(struct LCD_t* LCD); extern void ili9328setFrame(LCD_t* LCD,uint16_t X,uint16_t Y,uint16_t W,uint16_t H); extern void ili9328setGRAMaddress(LCD_t* LCD,uint16_t Haddress,uint16_t Vaddress); diff --git a/include/PERIPHERALS/gpio.h b/include/PERIPHERALS/gpio.h --- a/include/PERIPHERALS/gpio.h +++ b/include/PERIPHERALS/gpio.h @@ -1,4 +1,4 @@ -/*------------------------------------------------------------------------------ +/** ------------------------------------------------------------------------------ -- This file is a part of the libuc, microcontroler library -- Copyright (C) 2012, Alexis Jeandet -- @@ -16,8 +16,8 @@ -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ------------------------------------------------------------------------------- --- Author : Alexis Jeandet --- Mail : alexis.jeandet@gmail.com +-- @Author : Alexis Jeandet +-- @Mail : alexis.jeandet@gmail.com -------------------------------------------------------------------------------*/ /*! \file gpio.h @@ -51,38 +51,77 @@ A simple example to drive PA0 and read P extern "C" { #endif - + /** + * @brief gpio handle + * + *gpio_t is the handle type you will use for all + *gpio related functions. + */ typedef uint32_t gpio_t; + + /** + * @brief GPIO speed enum + * + * Use gpiospeed_t values to configure the speed of your GPIO pin with + * gpiosetspeed(gpio_t* gpio,gpiospeed_t speed) function or gpiosetconfig(gpio_t* gpio). + * The speed values are realy platform dependant check for each target if you whant to + * know the meaning of each speed. + * Don't try to use numerical values directly! + * @sa gpiosetspeed(gpio_t* gpio,gpiospeed_t speed),gpiosetconfig(gpio_t* gpio) + */ typedef enum gpiospeed_t { - gpiolowspeed = 0x00000, - gpiomediumspeed = 0x10000, - gpiofastspeed = 0x20000, - gpiohighspeed = 0x30000 + gpiolowspeed = 0x00000, /**< Lowest speed value*/ + gpiomediumspeed = 0x10000, /**< Normal or medium speed value*/ + gpiofastspeed = 0x20000, /**< Higher speed value*/ + gpiohighspeed = 0x30000 /**< Highest speed value*/ }gpiospeed_t; + /** + * @brief GPIO direction enum + * + * Use gpiodir_t values to configure the direction of your GPIO pin with + * gpiosetdir(gpio_t* gpio,gpiodir_t dir) function or gpiosetconfig(gpio_t* gpio). + * Don't try to use numerical values directly! + * @sa gpiosetdir(gpio_t* gpio,gpiodir_t dir),gpiosetconfig(gpio_t* gpio) + */ typedef enum gpiodir_t { - gpioindir = 0x00000, - gpiooutdir = 0x40000, - gpioaf = 0x80000, - gpioan = 0xC0000 + gpioindir = 0x00000, /**< Input direction*/ + gpiooutdir = 0x40000, /**< Output direction*/ + gpioaf = 0x80000, /**< Alternate function such as spi, uart, ...*/ + gpioan = 0xC0000 /**< Configure the pin for analogic mode*/ }gpiodir_t; - + /** + * @brief GPIO output type enum + * + * Use gpioouttype_t values to configure the kind of output you want with + * gpiosetouttype(gpio_t* gpio, gpioouttype_t outtype) function or gpiosetconfig(gpio_t* gpio). + * Don't try to use numerical values directly! + * @sa gpiosetouttype(gpio_t* gpio, gpioouttype_t outtype),gpiosetconfig(gpio_t* gpio) + */ typedef enum gpioouttype_t { - gpiopushpulltype = 0x000000, - gpioopendraintype = 0x100000 + gpiopushpulltype = 0x000000, /**< Pushpull output*/ + gpioopendraintype = 0x100000 /**< Open drain output*/ }gpioouttype_t; + /** + * @brief GPIO pull resistor configuration enum + * + * Use gpiopulltype_t values to configure the pull resistor of your GPIO pin with + * gpiosetpulltype(gpio_t* gpio,gpiopulltype_t pulltype) function or gpiosetconfig(gpio_t* gpio). + * Don't try to use numerical values directly! + * @sa gpiosetpulltype(gpio_t* gpio,gpiopulltype_t pulltype),gpiosetconfig(gpio_t* gpio) + */ typedef enum gpiopulltype_t { gpionopulltype = 0x000000, @@ -97,17 +136,73 @@ typedef enum gpiopulltype_t #define GPIOPULLTYPEMASK 0x600000 #endif - + /** + * @brief gpioopen + * @param gpio + * @return + * @sa gpioclose(gpio_t gpio) + */ extern gpio_t gpioopen(uint32_t gpio); +/** + * @brief gpioclose + * @param gpio + * @sa gpioopen(uint32_t gpio) + */ extern void gpioclose(gpio_t gpio); +/** + * @brief gpiosetconfig + * @param gpio + */ extern void gpiosetconfig(gpio_t* gpio); +/** + * @brief gpiosetdir + * @param gpio + * @param dir + */ extern void gpiosetdir(gpio_t* gpio,gpiodir_t dir); +/** + * @brief gpiosetouttype + * @param gpio + * @param outtype + * @sa gpiosetconfig(gpio_t* gpio) + */ extern void gpiosetouttype(gpio_t* gpio, gpioouttype_t outtype); +/** + * @brief gpiosetpulltype + * @param gpio + * @param pulltype + * @sa gpiosetconfig(gpio_t* gpio) + */ extern void gpiosetpulltype(gpio_t* gpio,gpiopulltype_t pulltype); +/** + * @brief gpiosetspeed + * @param gpio + * @param speed + * @sa gpiosetconfig(gpio_t* gpio) + */ extern void gpiosetspeed(gpio_t* gpio,gpiospeed_t speed); +/** + * @brief gpioset + * @param gpio + * @sa gpiosetconfig(gpio_t* gpio) + */ extern void gpioset(gpio_t gpio); +/** + * @brief gpioclr + * @param gpio + */ extern void gpioclr(gpio_t gpio); +/** + * @brief gpiosetval + * @param gpio + * @param val + */ extern void gpiosetval(gpio_t gpio,int val); +/** + * @brief gpiogetval + * @param gpio + * @return + */ extern int gpiogetval(gpio_t gpio); #define GPIOISINPUT(gpio) (((gpio) & GPIODIRMASK)==gpioindir) diff --git a/include/PERIPHERALS/uart.h b/include/PERIPHERALS/uart.h --- a/include/PERIPHERALS/uart.h +++ b/include/PERIPHERALS/uart.h @@ -64,15 +64,6 @@ A simple example to read or writes on ua extern "C" { #endif -/* -typedef volatile struct uart_t -{ - volatile void* _dev; - volatile int cfg; - volatile int speed; -}uart_t; - */ - /** * @brief uart handle *