LUFA and CDC_Device_Flush()

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

 

I am getting to know LUFA recently and I am learning it with a Virtual Comport Device. I would rate myself Beginner compared to some of the "freaks" in this forum.

 

While reading the documentation on sending Bytes, Strings or Data I notice that CDC_Device_Flush() should be called to flush the pending data to the host. "Bytes will be queued for transmission to the host until either the endpoint bank becomes full, or the CDC_Device_Flush() function is called."

http://www.fourwalledcubicle.com/files/LUFA/Doc/140928/html/group___group___u_s_b_class_c_d_c_device.html#gaafaaf90308fbfd0378bc7ab9a5d868e1

 

Despite the Documentation I do not see this implemented in all the tutorials, LUFA-Demos and even ASF Example Projects. And obviously it does communicate without. Can anybody give me a hint as when CDC_Device_Flush must be implemented?

 

Delcon

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The flushing is also performed in the CDC_Device_USBTask() function -- the intention being that you can queue up multiple characters into a single USB packet for faster transmission to the host at the expense of latency. If you want complete control over when the data is sent to the host, you can set the the NO_CLASS_DRIVER_AUTOFLUSH compile time option to disable automatic flushing inside CDC_Device_USBTask().

 

- Dean

Make Atmel Studio better with my free extensions. Open source and feedback welcome!