NRF_GPIO_Type * reg = nrf_gpio_pin_port_decode(&pin_number); //配置对应的端口的状态 reg->PIN_CNF[pin_number] = ((uint32_t)dir << GPIO_PIN_CNF_DIR_Pos)//方向 | ((uint32_t)input << GPIO_PIN_CNF_INPUT_Pos)//输入缓冲 | ((uint32_t)pull << GPIO_PIN_CNF_PULL_Pos)//上...
nrf_gpio_pin_clear(uint32_t pin_number)//设置某个引脚为低电平 nrf_gpio_pin_toggle(uint32_t pin_number)//翻转某个引脚的电平 nrf_gpio_pin_write(uint32_t pin_number, uint32_t value) //写某个引脚的电平,可以写高,也可以写低 nrf_gpio_pin_read(uint32_t pin_number) //读取某个引脚的...
nrf_gpio_pin_clear(uint32_t pin_number)//设置某个引脚为低电平 nrf_gpio_pin_toggle(uint32_t pin_number)//翻转某个引脚的电平 nrf_gpio_pin_write(uint32_t pin_number, uint32_t value) //写某个引脚的电平,可以写高,也可以写低 nrf_gpio_pin_read(uint32_t pin_number) //读取某个引脚的...
* @param exti_event -- BSP_GPIO_EXTI_INT_LOWFALL 低电平触发(下降沿), BSP_GPIO_EXTI_INT_HIGHRISE 高电平触发(上降沿), BSP_GPIO_EXTI_INT_FALLRISE 高低电平触发或任意电平变化 * @param pull -- BSP_GPIO_PIN_NOPULL 无上下拉, BSP_GPIO_PIN_PULLUP 上拉输入, BSP_GPIO_PIN_PULLDOWN 下拉输...
nrf_gpio_pin_clear(LED_PIN); nrf_delay_ms(1000); // 等待1秒 } } ``` 在这个示例中,我们首先定义了一个宏`LED_PIN`来表示LED灯连接的GPIO引脚。然后,在`app_main`函数中,我们使用`nrf_gpio_cfg_output`函数将该引脚配置为输出模式。接下来,我们使用一个无...
NRF_GPIO_PIN_NOSENSE); nrf_gpio_pin_clear((uint32_t)row_pin_array[i]); //Set pin to low #endif nrf_gpio_pin_clear((uint32_t)row_pin_array[i]); //Set pin to low #endif } for (uint_fast8_t i = MATRIX_COLS; i--;) { #ifndef MATRIX_HAS_GHOST for (uint_fast8_t i ...
nrf_gpio_pin_clear(OLED_CS); // initializes the GPIOTE channel so that SCK toggles generates events nrf_drv_gpiote_in_config_t config = GPIOTE_CONFIG_IN_SENSE_TOGGLE(true); err_code = nrf_drv_gpiote_in_init(OLED_CLK, &config, in_pin_handler); ...
可以参考 SDK 中的 nrf_pwr_mgt 例子,系统进入 System OFF 模式会保留 GPIO 之前的状态,包括 GPIO 的输入/输出、I2C 总线、SPI 总线等,所以在进入 System OFF 模式前应该将 GPIO 都释放掉,使用 nrf_gpio_cfg_default(pin)释放 GPIO,同时,如果有 I2C 或 SPI 等总线外设也需要释放掉;可以通过复位、GPIO ...
RAMON_OFFRAM1_Pos; while(1) { //如果BUTTON0被按下.,则熄灭LED灯让CPU进入睡眠 if(nrf_gpio_pin_read(key_0)==KeyPressFlag) { nrf_gpio_pin_clear(LED_0); //CPU进入睡眠模式,若有GPIO的DETECT信号唤,则CPU被唤醒而后复位从main函数开始执行。 NRF_POWER->SYSTEMOFF=1; } } } ...
nrf_gpio_pin_clear(CONNECTED_LED_PIN_NO); m_conn_handle = BLE_CONN_HANDLE_INVALID; err_code = app_button_disable(); APP_ERROR_CHECK(err_code); advertising_start(); break; case BLE_GAP_EVT_SEC_PARAMS_REQUEST: err_code = sd_ble_gap_sec_params_reply(m_conn_handle, BLE_GAP_SEC_STA...