api-hal-vcp.h 567 B

123456789101112131415161718192021222324
  1. #pragma once
  2. #include <stdbool.h>
  3. #include <stdint.h>
  4. #include <string.h>
  5. /* Init VCP HAL
  6. * Allocates ring buffer and initializes state
  7. */
  8. void api_hal_vcp_init();
  9. /* Recieve data from VCP
  10. * Waits till some data arrives, never returns 0
  11. * @param buffer - pointer to buffer
  12. * @param size - buffer size
  13. * @return items copied in buffer, 0 if channel closed
  14. */
  15. size_t api_hal_vcp_rx(uint8_t* buffer, size_t size);
  16. /* Transmit data to VCP
  17. * @param buffer - pointer to buffer
  18. * @param size - buffer size
  19. */
  20. void api_hal_vcp_tx(uint8_t* buffer, size_t size);