examples: Simplify some of the examples

Instead of using `Kaleidoscope.serialPort()` in every example, introduce a
helper variable in some cases, to make the coder nicer to read.

Signed-off-by: Gergely Nagy <algernon@keyboard.io>
pull/710/head
Gergely Nagy 5 years ago
parent e6c25db24c
commit d4674d428d
No known key found for this signature in database
GPG Key ID: AC1E90BAC433F68F

@ -42,16 +42,18 @@ KEYMAPS(
KALEIDOSCOPE_INIT_PLUGINS(EEPROMSettings);
void setup() {
Kaleidoscope.serialPort().begin(9600);
auto &serial_port = Kaleidoscope.serialPort();
serial_port.begin(9600);
Kaleidoscope.setup();
while (!Kaleidoscope.serialPort()) {
while (!serial_port) {
}
Kaleidoscope.serialPort().println(EEPROMSettings.isValid() ? F("valid EEPROM settings") : F("invalid EEPROM settings"));
Kaleidoscope.serialPort().println(EEPROMSettings.crc(), HEX);
Kaleidoscope.serialPort().println(EEPROMSettings.version());
serial_port.println(EEPROMSettings.isValid() ? F("valid EEPROM settings") : F("invalid EEPROM settings"));
serial_port.println(EEPROMSettings.crc(), HEX);
serial_port.println(EEPROMSettings.version());
}
void loop() {

@ -43,12 +43,14 @@ KEYMAPS(
KALEIDOSCOPE_INIT_PLUGINS(EEPROMSettings, HostOS);
void setup() {
Kaleidoscope.serialPort().begin(9600);
auto &serial_port = Kaleidoscope.serialPort();
serial_port.begin(9600);
Kaleidoscope.setup();
Kaleidoscope.serialPort().print("Host OS id is: ");
Kaleidoscope.serialPort().println(HostOS.os(), DEC);
serial_port.print("Host OS id is: ");
serial_port.println(HostOS.os(), DEC);
}
void loop() {

@ -39,12 +39,14 @@ KEYMAPS(
)
// *INDENT-ON*
auto &serial_port = Kaleidoscope.serialPort();
static void leaderTestA(uint8_t seq_index) {
Kaleidoscope.serialPort().println(F("leaderTestA"));
serial_port.println(F("leaderTestA"));
}
static void leaderTestAA(uint8_t seq_index) {
Kaleidoscope.serialPort().println(F("leaderTestAA"));
serial_port.println(F("leaderTestAA"));
}
static const kaleidoscope::plugin::Leader::dictionary_t leader_dictionary[] PROGMEM =

Loading…
Cancel
Save