diff options
| author | hathach <[email protected]> | 2013-01-16 22:37:10 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2013-01-16 22:37:10 +0700 |
| commit | 53739ccd28478144ce9cde9d16410175a79a518d (patch) | |
| tree | 95aa55a0709ebb7cb7bd0e1ee552f05287ef3728 /tinyusb/common | |
| parent | 095129887e58cc2445afc1e2c10512e87c2c65ff (diff) | |
rename some fifo functions to be more consistent
Diffstat (limited to 'tinyusb/common')
| -rw-r--r-- | tinyusb/common/fifo.c | 8 | ||||
| -rw-r--r-- | tinyusb/common/fifo.h | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/tinyusb/common/fifo.c b/tinyusb/common/fifo.c index 756de638e..ff64d3c52 100644 --- a/tinyusb/common/fifo.c +++ b/tinyusb/common/fifo.c @@ -115,7 +115,7 @@ bool fifo_init(fifo_t* f, uint8_t* buffer, uint16_t size, bool overwritable, IRQ /**************************************************************************/ bool fifo_read(fifo_t* f, uint8_t *data) { - if (fifo_isEmpty(f)) + if (fifo_is_empty(f)) return false; mutex_lock(f); @@ -143,7 +143,7 @@ bool fifo_read(fifo_t* f, uint8_t *data) @returns The actual number of bytes read from the FIFO */ /**************************************************************************/ -uint16_t fifo_readArray(fifo_t* f, uint8_t* rx, uint16_t maxlen) +uint16_t fifo_read_n(fifo_t* f, uint8_t* rx, uint16_t maxlen) { uint16_t len = 0; @@ -175,7 +175,7 @@ uint16_t fifo_readArray(fifo_t* f, uint8_t* rx, uint16_t maxlen) /**************************************************************************/ bool fifo_write(fifo_t* f, uint8_t data) { - if ( fifo_isFull(f) && f->overwritable == false) + if ( fifo_is_full(f) && f->overwritable == false) return false; mutex_lock(f); @@ -183,7 +183,7 @@ bool fifo_write(fifo_t* f, uint8_t data) f->buf[f->wr_ptr] = data; f->wr_ptr = (f->wr_ptr + 1) % f->size; - if (fifo_isFull(f)) + if (fifo_is_full(f)) { f->rd_ptr = f->wr_ptr; // keep the full state (rd == wr && len = size) }else diff --git a/tinyusb/common/fifo.h b/tinyusb/common/fifo.h index c79299352..c753e1d39 100644 --- a/tinyusb/common/fifo.h +++ b/tinyusb/common/fifo.h @@ -72,20 +72,20 @@ typedef struct _fifo_t bool fifo_init(fifo_t* f, uint8_t* buffer, uint16_t size, bool overwritable, IRQn_Type irq); bool fifo_write(fifo_t* f, uint8_t data); bool fifo_read(fifo_t* f, uint8_t *data); -uint16_t fifo_readArray(fifo_t* f, uint8_t * rx, uint16_t maxlen); +uint16_t fifo_read_n(fifo_t* f, uint8_t * rx, uint16_t maxlen); void fifo_clear(fifo_t *f); -static inline bool fifo_isEmpty(fifo_t* f) +static inline bool fifo_is_empty(fifo_t* f) { return (f->len == 0); } -static inline bool fifo_isFull(fifo_t* f) +static inline bool fifo_is_full(fifo_t* f) { return (f->len == f->size); } -static inline uint16_t fifo_getLength(fifo_t* f) +static inline uint16_t fifo_get_length(fifo_t* f) { return f->len; } |
