EasyManua.ls Logo

Waveshare NRF52840 - Page 42

Waveshare NRF52840
72 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
NRF52840 Eval Kit User Manual
Vision: V1.0.1 Date: 2019.01.19 42 / 72
In main.c file, the process to start NFC are that:
1. Set interrupt callback function and initialize NFC:
2. Encode NFC information
3. Load NFC information to NFC end
4. Start NRF
int main(void)
{
uint32_t len;
uint32_t err_code;
//Init log
log_init();
//Init led
bsp_board_init(BSP_INIT_LEDS);
//set NFC with a callback
err_code = nfc_t2t_setup(nfc_callback, NULL);
APP_ERROR_CHECK(err_code);
//provide available buffer size for encoding function
len = sizeof(m_ndef_msg_buf);
//Encode launchapp message into buffer
err_code = nfc_launchapp_msg_encode(m_android_package_name,
sizeof(m_android_package_name),
m_windows_application_id,
sizeof(m_windows_application_id),
m_ndef_msg_buf,
&len);
APP_ERROR_CHECK(err_code);
//Set created message as the NFC payload
err_code = nfc_t2t_payload_set(m_ndef_msg_buf, len);
APP_ERROR_CHECK(err_code);
//Start sensing NFC field
err_code = nfc_t2t_emulation_start();
APP_ERROR_CHECK(err_code);
while (1)
{
NRF_LOG_FLUSH();
__WFE();
}
}