25 #ifndef ACE_SEGMENT_WRITER_STRING_SCROLLER_H
26 #define ACE_SEGMENT_WRITER_STRING_SCROLLER_H
30 #include "StringWriter.h"
32 class __FlashStringHelper;
34 namespace ace_segment {
42 template <
typename T_LED_MODULE>
51 T_LED_MODULE&
ledModule() {
return mCharWriter.ledModule(); }
55 return mCharWriter.patternWriter();
62 uint8_t
size()
const {
return mCharWriter.size(); }
67 mIsFlashString =
false;
68 mStringLength = strlen(s);
76 mIsFlashString =
true;
77 mStringLength = strlen_P((
const char*) fs);
87 bool isDone = mStringPos >= mStringLength;
98 mIsFlashString =
false;
99 mStringLength = strlen(s);
100 mStringPos = mStringLength;
107 mIsFlashString =
true;
108 mStringLength = strlen_P((
const char*) fs);
109 mStringPos = mStringLength;
118 uint8_t numDigits =
size();
119 bool isDone = (mStringPos <= -numDigits);
133 uint8_t numDigits =
size();
134 int16_t stringPos = mStringPos;
136 for (uint8_t i = 0; i < numDigits; i++) {
138 if (stringPos < 0 || stringPos >= mStringLength) {
146 if (mIsFlashString) {
147 c = pgm_read_byte((
const uint8_t*) mString + stringPos);
149 c = *((
const char*) mString + stringPos);
152 mCharWriter.writeChar(c);
160 CharWriter<T_LED_MODULE>& mCharWriter;
163 uint8_t mStringLength;
The CharWriter supports mapping of an 8-bit character set to segment patterns supported by LedModule.
Write LED segment patterns to the underlying LedModule.