这篇教程C++ APP_UART_FIFO_INIT函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中APP_UART_FIFO_INIT函数的典型用法代码示例。如果您正苦于以下问题:C++ APP_UART_FIFO_INIT函数的具体用法?C++ APP_UART_FIFO_INIT怎么用?C++ APP_UART_FIFO_INIT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了APP_UART_FIFO_INIT函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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,
示例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,
示例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,
示例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,
示例5: uart_initstatic 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,
示例6: bridge_uart_initbool 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,
示例7: sdm_rx_inituint32_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,
示例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,
示例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,
示例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,
示例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,
示例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,
示例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,
示例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,
示例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,
示例16: uart_inituint32_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,
示例17: boardInitvoid 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( ¶_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,
示例18: UART_Inituint32_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,
示例19: uart_initvoid 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,
示例20: mainint 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,
示例21: uart_initstatic void uart_init(void){#ifdef USE_UART_LOGGING int status = NRF_SUCCESS; const app_uart_comm_params_t uart_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_ENABLED, .use_parity = false, .baud_rate = UART_BAUDRATE_BAUDRATE_Baud38400 }; APP_UART_FIFO_INIT(&uart_params, UART_RX_BUF_SIZE, UART_TX_BUF_SIZE, uart_event_handler, APP_IRQ_PRIORITY_LOW, status); APP_ERROR_CHECK(status);#endif}static void uart_putstring(const uint8_t * string){#ifdef USE_UART_LOGGING for(int i = 0; string[i] != 0; ++i) app_uart_put(string[i]);#endif}/*** Interrupt handler for Softdevice events*/void SD_EVT_IRQHandler(void){ uint32_t evt; ble_evt_t ble_evt; uint16_t len; while(sd_evt_get(&evt) == NRF_SUCCESS) { btle_hci_adv_sd_evt_handler(evt); } while (sd_ble_evt_get((uint8_t *) &evt, &len) == NRF_SUCCESS) { nrf_adv_conn_evt_handler(&ble_evt); }}
开发者ID:Frozenleaf,项目名称:nRF51-multi-role-conn-observer-advertiser,代码行数:45,
示例22: main/** @brief Function for main application entry. */int main(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_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);#ifdef SOFTDEVICE_PRESENT nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC; SOFTDEVICE_HANDLER_INIT(&clock_lf_cfg, NULL);#endif // SOFTDEVICE_PRESENT err_code = nrf_drv_rng_init(NULL); APP_ERROR_CHECK(err_code); while (true) { uint8_t p_buff[RANDOM_BUFF_SIZE]; uint8_t length = random_vector_generate(p_buff,RANDOM_BUFF_SIZE); printf("Random Vector:"); for(uint8_t i = 0; i < length; i++) { printf(" %3d",(int)p_buff[i]); } printf("/n/r"); nrf_delay_ms(100); }}
开发者ID:IOIOI,项目名称:nRF51,代码行数:46,
示例23: 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_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); err_code = bsp_init(BSP_INIT_LED, APP_TIMER_TICKS(100, APP_TIMER_PRESCALER), NULL); APP_ERROR_CHECK(err_code); // Set radio configuration parameters radio_configure(); NRF_RADIO->PACKETPTR = (uint32_t)&packet; err_code = bsp_indication_text_set(BSP_INDICATE_USER_STATE_OFF, "Wait for first packet/n/r"); APP_ERROR_CHECK(err_code); while (true) { uint32_t received = read_packet(); err_code = bsp_indication_text_set(BSP_INDICATE_RCV_OK, "Packet was received/n/r"); APP_ERROR_CHECK(err_code); printf("The contents of the package is %u/n/r", (unsigned int)received); }}
开发者ID:JulianYG,项目名称:WNR,代码行数:48,
示例24: debug_log_initvoid debug_log_init(void){ uint32_t err_code = NRF_SUCCESS; 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_Baud115200 }; APP_UART_FIFO_INIT(&comm_params, UART_RX_BUF_SIZE, UART_TX_BUF_SIZE, uart_error_handle, APP_IRQ_PRIORITY_LOW, err_code); UNUSED_VARIABLE(err_code);}
开发者ID:HumanDynamics,项目名称:OpenBadge,代码行数:21,
示例25: hif_setupvoid hif_setup(uint8_t rx_pin, uint8_t tx_pin){ uint32_t err_code; app_uart_comm_params_t comm_params; comm_params.rx_pin_no = rx_pin; comm_params.tx_pin_no = tx_pin; comm_params.rts_pin_no = 0; comm_params.cts_pin_no = 0; comm_params.flow_control = APP_UART_FLOW_CONTROL_DISABLED; comm_params.use_parity = false; comm_params.baud_rate = UART_BAUDRATE_BAUDRATE_Baud9600; APP_UART_FIFO_INIT(&comm_params, 128, 128, uart_evt_callback, APP_IRQ_PRIORITY_LOW, err_code); APP_ERROR_CHECK(err_code);}
开发者ID:Sleepsleep,项目名称:nRF51_Platform,代码行数:22,
示例26: init_uartvoid init_uart(void) { uint32_t err_code; const app_uart_comm_params_t comm_params = { RX_PIN_NUMBER, TX_PIN_NUMBER, 0xFF, 0xFF, APP_UART_FLOW_CONTROL_DISABLED, false, UART_BAUDRATE_BAUDRATE_Baud230400 }; APP_UART_FIFO_INIT(&comm_params, 1, 128, uart_error_handle, APP_IRQ_PRIORITY_LOW, err_code); APP_ERROR_CHECK(err_code); }
开发者ID:Cacowned,项目名称:ossw-firmware-s120,代码行数:22,
示例27: uart_init// Function for initializing the UART module.void uart_init(){ 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, 256, 256, uart_event_handle, APP_IRQ_PRIORITY_LOW, err_code); APP_ERROR_CHECK(err_code);}
开发者ID:electronut,项目名称:nRF51-diwali-lamp,代码行数:23,
示例28: uart_config/** * @brief UART initialization. */void uart_config(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_DISABLED, false, UART_BAUDRATE_BAUDRATE_Baud38400 }; APP_UART_FIFO_INIT(&comm_params, UART_RX_BUF_SIZE, UART_TX_BUF_SIZE, uart_events_handler, APP_IRQ_PRIORITY_LOW, err_code); APP_ERROR_CHECK(err_code);}
开发者ID:tkadom,项目名称:TWBLE,代码行数:26,
示例29: write_app_uart_init_with_pinsuint32_t write_app_uart_init_with_pins(uint8_t rts_pin_number, uint8_t txd_pin_number, uint8_t cts_pin_number, uint8_t rxd_pin_number, bool hwfc) {#ifdef WRITE_TO_APP_UART static bool already_initialized = false; if(already_initialized) { return NRF_ERROR_INVALID_STATE; } uint32_t err_code; const app_uart_comm_params_t comm_params = { rxd_pin_number, txd_pin_number, rts_pin_number, cts_pin_number, (hwfc ? APP_UART_FLOW_CONTROL_ENABLED : 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); already_initialized = true; nrf_delay_ms(100); return err_code;#else return NRF_SUCCESS;#endif}
开发者ID:NextPlayLabs,项目名称:nrf_utils,代码行数:37,
注:本文中的APP_UART_FIFO_INIT函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ APR_ASSERT_SUCCESS函数代码示例 C++ APP_TIMER_TICKS函数代码示例 |