/** * @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); err_code = NRF_LOG_INIT(NULL); 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_set(BSP_INDICATE_USER_STATE_OFF); NRF_LOG_INFO("Wait for first packet\r\n"); APP_ERROR_CHECK(err_code); NRF_LOG_FLUSH(); while (true) { uint32_t received = read_packet(); err_code = bsp_indication_set(BSP_INDICATE_RCV_OK); NRF_LOG_INFO("Packet was received\r\n"); APP_ERROR_CHECK(err_code); NRF_LOG_INFO("The contents of the package is %u\r\n", (unsigned int)received); NRF_LOG_FLUSH(); } }
/** * @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(); } }
/** * @brief Function for application main entry. */ int main(void) { uint32_t err_code = NRF_SUCCESS; clock_initialization(); APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, NULL); uart_init(); bsp_configuration(); err_code = bsp_indication_text_set(actual_state,indications_list[actual_state]); APP_ERROR_CHECK(err_code); while (true) { // no implementation needed } }
/** * @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); } }