1.. _usb_device_stack_api: 2 3USB device stack API 4#################### 5 6API reference 7************* 8 9There are two ways to transmit data, using the 'low' level read/write API or 10the 'high' level transfer API. 11 12Low level API 13 To transmit data to the host, the class driver should call usb_write(). 14 Upon completion the registered endpoint callback will be called. Before 15 sending another packet the class driver should wait for the completion of 16 the previous write. When data is received, the registered endpoint callback 17 is called. usb_read() should be used for retrieving the received data. 18 For CDC ACM sample driver this happens via the OUT bulk endpoint handler 19 (cdc_acm_bulk_out) mentioned in the endpoint array (cdc_acm_ep_data). 20 21High level API 22 The usb_transfer method can be used to transfer data to/from the host. The 23 transfer API will automatically split the data transmission into one or more 24 USB transaction(s), depending endpoint max packet size. The class driver does 25 not have to implement endpoint callback and should set this callback to the 26 generic usb_transfer_ep_callback. 27 28.. doxygengroup:: _usb_device_core_api 29