-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathcommbuffer.h
More file actions
29 lines (27 loc) · 771 Bytes
/
commbuffer.h
File metadata and controls
29 lines (27 loc) · 771 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#pragma once
#include <Arduino.h>
#include "config.h"
#ifdef USE_CAN
#include "esp32_can_local.h"
#endif
class CommBuffer
{
public:
CommBuffer();
size_t numAvailableBytes();
uint8_t* getBufferedBytes();
void clearBufferedBytes();
#ifdef USE_CAN
void sendFrameToBuffer(CAN_FRAME &frame, int whichBus);
#ifdef USE_CANFD
void sendFrameToBuffer(CAN_FRAME_FD &frame, int whichBus);
#endif
#endif
void sendBytesToBuffer(uint8_t *bytes, size_t length);
void sendByteToBuffer(uint8_t byt);
void sendString(String str);
void sendCharString(char *str);
protected:
byte transmitBuffer[WIFI_BUFF_SIZE];
int transmitBufferLength; //not creating a ring buffer. The buffer should be large enough to never overflow
};