/ src / usb / usb.h
usb.h
 1  #pragma once
 2  
 3  #include "app_usbd.h"
 4  #include "usb_listener.h"
 5  
 6  namespace usb
 7  {
 8  	namespace device
 9  	{
10  		struct class_info_t
11  		{
12  			const app_usbd_class_inst_t* classInstance;
13  			const void* context;
14  			const char* name;
15  		};
16  
17  		using EventCallback = void (*)(app_usbd_event_type_t);
18  		bool Initialize(bool supportsPowerDetection = true);
19  		bool IsInitialized();
20  		bool Enable();
21  		bool Disable();
22  		bool IsEnabled();
23  		bool RegisterDeviceClass(const class_info_t* const deviceClass);
24  		bool RegisterListener(Listener* listener);
25  
26  		// Update should be called in the main loop before or after __WFE.
27  		void Update();
28  
29  		const uint8_t* const GetSerialNumber();
30  
31  	} // namespace device
32  } // namespace Usb