api-hal-vcp.h 642 B

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