| 189 | self.count = 0 |
| 190 | |
| 191 | def put(self, byte): |
| 192 | logger.info("Put byte in FIFO") |
| 193 | |
| 194 | # Check if buffer is already full |
| 195 | if self.count == self.buff_size: |
| 196 | logger.info("FIFO is full") |
| 197 | return None |
| 198 | else: |
| 199 | self.data[self.idx_put] = byte |
| 200 | logger.debug(f"Byte {byte} inserted at position {self.idx_put}") |
| 201 | self.idx_put = (self.idx_put + 1) % self.buff_size |
| 202 | self.count += 1 |
| 203 | if (self.count >= self.threshold_size) and (self.threshold_size != 0): |
| 204 | self.threshold = 1 |
| 205 | return byte |
| 206 | |
| 207 | def get(self): |
| 208 | logger.info("Get byte from FIFO") |