|
|
/*------------------------------------------------------------------------------
|
|
|
-- This file is a part of the libuc, microcontroler library
|
|
|
-- Copyright (C) 2012, Alexis Jeandet
|
|
|
--
|
|
|
-- This program is free software; you can redistribute it and/or modify
|
|
|
-- it under the terms of the GNU General Public License as published by
|
|
|
-- the Free Software Foundation; either version 3 of the License, or
|
|
|
-- (at your option) any later version.
|
|
|
--
|
|
|
-- This program is distributed in the hope that it will be useful,
|
|
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
-- GNU General Public License for more details.
|
|
|
--
|
|
|
-- You should have received a copy of the GNU General Public License
|
|
|
-- 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@member.fsf.org
|
|
|
-------------------------------------------------------------------------------*/
|
|
|
#include <gpio.h>
|
|
|
|
|
|
|
|
|
|
|
|
gpio_t gpioopen(uint32_t gpio)
|
|
|
{
|
|
|
gpio &= -1^GPIOSPEEDMASK;
|
|
|
gpio |= gpiolowspeed;
|
|
|
gpio &= -1^GPIODIRMASK;
|
|
|
gpio |= gpioindir;
|
|
|
gpio &= -1^GPIOOUTTYPEMASK;
|
|
|
gpio |= gpiopushpulltype;
|
|
|
gpio &= -1^GPIOPULLTYPEMASK;
|
|
|
gpio |= gpionopulltype;
|
|
|
return gpio;
|
|
|
}
|
|
|
|
|
|
|
|
|
void gpioclose(gpio_t gpio)
|
|
|
{
|
|
|
}
|
|
|
|
|
|
void gpiosetconfig(gpio_t* gpio)
|
|
|
{
|
|
|
gpiosetdir(gpio, (*gpio & GPIODIRMASK));
|
|
|
gpiosetspeed(gpio, (*gpio & GPIOSPEEDMASK));
|
|
|
gpiosetouttype(gpio, (*gpio & GPIOOUTTYPEMASK));
|
|
|
gpiosetpulltype(gpio, (*gpio & GPIOPULLTYPEMASK));
|
|
|
}
|
|
|
|
|
|
extern void gpiosetspeed(gpio_t* gpio,gpiospeed_t speed)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
void gpiosetdir(gpio_t* gpio,gpiodir_t dir)
|
|
|
{
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
void gpiosetouttype(gpio_t* gpio, gpioouttype_t outtype)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
void gpiosetpulltype(gpio_t* gpio,gpiopulltype_t pulltype)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
void gpioset(gpio_t gpio)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
void gpioclr(gpio_t gpio)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
void gpiosetval(gpio_t gpio,int val)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
int gpiogetval(gpio_t gpio)
|
|
|
{
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|