case APP_USBD_CDC_ACM_USER_EVT_RX_DONE:{ret_code_t ret;uint8_t index =1;do{/*Get amount of data transferred*/size_t size =app_usbd_cdc_acm_rx_size(p_cdc_acm);/* Fetch data until internal buffer is empty */
ret =app_usbd_cdc_acm_read(&m_app_cdc_acm,&m_cdc_data_array[index],1);if(ret == NRF_SUCCESS){
index++;}}while(ret == NRF_SUCCESS);NRF_LOG_HEXDUMP_INFO(m_cdc_data_array,index);break;}
下载后需要修改USB Vendor ID和Product ID 以下是NRF52840例程sdk_config.h中定义的USB Vendor ID和Product ID
// <s> APP_USBD_VID - Vendor ID.// <i> Note: This value is not editable in Configuration Wizard.// <i> Vendor ID ordered from USB IF: http://www.usb.org/developers/vendor/#ifndefAPP_USBD_VID#defineAPP_USBD_VID0x1915#endif// <s> APP_USBD_PID - Product ID.// <i> Note: This value is not editable in Configuration Wizard.// <i> Selected Product ID#ifndefAPP_USBD_PID#defineAPP_USBD_PID0x521A#endif
打开下载后的安卓工程,修改CustomProber.java中的USB Vendor ID和Product ID