diff --git a/src/buffer.h b/src/buffer.h index a71f777..bf31787 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -23,18 +23,18 @@ class Buffer { } /* - Shift buffer left and return index of the first empty element after the shift - - After elements are sent to display, first BRAILLE_CELLS elements are cleared, - but some non-empty elements may remain in the buffer - - e.g.: let brailleCells = 4 and Buffer::size = 7 - ----------------------------- 0 1 2 3 4 5 6 - initial state: ------------- | A | B | C | D | E | F | . | - after showBuffer(): -------- | . | . | . | . | E | F | . | ( ABCD on display ) - after shiftBufferLeft(): --- | E | F |[.]| . | . | . | . | - - [.] is the first empty element, its index is returned -> 2 + Shift buffer left and return index of the first empty element after the shift + + After elements are sent to display, first BRAILLE_CELLS elements are cleared, + but some non-empty elements may remain in the buffer + + e.g.: let brailleCells = 4 and Buffer::size = 7 + ----------------------------- 0 1 2 3 4 5 6 + initial state: ------------- | A | B | C | D | E | F | . | + after showBuffer(): -------- | . | . | . | . | E | F | . | ( ABCD on display ) + after shiftBufferLeft(): --- | E | F |[.]| . | . | . | . | + + [.] is the first empty element, its index is returned -> 2 */ byte shiftLeft() { byte to = 0; @@ -54,7 +54,7 @@ class Buffer { _contents[i] = EMPTY; } - void add(byte element); // defined in translation.h + void add(byte element); // defined in translation.h void add(byte element, byte& index) { _contents[index++] = element; } diff --git a/src/custom_config.h b/src/custom_config.h index 4bedc44..6126657 100644 --- a/src/custom_config.h +++ b/src/custom_config.h @@ -5,24 +5,24 @@ If you use PlatformIO, consider configuring it in `platformio.ini` first */ -// #define AUTO_PIN -// #define BUTTON_PIN -// #define DATA_PIN -// #define LATCH_PIN -// #define CLOCK_PIN +// #define AUTO_PIN // uint +// #define BUTTON_PIN // uint +// #define DATA_PIN // uint +// #define LATCH_PIN // uint +// #define CLOCK_PIN // uint -// #define BAUD_RATE +// #define BAUD_RATE // uint -// #define BUTTON_CLICK_MS -// #define BUTTON_CYCLE_MS +// #define BUTTON_CLICK_MS // uint +// #define BUTTON_CYCLE_MS // uint -// #define AUTOCOUNT_CELLS -// #define BRAILLE_CELLS +// #define AUTOCOUNT_CELLS // bool +// #define BRAILLE_CELLS // uint -// #define ANIMATION_ON_START -// #define ANIMATION_MS_PER_CELL +// #define ANIMATION_ON_START // bool +// #define ANIMATION_MS_PER_CELL // uint -// #define SERIAL_ECHO +// #define SERIAL_ECHO // bool -// #define LF_IS_EOM -// #define SERIAL_NA_IS_EOM +// #define LF_IS_EOM // bool +// #define SERIAL_NA_IS_EOM // bool diff --git a/src/utils.h b/src/utils.h index 47d8779..f7cd708 100644 --- a/src/utils.h +++ b/src/utils.h @@ -4,7 +4,7 @@ #include "patterns.h" -void _shiftOut(byte pattern) { +void _shiftOut(byte pattern=0) { digitalWrite(LATCH_PIN, LOW); shiftOut(DATA_PIN, CLOCK_PIN, MSBFIRST, pattern); digitalWrite(LATCH_PIN, HIGH); @@ -16,7 +16,7 @@ void countBrailleCells() { for (brailleCells = 0; digitalRead(AUTO_PIN); brailleCells++) { delay((ANIMATION_ON_START) ? ANIMATION_MS_PER_CELL : MIN_DELAY_MS); - _shiftOut(0); + _shiftOut(); } #else brailleCells = BRAILLE_CELLS; @@ -24,7 +24,7 @@ void countBrailleCells() { #if ANIMATION_ON_START for (byte i = 0; i < brailleCells; i++) { delay(ANIMATION_MS_PER_CELL); - _shiftOut(0); + _shiftOut(); } #endif #endif