53 #include "app_usbd_nrf_dfu_trigger.h" 57 #ifndef BSP_SELF_PINRESET_PIN 58 #error "This module is intended to be used with boards that have the GP pin shortened with the RESET pin." 61 #define DFU_FLASH_PAGE_SIZE (NRF_FICR->CODEPAGESIZE) 62 #define DFU_FLASH_PAGE_COUNT (NRF_FICR->CODESIZE) 64 static uint8_t m_version_string[] =
"Contiki-NG DFU";
65 static app_usbd_nrf_dfu_trigger_nordic_info_t m_dfu_info;
68 dfu_trigger_evt_handler(app_usbd_class_inst_t
const *p_inst,
69 app_usbd_nrf_dfu_trigger_user_event_t event)
71 UNUSED_PARAMETER(p_inst);
74 case APP_USBD_NRF_DFU_TRIGGER_USER_EVT_DETACH:
75 nrf_gpio_cfg_output(BSP_SELF_PINRESET_PIN);
76 nrf_gpio_pin_clear(BSP_SELF_PINRESET_PIN);
83 APP_USBD_NRF_DFU_TRIGGER_GLOBAL_DEF(m_app_dfu,
84 NRF_DFU_TRIGGER_USB_INTERFACE_NUM,
85 &m_dfu_info, m_version_string,
86 dfu_trigger_evt_handler);
91 app_usbd_class_inst_t
const *class_dfu;
93 m_dfu_info.wAddress = CODE_START;
94 m_dfu_info.wFirmwareSize = CODE_SIZE;
95 m_dfu_info.wVersionMajor = 0;
96 m_dfu_info.wVersionMinor = 0;
97 m_dfu_info.wFirmwareID = 0;
98 m_dfu_info.wFlashPageSize = DFU_FLASH_PAGE_SIZE;
99 m_dfu_info.wFlashSize = m_dfu_info.wFlashPageSize * DFU_FLASH_PAGE_COUNT;
101 class_dfu = app_usbd_nrf_dfu_trigger_class_inst_get(&m_app_dfu);
102 app_usbd_class_append(class_dfu);
void dfu_trigger_usb_init(void)
Initialise the DFU trigger library.