Files
ls1x-master-v0.4/private/ls1c102/1c102_myGPIO.c
2025-01-15 10:57:40 +08:00

43 lines
925 B
C

#include "ls1x.h"
#include "Config.h"
#include "UserGpio.h"
#include "ls1x_gpio.h"
#include "1c102_myGPIO.h"
/*
*
*/
void Set_gpio_value(unsigned char GPIOx, unsigned char mode, unsigned char value)
{
unsigned char data = 0;
assert_param(IS_GPIO_PIN(GPIOx));
if(mode)
{
data = (mode<<1) | value;
PMU_GPIOBit(GPIOx) = data;
}
return;
}
void remap_gpio(unsigned char gpio_NO, GPIOFunc_TypeDef gpio_fun)
{
switch(gpio_NO/16)
{
case 0:
AFIO_RemapConfig(AFIOA, 0x1<<(gpio_NO%16), gpio_fun);
break;
case 1:
AFIO_RemapConfig(AFIOB, 0x1<<(gpio_NO%16), gpio_fun);
break;
case 2:
AFIO_RemapConfig(AFIOC, 0x1<<(gpio_NO%16), gpio_fun);
break;
case 3:
AFIO_RemapConfig(AFIOD, 0x1<<(gpio_NO%16), gpio_fun);
break;
default:
break;
}
}