summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorhathach <[email protected]>2018-07-14 23:28:07 +0700
committerhathach <[email protected]>2018-07-14 23:28:07 +0700
commit19b6bbfd14778c5a1fd13d2c0665dfbaa49c9425 (patch)
treeef93c766e24b4aa0b4f72c9ad36175cd48976532 /src/common
parente0c4e11ea343e0189ccaa45591f42670962490fe (diff)
add device cdc wanted char callback, cdc peek
Diffstat (limited to 'src/common')
-rw-r--r--src/common/tusb_fifo.c10
-rw-r--r--src/common/tusb_fifo.h2
2 files changed, 6 insertions, 6 deletions
diff --git a/src/common/tusb_fifo.c b/src/common/tusb_fifo.c
index 03c0b63ab..09763bee0 100644
--- a/src/common/tusb_fifo.c
+++ b/src/common/tusb_fifo.c
@@ -166,7 +166,7 @@ uint16_t tu_fifo_read_n (tu_fifo_t* f, void * p_buffer, uint16_t count)
@param[in] f
Pointer to the FIFO buffer to manipulate
- @param[in] position
+ @param[in] pos
Position to read from in the FIFO buffer
@param[in] p_buffer
Pointer to the place holder for data read from the buffer
@@ -174,13 +174,13 @@ uint16_t tu_fifo_read_n (tu_fifo_t* f, void * p_buffer, uint16_t count)
@returns TRUE if the queue is not empty
*/
/******************************************************************************/
-bool tu_fifo_peek_at(tu_fifo_t* f, uint16_t position, void * p_buffer)
+bool tu_fifo_peek_at(tu_fifo_t* f, uint16_t pos, void * p_buffer)
{
if ( !tu_fifo_initalized(f) ) return false;
- if ( position >= f->count ) return false;
+ if ( pos >= f->count ) return false;
- // rd_idx is position=0
- uint16_t index = (f->rd_idx + position) % f->depth;
+ // rd_idx is pos=0
+ uint16_t index = (f->rd_idx + pos) % f->depth;
memcpy(p_buffer,
f->buffer + (index * f->item_size),
f->item_size);
diff --git a/src/common/tusb_fifo.h b/src/common/tusb_fifo.h
index d87b32395..1ddf3bd94 100644
--- a/src/common/tusb_fifo.h
+++ b/src/common/tusb_fifo.h
@@ -123,7 +123,7 @@ uint16_t tu_fifo_write_n (tu_fifo_t* f, void const * p_data, uint16_t count);
bool tu_fifo_read (tu_fifo_t* f, void * p_buffer);
uint16_t tu_fifo_read_n (tu_fifo_t* f, void * p_buffer, uint16_t count);
-bool tu_fifo_peek_at (tu_fifo_t* f, uint16_t position, void * p_buffer);
+bool tu_fifo_peek_at (tu_fifo_t* f, uint16_t pos, void * p_buffer);
static inline bool tu_fifo_peek(tu_fifo_t* f, void * p_buffer)
{