Telink TLSR8232 BLE SDK Developer Handbook
AN-19112700-E1
42
Ver.1.0.0
gpio_write(GPIO_PA4,1)
2) Configure
GPIO_PC6 as input, and check if it’s low-level input. Enable 10K pull up
resistor to avoid influence of float level.
gpio_set_func(GPIO_PC6, AS_GPIO) ;
// PC6 is used as general GPIO function by
default, so this step to configure “func” can be skipped.
gpio_setup_up_down_resistor(GPIO_PC6, PM_PIN_PULLUP_10K);
gpio_set_input_en(GPIO_PC6, 1)
gpio_set_output_en(GPIO_PC6, 0);
if(!gpio_read(GPIO_PC6)){
// check if PC6 input is low level
......
}
3) Configure PA0 pin as PWM function
gpio_set_func(GPIO_PA0, AS_PWM) ;
2.3.3 GPIO Initialization
The “gpio_init” function is called in main.c file to initialize states of all GPIOs. Each IO will
be initialized to its default state by “gpio_init” function, unless related GPIO parameters
are pre-configured in the app_config.h. The default states of 23 GPIOs are as below.
1) func
Except SWS, other GPIOs are generic GPIO function.
2) ie
For SWS, default ie is 1; for other GPIOs, default ie is 0.
3) oe
For all GPIOs, default oe is 0.
4) dataO
For all GPIOs, default dataO is 0.
5) Internal pull up/down resistor
For all GPIOs, default internal pull up/down resistor is float.
P
lease see “drivers/5316/gpio.c” and “drivers/5316/gpio_default.h” for details.
If one or multiple GPIOs are configured in app_config.h,
the “gpio_init” will use the values
specified in app_config.h instead of default values. The reason is that GPIO default
states are all defined by macros.
Macro example:
#ifndef
PA7_INPUT_ENABLE
#define
PA7_INPUT_ENABLE
0
#endif