SerialBufferAdapter new setBuffer function

Serial Fixed Array List Adapter documentation adapted
SinglyLinkedList setEnd() function added
This commit is contained in:
Robin Müller 2020-01-18 16:48:33 +01:00
parent c9e4c73bd2
commit 6fe0f45c27
4 changed files with 12 additions and 1 deletions

View File

@ -58,6 +58,11 @@ public:
virtual void setNext(LinkedElement* next) {
this->next = next;
}
void setEnd() {
this->next = NULL;
}
LinkedElement* begin() {
return this;
}

View File

@ -123,6 +123,11 @@ void SerialBufferAdapter<T>::setBuffer(uint8_t * buffer_, T bufferLength_) {
bufferLength = bufferLength_;
}
template<typename T>
void SerialBufferAdapter<T>::setBuffer(uint32_t * buffer_, T bufferLength_) {
buffer = reinterpret_cast<uint8_t *>(buffer_);
bufferLength = 4 * bufferLength_;
}
//forward Template declaration for linker
template class SerialBufferAdapter<uint8_t>;

View File

@ -59,6 +59,7 @@ public:
uint8_t * getBuffer();
const uint8_t * getConstBuffer();
void setBuffer(uint8_t * buffer_, T bufferLength_);
void setBuffer(uint32_t * buffer_, T bufferLength_);
private:
enum bufferType {

View File

@ -15,7 +15,7 @@
*
* 1. Buffers with a size header inside that class can be declared with
* SerialFixedArrayListAdapter<BUFFER_TYPE, MAX_BUFFER_LENGTH, LENGTH_FIELD_TYPE>.
* 2. MAX_BUFFER_LENGTH specifies the maximum allowed value for the buffer size.
* 2. MAX_BUFFER_LENGTH specifies the maximum allowed number of elements in FixedArrayList
* 3. LENGTH_FIELD_TYPE specifies the data type of the buffer header containing the buffer size
* (defaults to 1 byte length field) that follows
*