FastLED 3.9.7
Loading...
Searching...
No Matches
bytestream.h
1#pragma once
2
3#include <stddef.h>
4#include <stdint.h>
5
6#include "fl/namespace.h"
7#include "fl/ptr.h"
8
9#include "crgb.h"
10
11namespace fl {
12
13FASTLED_SMART_PTR(ByteStream);
14
15// An abstract class that represents a stream of bytes.
16class ByteStream : public fl::Referent {
17 public:
18 virtual ~ByteStream() {}
19 virtual bool available(size_t) const = 0;
20 virtual size_t read(uint8_t *dst, size_t bytesToRead) = 0;
21 virtual const char *path() const = 0;
22 virtual void close() {} // default is do nothing on close.
23 // convenience functions
24 size_t readCRGB(CRGB *dst, size_t n) {
25 return read((uint8_t *)dst, n * 3) / 3;
26 }
27};
28
29
30
31} // namespace fl
Defines the red, green, and blue (RGB) pixel struct.
Implements the FastLED namespace macros.
Implements a simple red square effect for 2D LED grids.
Definition crgb.h:16
Representation of an RGB pixel (Red, Green, Blue)
Definition crgb.h:54