Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
fifo.h@1:f2f253bec95e, 2018-12-11 (annotated)
- Committer:
- jeffyromney
- Date:
- Tue Dec 11 17:00:28 2018 +0000
- Revision:
- 1:f2f253bec95e
- Parent:
- 0:3c704483eb79
Made 16 bit
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| gert_lauritsen | 0:3c704483eb79 | 1 | #ifndef FIFO_H_ |
| gert_lauritsen | 0:3c704483eb79 | 2 | #define FIFO_H_ |
| gert_lauritsen | 0:3c704483eb79 | 3 | |
| gert_lauritsen | 0:3c704483eb79 | 4 | #include "LPC17xx.h" |
| gert_lauritsen | 0:3c704483eb79 | 5 | |
| jeffyromney | 1:f2f253bec95e | 6 | #define FIFO_SIZE 16 |
| jeffyromney | 1:f2f253bec95e | 7 | #define FIFO_TYPE uint16_t |
| gert_lauritsen | 0:3c704483eb79 | 8 | |
| gert_lauritsen | 0:3c704483eb79 | 9 | class fifo |
| gert_lauritsen | 0:3c704483eb79 | 10 | { |
| gert_lauritsen | 0:3c704483eb79 | 11 | FIFO_TYPE buffer[FIFO_SIZE]; |
| gert_lauritsen | 0:3c704483eb79 | 12 | uint32_t head, tail; |
| gert_lauritsen | 0:3c704483eb79 | 13 | |
| gert_lauritsen | 0:3c704483eb79 | 14 | public: |
| gert_lauritsen | 0:3c704483eb79 | 15 | fifo(); |
| gert_lauritsen | 0:3c704483eb79 | 16 | uint8_t put(FIFO_TYPE data);// returns 0 on success |
| gert_lauritsen | 0:3c704483eb79 | 17 | uint8_t get(FIFO_TYPE* data); |
| gert_lauritsen | 0:3c704483eb79 | 18 | uint32_t available(); |
| gert_lauritsen | 0:3c704483eb79 | 19 | uint32_t free(); |
| gert_lauritsen | 0:3c704483eb79 | 20 | }; |
| gert_lauritsen | 0:3c704483eb79 | 21 | |
| gert_lauritsen | 0:3c704483eb79 | 22 | |
| gert_lauritsen | 0:3c704483eb79 | 23 | #endif /* FIFO_H_ */ |