SmoothProgress 1.0.0
Displays smooth progress bars on a character based LCD displays for Arduino
barstyle.h
1#ifndef BAR_STYLE_STRUCT
2#define BAR_STYLE_STRUCT
3
4// Part of the SmoothProgress library for Arduino
5// Defines a structure containing bit-masks defining a style for a smooth progress bar
6// to be used with SmoothProgress library
7// https://github.com/Gjorgjevikj/SmoothProgress.git
8
9// some utility functions ...
10// creates bit-mask with N LSB bits set to 1
11template <uint8_t N>
12constexpr uint8_t MaskLSBs()
13{
14 return MaskLSBs<N - 1>() << 1 | 1;
15}
16
17template <>
18constexpr uint8_t MaskLSBs<0>()
19{
20 return 0;
21}
22
23template <>
24constexpr uint8_t MaskLSBs<1>()
25{
26 return 1;
27}
28
40{
41 enum dotMatrixDim : byte { CharPatRows = 8, CharPatCols = 5 };
42 enum bitMasks : byte { AllRows = MaskLSBs<CharPatRows>(), AllCols = MaskLSBs<CharPatCols>() };
43 enum andOrMaskIndex : byte { ANDmask, ORmask };
44 enum orientation : byte { Horizontal, Vertical }; // Progress bar orientation
45 uint8_t startMask[2][CharPatRows]; // Left/Bottom-AND+OR mask
46 uint8_t endMask[2][CharPatRows]; // Right/Top-AND+OR mask
47 uint8_t middleMask[2][CharPatRows]; // Middle-AND+OR mask
48 struct bspar // where the filling of the progress bar actually starts/ends considering that some pixels are taken for the frame
49 {
50 unsigned char startOffset : 3;
51 unsigned char endOffset : 3;
52 unsigned char dir : 2; // used for orientation (possibly direction ...)
53 } stylePar;
54};
55
56// character creator - https://tusindfryd.github.io/screenduino/
57// another character creator - https://maxpromer.github.io/LCD-Character-Creator/
58
59
60#endif //BAR_STYLE_STRUCT
Definition: barstyle.h:49
Structure holding the bit-masks and other data used for drawing the edges of the progress bar that de...
Definition: barstyle.h:40