This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef FABOOH | |
#include <Streaming.h> | |
#include "ringbuffer_simple.h" | |
#define sizeofs(a) sizeof((a))/sizeof((a[0])) | |
#else | |
serial_usart_isr_t<115200, CPU::frequency, TX1_PIN, RX1_PIN> Serial1; | |
USART_IRQHandler(1, Serial1) | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RingBuffer(val capacity: Int) { | |
private val storage = ByteArray(capacity) | |
/** | |
* Convenient version of [read]. | |
* This method allocates new array every time. Do not use this in heavy loop. | |
* | |
* @param startPosition Start position. Can be over than capacity. | |
* @param size Result data size. |