Use FIFO size as condition.
This commit is contained in:
24
src/class/vendor/vendor_device.h
vendored
24
src/class/vendor/vendor_device.h
vendored
@@ -33,12 +33,14 @@
|
||||
#define CFG_TUD_VENDOR_EPSIZE 64
|
||||
#endif
|
||||
|
||||
#ifndef CFG_TUD_VENDOR_USE_RX_FIFO
|
||||
#define CFG_TUD_VENDOR_USE_RX_FIFO 1
|
||||
/* RX FIFO can be disabled by setting this value to 0, related API will also be disabled */
|
||||
#ifndef CFG_TUD_VENDOR_RX_BUFSIZE
|
||||
#define CFG_TUD_VENDOR_RX_BUFSIZE 64
|
||||
#endif
|
||||
|
||||
#ifndef CFG_TUD_VENDOR_USE_TX_FIFO
|
||||
#define CFG_TUD_VENDOR_USE_TX_FIFO 1
|
||||
/* TX FIFO can be disabled by setting this value to 0, related API will also be disabled */
|
||||
#ifndef CFG_TUD_VENDOR_TX_BUFSIZE
|
||||
#define CFG_TUD_VENDOR_TX_BUFSIZE 64
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -50,7 +52,7 @@
|
||||
//--------------------------------------------------------------------+
|
||||
bool tud_vendor_n_mounted (uint8_t itf);
|
||||
|
||||
#if CFG_TUD_VENDOR_USE_RX_FIFO
|
||||
#if CFG_TUD_VENDOR_RX_BUFSIZE > 0
|
||||
uint32_t tud_vendor_n_available (uint8_t itf);
|
||||
uint32_t tud_vendor_n_read (uint8_t itf, void* buffer, uint32_t bufsize);
|
||||
bool tud_vendor_n_peek (uint8_t itf, uint8_t* ui8);
|
||||
@@ -58,13 +60,13 @@ void tud_vendor_n_read_flush (uint8_t itf);
|
||||
#endif
|
||||
|
||||
uint32_t tud_vendor_n_write (uint8_t itf, void const* buffer, uint32_t bufsize);
|
||||
#if CFG_TUD_VENDOR_USE_TX_FIFO
|
||||
#if CFG_TUD_VENDOR_TX_BUFSIZE > 0
|
||||
uint32_t tud_vendor_n_write_flush (uint8_t itf);
|
||||
uint32_t tud_vendor_n_write_available (uint8_t itf);
|
||||
#endif
|
||||
static inline uint32_t tud_vendor_n_write_str (uint8_t itf, char const* str);
|
||||
|
||||
#if CFG_TUD_VENDOR_USE_TX_FIFO
|
||||
#if CFG_TUD_VENDOR_TX_BUFSIZE > 0
|
||||
// backward compatible
|
||||
#define tud_vendor_n_flush(itf) tud_vendor_n_write_flush(itf)
|
||||
#endif
|
||||
@@ -73,7 +75,7 @@ static inline uint32_t tud_vendor_n_write_str (uint8_t itf, char const* str);
|
||||
// Application API (Single Port)
|
||||
//--------------------------------------------------------------------+
|
||||
static inline bool tud_vendor_mounted (void);
|
||||
#if CFG_TUD_VENDOR_USE_RX_FIFO
|
||||
#if CFG_TUD_VENDOR_RX_BUFSIZE > 0
|
||||
static inline uint32_t tud_vendor_available (void);
|
||||
static inline uint32_t tud_vendor_read (void* buffer, uint32_t bufsize);
|
||||
static inline bool tud_vendor_peek (uint8_t* ui8);
|
||||
@@ -81,7 +83,7 @@ static inline void tud_vendor_read_flush (void);
|
||||
#endif
|
||||
static inline uint32_t tud_vendor_write (void const* buffer, uint32_t bufsize);
|
||||
static inline uint32_t tud_vendor_write_str (char const* str);
|
||||
#if CFG_TUD_VENDOR_USE_TX_FIFO
|
||||
#if CFG_TUD_VENDOR_TX_BUFSIZE > 0
|
||||
static inline uint32_t tud_vendor_write_available (void);
|
||||
static inline uint32_t tud_vendor_write_flush (void);
|
||||
|
||||
@@ -111,7 +113,7 @@ static inline bool tud_vendor_mounted (void)
|
||||
return tud_vendor_n_mounted(0);
|
||||
}
|
||||
|
||||
#if CFG_TUD_VENDOR_USE_RX_FIFO
|
||||
#if CFG_TUD_VENDOR_RX_BUFSIZE > 0
|
||||
static inline uint32_t tud_vendor_available (void)
|
||||
{
|
||||
return tud_vendor_n_available(0);
|
||||
@@ -143,7 +145,7 @@ static inline uint32_t tud_vendor_write_str (char const* str)
|
||||
return tud_vendor_n_write_str(0, str);
|
||||
}
|
||||
|
||||
#if CFG_TUD_VENDOR_USE_TX_FIFO
|
||||
#if CFG_TUD_VENDOR_TX_BUFSIZE > 0
|
||||
static inline uint32_t tud_vendor_write_flush (void)
|
||||
{
|
||||
return tud_vendor_n_write_flush(0);
|
||||
|
||||
Reference in New Issue
Block a user