2020-11-16 10:16:34 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2020-12-02 10:47:13 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2021-03-24 09:35:33 +00:00
|
|
|
/**
|
|
|
|
* Init VCP HAL
|
2020-11-16 10:16:34 +00:00
|
|
|
* Allocates ring buffer and initializes state
|
|
|
|
*/
|
2021-08-08 18:03:25 +00:00
|
|
|
void furi_hal_vcp_init();
|
2020-11-16 10:16:34 +00:00
|
|
|
|
2021-03-24 09:35:33 +00:00
|
|
|
/**
|
|
|
|
* Recieve data from VCP
|
2020-11-16 10:16:34 +00:00
|
|
|
* Waits till some data arrives, never returns 0
|
|
|
|
* @param buffer - pointer to buffer
|
|
|
|
* @param size - buffer size
|
|
|
|
* @return items copied in buffer, 0 if channel closed
|
|
|
|
*/
|
2021-08-08 18:03:25 +00:00
|
|
|
size_t furi_hal_vcp_rx(uint8_t* buffer, size_t size);
|
2020-11-16 10:16:34 +00:00
|
|
|
|
2021-04-19 16:36:45 +00:00
|
|
|
/**
|
|
|
|
* Recieve data from VCP with timeout
|
|
|
|
* Waits till some data arrives during timeout
|
|
|
|
* @param buffer - pointer to buffer
|
|
|
|
* @param size - buffer size
|
|
|
|
* @param timeout - rx timeout in ms
|
|
|
|
* @return items copied in buffer, 0 if channel closed or timeout occurs
|
|
|
|
*/
|
2021-08-08 18:03:25 +00:00
|
|
|
size_t furi_hal_vcp_rx_with_timeout(uint8_t* buffer, size_t size, uint32_t timeout);
|
2021-04-19 16:36:45 +00:00
|
|
|
|
2021-03-24 09:35:33 +00:00
|
|
|
/**
|
|
|
|
* Transmit data to VCP
|
2020-11-16 10:16:34 +00:00
|
|
|
* @param buffer - pointer to buffer
|
|
|
|
* @param size - buffer size
|
|
|
|
*/
|
2021-08-08 18:03:25 +00:00
|
|
|
void furi_hal_vcp_tx(const uint8_t* buffer, size_t size);
|
2020-12-02 10:47:13 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|