Browse Source

update

master
zhaohe 1 year ago
parent
commit
326ebab17b
  1. 5
      include/znordic.h
  2. 9
      src/znordic.c

5
include/znordic.h

@ -2,6 +2,7 @@
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
#include "app_scheduler.h"
#include "app_timer.h" #include "app_timer.h"
#include "app_uart.h" #include "app_uart.h"
#include "app_util_platform.h" #include "app_util_platform.h"
@ -32,14 +33,16 @@
#include "nrf_sdh.h" #include "nrf_sdh.h"
#include "nrf_sdh_ble.h" #include "nrf_sdh_ble.h"
#include "nrf_sdh_soc.h" #include "nrf_sdh_soc.h"
// //
#define APP_BLE_CONN_CFG_TAG 1 /**< A tag identifying the SoftDevice BLE configuration. */ #define APP_BLE_CONN_CFG_TAG 1 /**< A tag identifying the SoftDevice BLE configuration. */
// #define ZNORDIC_SCHED_INIT(EVENT_SIZE, QUEUE_SIZE) APP_SCHED_INIT(EVENT_SIZE, QUEUE_SIZE)
/******************************************************************************* /*******************************************************************************
* UTILS * * UTILS *
*******************************************************************************/ *******************************************************************************/
void znordic_init(); void znordic_init();
int32_t znordic_get_event_max_size();
void znordic_loop(); void znordic_loop();
void znrf_gpio_cfg_output(uint32_t pin_number, nrf_gpio_pin_pull_t pull); void znrf_gpio_cfg_output(uint32_t pin_number, nrf_gpio_pin_pull_t pull);

9
src/znordic.c

@ -1,5 +1,8 @@
#include "znordic.h" #include "znordic.h"
#define SCHED_MAX_EVENT_DATA_SIZE APP_TIMER_SCHED_EVENT_DATA_SIZE /**< Maximum size of scheduler events. */
void znordic_init() { void znordic_init() {
// //
APP_SCHED_INIT(SCHED_MAX_EVENT_DATA_SIZE, 20);
{ {
/******************************************************************************* /*******************************************************************************
* * * *
@ -42,17 +45,17 @@ void znordic_init() {
} }
} }
int32_t znordic_get_event_max_size() { return SCHED_MAX_EVENT_DATA_SIZE; }
void znordic_loop() { void znordic_loop() {
while (true) { while (true) {
app_sched_execute();
if (NRF_LOG_PROCESS() == false) { if (NRF_LOG_PROCESS() == false) {
nrf_pwr_mgmt_run(); nrf_pwr_mgmt_run();
} }
} }
} }
void znrf_gpio_cfg_output(uint32_t pin_number, nrf_gpio_pin_pull_t pull) { // void znrf_gpio_cfg_output(uint32_t pin_number, nrf_gpio_pin_pull_t pull) { //
nrf_gpio_cfg(pin_number, NRF_GPIO_PIN_DIR_OUTPUT, NRF_GPIO_PIN_INPUT_DISCONNECT, pull, NRF_GPIO_PIN_S0S1, NRF_GPIO_PIN_NOSENSE); nrf_gpio_cfg(pin_number, NRF_GPIO_PIN_DIR_OUTPUT, NRF_GPIO_PIN_INPUT_DISCONNECT, pull, NRF_GPIO_PIN_S0S1, NRF_GPIO_PIN_NOSENSE);
} }

Loading…
Cancel
Save