mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-12-23 19:23:09 +00:00
239c174610
* irda: add ir_tx command * api-hal-vcp: add receive with timeout * cli: add command termination check function * irda: add cli_rx command * cli: reduce timeout for Ctrl+C command check * irda: fix ir_rx command * irda: add ir_tx cli command hints Co-authored-by: あく <alleteam@gmail.com>
45 lines
1,008 B
C
45 lines
1,008 B
C
#pragma once
|
|
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
#include <string.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/**
|
|
* Init VCP HAL
|
|
* Allocates ring buffer and initializes state
|
|
*/
|
|
void api_hal_vcp_init();
|
|
|
|
/**
|
|
* Recieve data from VCP
|
|
* 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
|
|
*/
|
|
size_t api_hal_vcp_rx(uint8_t* buffer, size_t size);
|
|
|
|
/**
|
|
* 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
|
|
*/
|
|
size_t api_hal_vcp_rx_with_timeout(uint8_t* buffer, size_t size, uint32_t timeout);
|
|
|
|
/**
|
|
* Transmit data to VCP
|
|
* @param buffer - pointer to buffer
|
|
* @param size - buffer size
|
|
*/
|
|
void api_hal_vcp_tx(const uint8_t* buffer, size_t size);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|