• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ APP_UART_FIFO_INIT函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中APP_UART_FIFO_INIT函数的典型用法代码示例。如果您正苦于以下问题:C++ APP_UART_FIFO_INIT函数的具体用法?C++ APP_UART_FIFO_INIT怎么用?C++ APP_UART_FIFO_INIT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了APP_UART_FIFO_INIT函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: uart_init

/**@brief Function for initializing the UART.
 */
static void uart_init(void)
{
    uint32_t err_code;

    const app_uart_comm_params_t comm_params =
       {
           RX_PIN_NUMBER,
           TX_PIN_NUMBER,
           RTS_PIN_NUMBER,
           CTS_PIN_NUMBER,
           APP_UART_FLOW_CONTROL_ENABLED,
           false,
           UART_BAUDRATE_BAUDRATE_Baud38400
       };

    APP_UART_FIFO_INIT(&comm_params,
                          UART_RX_BUF_SIZE,
                          UART_TX_BUF_SIZE,
                          uart_error_handle,
                          APP_IRQ_PRIORITY_LOW,
                          err_code);

    APP_ERROR_CHECK(err_code);

    app_trace_init();
}
开发者ID:451506709,项目名称:automated_machine,代码行数:28,代码来源:main.c


示例2: main

/**@brief Function for main application entry. Does not return.
 */
int main()
{
#if defined(TRACE_UART)
    // Configure and make UART ready for usage.
    app_uart_comm_params_t comm_params =
    {
        RX_PIN_NUMBER,
        TX_PIN_NUMBER,
        RTS_PIN_NUMBER,
        CTS_PIN_NUMBER,
        APP_UART_FLOW_CONTROL_DISABLED,
        false,
        UART_BAUDRATE_BAUDRATE_Baud38400
    };

    uint32_t err_code;
    APP_UART_FIFO_INIT(&comm_params,
                       UART_RX_BUF_SIZE,
                       UART_TX_BUF_SIZE,
                       uart_error_handle,
                       APP_IRQ_PRIORITY_LOW,
                       err_code);
    APP_ERROR_CHECK(err_code);
#endif // defined(TRACE_UART)

    softdevice_setup();

    // Run bicycle power-only TX main processing loop. Does not return.
    bp_only_tx_main_loop_run();

    return 0;
}
开发者ID:BlueSkyGjj,项目名称:nRF52,代码行数:34,代码来源:main.c


示例3: uart_init

// Initialzes non blocking serial communication with terminal via uart. Returns 0 on success, -1 on an error.
int uart_init()
{
  uint32_t err_code;

  const app_uart_comm_params_t comm_params =
  {
      RX_PIN_NUMBER,
      TX_PIN_NUMBER,
      UART_PIN_DISCONNECTED,
      UART_PIN_DISCONNECTED,
      APP_UART_FLOW_CONTROL_DISABLED,
      false,
      UART_BAUDRATE_BAUDRATE_Baud38400
  };

  APP_UART_FIFO_INIT(&comm_params,
                     UART_RX_BUF_SIZE,
                     UART_TX_BUF_SIZE,
                     uart_event_handle,
                     APP_IRQ_PRIORITY_LOW,
                     err_code);

  APP_ERROR_CHECK(err_code);

  if (err_code != NRF_SUCCESS)
  {
    return -1;
  }
  return 0;
}
开发者ID:nihaopaul,项目名称:Espruino,代码行数:31,代码来源:uart_interface.c


示例4: main

/**@brief Function for application main entry, does not return.
 */
int main(void)
{
#if defined(TRACE_UART)  
    // Configure and make UART ready for usage. 
    const app_uart_comm_params_t comm_params =  
    {
        RX_PIN_NUMBER, 
        TX_PIN_NUMBER, 
        RTS_PIN_NUMBER, 
        CTS_PIN_NUMBER, 
        APP_UART_FLOW_CONTROL_DISABLED, 
        false, 
        UART_BAUDRATE_BAUDRATE_Baud38400
    }; 
        
    uint32_t err_code;
    APP_UART_FIFO_INIT(&comm_params, 
                       UART_RX_BUF_SIZE, 
                       UART_TX_BUF_SIZE, 
                       uart_error_handle, 
                       APP_IRQ_PRIORITY_LOW,
                       err_code);
    APP_ERROR_CHECK(err_code);
#endif // defined(TRACE_UART)     
  
    printf("+enter main\n");

    softdevice_setup();

    // Run HRM TX main thread - does not return.
    main_hrm_tx_run();   

    return 0;
} 
开发者ID:451506709,项目名称:automated_machine,代码行数:36,代码来源:main.c


示例5: uart_init

static void uart_init(void)
{
    const app_uart_comm_params_t comm_params =
    {
        RX_PIN_NUMBER,
        TX_PIN_NUMBER,
        0,
        0,
        APP_UART_FLOW_CONTROL_DISABLED,
        false,
        UART_BAUDRATE_BAUDRATE_Baud38400
    };

    uint32_t err_code;
    APP_UART_FIFO_INIT(&comm_params,
            RX_BUF_SIZE,
            TX_BUF_SIZE,
            uart_error_handle,
            APP_IRQ_PRIORITY_LOW,
            err_code);

    APP_ERROR_CHECK(err_code);

    printf("\r\nbooting\r\n");

}
开发者ID:ix-wetterstation,项目名称:sensor,代码行数:26,代码来源:main.c


示例6: bridge_uart_init

bool bridge_uart_init()
{
    uint32_t baud_rate_reg;
  
    bridge_set_baud_rate_register(sensor_bridge.config.baud_rate, &baud_rate_reg);
      
    const app_uart_comm_params_t  p_comm_params = 
    {
        UART_RX_PIN,
        UART_TX_PIN,
        0,
        0,   
        APP_UART_FLOW_CONTROL_DISABLED,
        false,
        baud_rate_reg
    };
    uint32_t error;
    
    APP_UART_FIFO_INIT(&p_comm_params,
												32,
												32,
												bridge_uart_event_handler,
												APP_IRQ_PRIORITY_LOW,
												error);
    
    if(error != NRF_SUCCESS)
    {
        return false;
    }
    
    return true;
}
开发者ID:relayr,项目名称:WunderBar-firmware-release,代码行数:32,代码来源:main.c


示例7: sdm_rx_init

uint32_t sdm_rx_init(void)
{       
#if defined(TRACE_UART)
    app_uart_comm_params_t comm_params =  
    {
        RX_PIN_NUMBER, 
        TX_PIN_NUMBER, 
        RTS_PIN_NUMBER, 
        CTS_PIN_NUMBER, 
        APP_UART_FLOW_CONTROL_DISABLED, 
        false, 
        UART_BAUDRATE_BAUDRATE_Baud38400
    }; 
        
    uint32_t err_code;
    APP_UART_FIFO_INIT(&comm_params, 
                       UART_RX_BUF_SIZE, 
                       UART_TX_BUF_SIZE, 
                       uart_error_handle, 
                       APP_IRQ_PRIORITY_LOW,
                       err_code);
    APP_ERROR_CHECK(err_code);
#endif // TRACE_UART
#if defined(TRACE_GPIO)
    //  Configure pins LED_0 and LED_1 as outputs. 
    nrf_gpio_range_cfg_output(SDM_GPIO_START, SDM_GPIO_STOP);
    
    //  Reset the pins if they already are in a high state. 
    nrf_gpio_pin_clear(SDM_GPIO_0);
    nrf_gpio_pin_clear(SDM_GPIO_1);
    nrf_gpio_pin_clear(SDM_GPIO_2);
#endif // TRACE_GPIO

    return NRF_SUCCESS;         
}
开发者ID:DroneBucket,项目名称:Drone_Bucket_CrazyFlie2_NRF_Firmware,代码行数:35,代码来源:sdm_rx.c


示例8: main

/** @brief Function for main application entry.
 */
int main(void)
{
    // Setup bsp module.
    bsp_configuration();
	
    //uart initialization
    uint32_t err_code;
    const app_uart_comm_params_t comm_params =
      {
          RX_PIN_NUMBER,
          TX_PIN_NUMBER,
          RTS_PIN_NUMBER,
          CTS_PIN_NUMBER,
          APP_UART_FLOW_CONTROL_ENABLED,
          false,
          UART_BAUDRATE_BAUDRATE_Baud115200
      };

    APP_UART_FIFO_INIT(&comm_params,
                         UART_RX_BUF_SIZE,
                          UART_TX_BUF_SIZE,
                         uart_error_handle,
                         APP_IRQ_PRIORITY_LOW,
                         err_code);

		
    APP_ERROR_CHECK(err_code);

			
		while(app_uart_put(86) != NRF_SUCCESS);
		intan_setup();
			
	  while(app_uart_put(87) != NRF_SUCCESS);
    // initialize the buffer 
    buffer_init(&db, DATA_BUF_SIZE, sizeof(uint8_t));
			
		while(app_uart_put(88) != NRF_SUCCESS);
    for (;;)
    {
		//	printf("ldsakjf;ljdsaflkjlljlk\n");
 			while(app_uart_put(89) != NRF_SUCCESS);
			
        if (m_transfer_completed)
        {
            m_transfer_completed = false;

            intan_convert(m_tx_data_spi, m_rx_data_spi,intan_convert_channel);
	 
            //print m_rx_data_spi results
            switch_state();
					  for (int i; i< RX_MSG_LENGTH; i++){
							while(app_uart_put(m_rx_data_spi[i]) != NRF_SUCCESS);
						}
            nrf_delay_ms(DELAY_MS);
						//printf("Hi\n");
        }
				//printf("Yo\n");
    }
}
开发者ID:JulianYG,项目名称:WNR,代码行数:61,代码来源:main.c


示例9: main

/**@brief Function for application main entry, does not return.
 *
 * @details The main function will do all necessary initalization. This includes sdm rx module
 * and SoftDevice.
 */
int main(void)
{
    uint32_t err_code;

#if defined(TRACE_UART)
    app_uart_comm_params_t comm_params =
    {
        RX_PIN_NUMBER,
        TX_PIN_NUMBER,
        RTS_PIN_NUMBER,
        CTS_PIN_NUMBER,
        APP_UART_FLOW_CONTROL_DISABLED,
        false,
        UART_BAUDRATE_BAUDRATE_Baud38400
    };

    APP_UART_FIFO_INIT(&comm_params,
                       UART_RX_BUF_SIZE,
                       UART_TX_BUF_SIZE,
                       uart_error_handle,
                       APP_IRQ_PRIORITY_LOW,
                       err_code);
    APP_ERROR_CHECK(err_code);
#endif // TRACE_UART
#if defined(TRACE_GPIO)
    // Initialize timer module.
    APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_MAX_TIMERS, APP_TIMER_OP_QUEUE_SIZE, false);

    err_code = bsp_init(BSP_INIT_LED, APP_TIMER_TICKS(100, APP_TIMER_PRESCALER), NULL);
    APP_ERROR_CHECK(err_code);
#endif // TRACE_GPIO

    // In case of logging enabled, we enable sdm_rx module first.
    err_code = sdm_rx_init();
    APP_ERROR_CHECK(err_code);

    // Enable SoftDevice.
    err_code = sd_softdevice_enable(NRF_CLOCK_LFCLKSRC_XTAL_50_PPM, softdevice_assert_callback);
    APP_ERROR_CHECK(err_code);

    // Set application IRQ to lowest priority.
    err_code = sd_nvic_SetPriority(SD_EVT_IRQn, NRF_APP_PRIORITY_LOW);
    APP_ERROR_CHECK(err_code);

    // Enable application IRQ (triggered from protocol).
    err_code = sd_nvic_EnableIRQ(SD_EVT_IRQn);
    APP_ERROR_CHECK(err_code);

    err_code = ant_stack_static_config();
    APP_ERROR_CHECK(err_code);

    // Setup Channel_0 as a SDM RX.
    ant_channel_sdm_rx_setup();

    sdm_main_loop();
}
开发者ID:451506709,项目名称:automated_machine,代码行数:61,代码来源:main.c


示例10: main

/**
 * @brief Function for application main entry.
 */
int main(void)
{
    timer0_init(); // Timer used to blink the LEDs.
    timer1_init(); // Timer to generate events on even number of seconds.
    timer2_init(); // Timer to generate events on odd number of seconds.
    ppi_init();    // PPI to redirect the event to timer start/stop tasks.

    uint32_t err_code;
    const app_uart_comm_params_t comm_params =
     {
         RX_PIN_NUMBER,
         TX_PIN_NUMBER,
         RTS_PIN_NUMBER,
         CTS_PIN_NUMBER,
         APP_UART_FLOW_CONTROL_ENABLED,
         false,
         UART_BAUDRATE_BAUDRATE_Baud115200
     };

    APP_UART_FIFO_INIT(&comm_params,
                    UART_RX_BUF_SIZE,
                    UART_TX_BUF_SIZE,
                    uart_error_handle,
                    APP_IRQ_PRIORITY_LOW,
                    err_code);

    APP_ERROR_CHECK(err_code);

    // Enabling constant latency as indicated by PAN 11 "HFCLK: Base current with HFCLK 
    // running is too high" found at Product Anomaly document found at
    // https://www.nordicsemi.com/eng/Products/Bluetooth-R-low-energy/nRF51822/#Downloads
    //
    // @note This example does not go to low power mode therefore constant latency is not needed.
    //       However this setting will ensure correct behaviour when routing TIMER events through 
    //       PPI (shown in this example) and low power mode simultaneously.
    NRF_POWER->TASKS_CONSTLAT = 1;
    
    // Start clock.
    nrf_drv_timer_enable(&timer0);
    nrf_drv_timer_enable(&timer1);
    nrf_drv_timer_enable(&timer2);

    // Loop and increment the timer count value and capture value into LEDs. @note counter is only incremented between TASK_START and TASK_STOP.
    while (true)
    {

        printf("Current count: %d\n\r", (int)nrf_drv_timer_capture(&timer0,NRF_TIMER_CC_CHANNEL0));

        /* increment the counter */
        nrf_drv_timer_increment(&timer0);

        nrf_delay_ms(100);
    }
}
开发者ID:jrlitzenberger,项目名称:pocketLab2,代码行数:57,代码来源:main.c


示例11: uart_init

/**@snippet [UART Initialization] */
static void uart_init(void)
{
    uint32_t                     err_code;
    const app_uart_comm_params_t comm_params =
    {
        .rx_pin_no    = RX_PIN_NUMBER,
        .tx_pin_no    = TX_PIN_NUMBER,
        .rts_pin_no   = RTS_PIN_NUMBER,
        .cts_pin_no   = CTS_PIN_NUMBER,
        .flow_control = APP_UART_FLOW_CONTROL_DISABLED,
        .use_parity   = false,
        .baud_rate    = UART_BAUDRATE_BAUDRATE_Baud115200
    };

    APP_UART_FIFO_INIT(&comm_params,
                       UART_RX_BUF_SIZE,
                       UART_TX_BUF_SIZE,
                       uart_event_handle,
                       APP_IRQ_PRIORITY_LOWEST,
                       err_code);
    APP_ERROR_CHECK(err_code);
}
/**@snippet [UART Initialization] */


/**@brief Function for initializing the Advertising functionality.
 */
static void advertising_init(void)
{
    uint32_t               err_code;
    ble_advdata_t          advdata;
    ble_advdata_t          scanrsp;
    ble_adv_modes_config_t options;

    // Build advertising data struct to pass into @ref ble_advertising_init.
    memset(&advdata, 0, sizeof(advdata));
    advdata.name_type          = BLE_ADVDATA_FULL_NAME;
    advdata.include_appearance = false;
    advdata.flags              = BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE;

    memset(&scanrsp, 0, sizeof(scanrsp));
    scanrsp.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
    scanrsp.uuids_complete.p_uuids  = m_adv_uuids;

    memset(&options, 0, sizeof(options));
    options.ble_adv_fast_enabled  = true;
    options.ble_adv_fast_interval = APP_ADV_INTERVAL;
    options.ble_adv_fast_timeout  = APP_ADV_TIMEOUT_IN_SECONDS;

    err_code = ble_advertising_init(&advdata, &scanrsp, &options, on_adv_evt, NULL);
    APP_ERROR_CHECK(err_code);

    ble_advertising_conn_cfg_tag_set(CONN_CFG_TAG);
}
开发者ID:NordicSemiconductor,项目名称:nRF52-ADC-examples,代码行数:55,代码来源:main.c


示例12: uart_init

/**@brief  Function for initializing the UART module.
 */
static void uart_init(void)
{
    uint32_t err_code;
    
    APP_UART_FIFO_INIT(&comm_params,
                        RX_BUF_SIZE,
                        TX_BUF_SIZE,
                        uart_evt_callback,
                        UART_IRQ_PRIORITY,
                        err_code);
    
    APP_ERROR_CHECK(err_code);
}
开发者ID:ClarePhang,项目名称:nrf51-UART-examples,代码行数:15,代码来源:main.c


示例13: main

/**@brief Function for application main entry.
 */
int main(void)
{
    uint32_t err_code;

    // Initialize.
    app_trace_init();
    timers_init();
    APP_GPIOTE_INIT(1);

    const app_uart_comm_params_t comm_params =
       {
           RX_PIN_NUMBER,
           TX_PIN_NUMBER,
           RTS_PIN_NUMBER,
           CTS_PIN_NUMBER,
           APP_UART_FLOW_CONTROL_ENABLED,
           false,
           UART_BAUDRATE_BAUDRATE_Baud38400
       };

    APP_UART_FIFO_INIT(&comm_params,
                          UART_RX_BUF_SIZE,
                          UART_TX_BUF_SIZE,
                          uart_error_handle,
                          APP_IRQ_PRIORITY_LOW,
                          err_code);

    err_code = bsp_init(BSP_INIT_LED | BSP_INIT_BUTTONS,
                        APP_TIMER_TICKS(100, APP_TIMER_PRESCALER),
                        button_event_handler);
    APP_ERROR_CHECK(err_code);

    ble_stack_init();

    device_manager_init();
    gap_params_init();
    advertising_init();
    services_init();
    sensor_simulator_init();
    conn_params_init();

    // Start execution.
    application_timers_start();
    advertising_start();

    // Enter main loop.
    for (;;)
    {
        power_manage();
    }
}
开发者ID:dhruvkakadiya,项目名称:OpenSJ_Bluz,代码行数:53,代码来源:main.c


示例14: main

/**
 * @brief Function for application main entry.
 * @return 0. int return type required by ANSI/ISO standard.
 */
int main(void)
{
    uint32_t err_code = NRF_SUCCESS;
    
    clock_initialization();
    APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, NULL);
        
    const app_uart_comm_params_t comm_params =  
    {
        RX_PIN_NUMBER, 
        TX_PIN_NUMBER, 
        RTS_PIN_NUMBER, 
        CTS_PIN_NUMBER, 
        APP_UART_FLOW_CONTROL_ENABLED, 
        false, 
        UART_BAUDRATE_BAUDRATE_Baud115200
    };   
    
    APP_UART_FIFO_INIT(&comm_params, 
                       UART_RX_BUF_SIZE, 
                       UART_TX_BUF_SIZE, 
                       uart_error_handle, 
                       APP_IRQ_PRIORITY_LOW,
                       err_code);
        
    err_code = bsp_init(BSP_INIT_LED | BSP_INIT_BUTTONS,
                        APP_TIMER_TICKS(100, APP_TIMER_PRESCALER),
                        bsp_evt_handler);
    APP_ERROR_CHECK(err_code);

    // Set radio configuration parameters
    radio_configure();

    // Set payload pointer
    NRF_RADIO->PACKETPTR = (uint32_t)&packet;

    err_code = bsp_indication_text_set(BSP_INDICATE_USER_STATE_OFF, "Press Any Button\n\r");
    APP_ERROR_CHECK(err_code);

    while (true)
    {
        if(packet != 0)
        {
            send_packet();
            printf("The contents of the package was %u\n\r", (unsigned int)packet);
            packet = 0;
        }
        __WFE();
    }
}
开发者ID:IOIOI,项目名称:nRF51,代码行数:54,代码来源:main.c


示例15: main

/** @brief Function for main application entry.
 */
int main(void)
{
    // This function contains workaround for PAN_028 rev2.0A anomalies 28, 29,30 and 31.
    int32_t volatile temp;

    nrf_temp_init();
    uint32_t err_code;
    APP_GPIOTE_INIT(1);
    const app_uart_comm_params_t comm_params =
     {
         RX_PIN_NUMBER,
         TX_PIN_NUMBER,
         RTS_PIN_NUMBER,
         CTS_PIN_NUMBER,
         APP_UART_FLOW_CONTROL_ENABLED,
         false,
         UART_BAUDRATE_BAUDRATE_Baud38400
     };

    APP_UART_FIFO_INIT(&comm_params,
                    UART_RX_BUF_SIZE,
                    UART_TX_BUF_SIZE,
                    uart_error_handle,
                    APP_IRQ_PRIORITY_LOW,
                    err_code);

    APP_ERROR_CHECK(err_code);

    while (true)
    {
        NRF_TEMP->TASKS_START = 1; /** Start the temperature measurement. */

        /* Busy wait while temperature measurement is not finished, you can skip waiting if you enable interrupt for DATARDY event and read the result in the interrupt. */
        /*lint -e{845} // A zero has been given as right argument to operator '|'" */
        while (NRF_TEMP->EVENTS_DATARDY == 0)
        {
            // Do nothing.
        }
        NRF_TEMP->EVENTS_DATARDY = 0;

        /**@note Workaround for PAN_028 rev2.0A anomaly 29 - TEMP: Stop task clears the TEMP register. */
        temp = (nrf_temp_read() / 4);

        /**@note Workaround for PAN_028 rev2.0A anomaly 30 - TEMP: Temp module analog front end does not power down when DATARDY event occurs. */
        NRF_TEMP->TASKS_STOP = 1; /** Stop the temperature measurement. */

        printf("Actual temperature: %d\n\r", (int)temp);
        nrf_delay_ms(500);
    }
}
开发者ID:dhruvkakadiya,项目名称:OpenSJ_Bluz,代码行数:52,代码来源:main.c


示例16: uart_init

uint32_t uart_init(void) {
  uint32_t err_code;
  const app_uart_comm_params_t comm_params = {
    .rx_pin_no = RX_PIN_NUMBER,
    .tx_pin_no = TX_PIN_NUMBER,
    .rts_pin_no = 0,
    .cts_pin_no = 0,
    .flow_control = APP_UART_FLOW_CONTROL_DISABLED,
    .use_parity = false,
    .baud_rate = UART_BAUDRATE_BAUDRATE_Baud38400
  };

  /* With the softdevice interrupts happening we need to use a UART fifo to ensure we don't lose
   * bytes. Additionally, the behavior seems unpredictable at 115200 baud, and after reading
   * responses from nRF employees the safer plan seems to be to use a lower baud rate */
  APP_UART_FIFO_INIT(&comm_params, UART_TX_BUF, UART_RX_BUF, uart_error_handle, APP_IRQ_PRIORITY_LOW, err_code);
  return err_code;
}

int main(void)
{
  uint32_t ret;

  uart_init();

  puts("welcome to coral.");
  for (int i = 0; i < sizeof(tx_buf); i++) {
    tx_buf[i] = i;
  }

  ble_stack_setup();
  if ((ret = spi_init()) != NRF_SUCCESS) {
    printf("spi_init() failure: %lu\n", ret);
  } 

  while (1) {
    nrf_delay_ms(1000);

    uint32_t ret = spi_transfer(tx_buf, sizeof(tx_buf), NULL, 0);
    if (ret != NRF_SUCCESS) {
      printf("SPI Error: %lu\n", ret);
      break;
    }
  }

  for(;;)
 
  return 0;
}
开发者ID:j9brown,项目名称:coral-radio,代码行数:49,代码来源:init.c


示例17: boardInit

void boardInit(void)
{
  uint32_t error;
  static app_button_cfg_t button_cfg[BOARD_BUTTON_NUM];

  /* Configure and enable the timer app */
	APP_TIMER_INIT(CFG_TIMER_PRESCALER, CFG_TIMER_MAX_INSTANCE, CFG_TIMER_OPERATION_QUEUE_SIZE, CFG_SCHEDULER_ENABLE);

  /* Initialise GPIOTE */
  APP_GPIOTE_INIT(CFG_GPIOTE_MAX_USERS);

  /* LED Settings */
  for(uint8_t i=0; i<BOARD_LED_NUM; i++)
  {
    nrf_gpio_cfg_output( led_gpio[i] );
  }

  /* Button Settings */
  for(uint8_t i=0; i<BOARD_BUTTON_NUM; i++)
  {
    /* Pins are configued with pullups since none are present on the PCB */
    button_cfg[i] = (app_button_cfg_t)
                    {
                      .pin_no = button_gpio[i],
                      .active_state = BOARD_BUTTON_ACTIVE_STATE ? true : false,
                      .pull_cfg = NRF_GPIO_PIN_PULLUP,
                      .button_handler = button_event_handler
                    };
  };

  APP_BUTTON_INIT(button_cfg, BOARD_BUTTON_NUM,
                  APP_TIMER_TICKS(BOARD_BUTTON_DETECTION_INTERVAL_MS, CFG_TIMER_PRESCALER), false);

  /* UART Settings */
  app_uart_comm_params_t para_uart =
  {
    .rx_pin_no    = BOARD_UART_RXD_PIN,
    .tx_pin_no    = BOARD_UART_TXD_PIN,
    .rts_pin_no   = BOARD_UART_RTS_PIN,
    .cts_pin_no   = BOARD_UART_CTS_PIN,
    .flow_control = APP_UART_FLOW_CONTROL_ENABLED,
    .use_parity   = false,
    .baud_rate    = get_baudrate(CFG_UART_BAUDRATE)
  };

  /* Initialise the UART FIFO */
  APP_UART_FIFO_INIT( &para_uart, CFG_UART_BUFSIZE, CFG_UART_BUFSIZE, board_uart_event_handler, APP_IRQ_PRIORITY_LOW, error);
  ASSERT_STATUS_RET_VOID( (error_t) error );
}
开发者ID:Jaden-J,项目名称:IntroToBLE,代码行数:49,代码来源:board_pca10001.c


示例18: UART_Init

uint32_t UART_Init(uint8_t rx_pin, uint8_t tx_pin, uint32_t baud_rate){
	uint32_t err_code = 0;
	const app_uart_comm_params_t comm_params = {rx_pin, tx_pin, 0, 0, APP_UART_FLOW_CONTROL_DISABLED, false, baud_rate};
	
	//APP_UART_INIT(&comm_params, uart_error_handle, APP_IRQ_PRIORITY_LOW, err_code);
	
	APP_UART_FIFO_INIT(&comm_params,
                         1,		//UART_RX_BUF_SIZE
                         256,	//UART_TX_BUF_SIZE
                         uart_error_handle,
                         APP_IRQ_PRIORITY_LOW,
                         err_code);

	return err_code;
}
开发者ID:damogranlabs,项目名称:nRF51,代码行数:15,代码来源:nRF51_uart_print.c


示例19: uart_init

void uart_init()
{
	uint32_t err_code;
	app_uart_comm_params_t cfg;

	cfg.rx_pin_no = UART_RX_PIN;
	cfg.tx_pin_no = UART_TX_PIN;
	cfg.rts_pin_no = UART_RTS_PIN;
	cfg.cts_pin_no = UART_CTS_PIN;
	cfg.flow_control = APP_UART_FLOW_CONTROL_DISABLED;
	cfg.use_parity = false;
	cfg.baud_rate = UART_BAUDRATE_BAUDRATE_Baud115200;

	APP_UART_FIFO_INIT(&cfg, 32, 32, uart_evt_handler, APP_IRQ_PRIORITY_LOW, err_code);
}
开发者ID:iotbees,项目名称:EHAL,代码行数:15,代码来源:UartBleMain.c


示例20: main

int main(void)
{
    // Initialization of various modules.
    uint32_t err_code;

    const app_uart_comm_params_t comm_params =
       {
           RX_PIN_NUMBER,
           TX_PIN_NUMBER,
           RTS_PIN_NUMBER,
           CTS_PIN_NUMBER,
           APP_UART_FLOW_CONTROL_ENABLED,
           false,
           UART_BAUDRATE_BAUDRATE_Baud38400
       };

    APP_UART_FIFO_INIT(&comm_params,
                          UART_RX_BUF_SIZE,
                          UART_TX_BUF_SIZE,
                          uart_error_handle,
                          APP_IRQ_PRIORITY_LOW,
                          err_code);

    APP_ERROR_CHECK(err_code);
    app_trace_init();
    APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_MAX_TIMERS, APP_TIMER_OP_QUEUE_SIZE, NULL);
    APP_GPIOTE_INIT(1);
    err_code = bsp_init(BSP_INIT_LED | BSP_INIT_BUTTONS, APP_TIMER_TICKS(100, APP_TIMER_PRESCALER),NULL);
    APP_ERROR_CHECK(err_code);

    printf("Heart rate collector example\r\n");
    ble_stack_init();
    device_manager_init();
    db_discovery_init();
    hrs_c_init();
    bas_c_init();

    // Start scanning for peripherals and initiate connection
    // with devices that advertise Heart Rate UUID.
    scan_start();

    for (;; )
    {
        power_manage();
    }
}
开发者ID:tkadom,项目名称:TWBLE,代码行数:46,代码来源:main.c



注:本文中的APP_UART_FIFO_INIT函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ APR_ASSERT_SUCCESS函数代码示例发布时间:2022-05-30
下一篇:
C++ APP_TIMER_TICKS函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap