Focus hooks shall follow the style guide more closely

Moved them to the a namespace much more fitting, and renamed the hooks too.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
pull/365/head
Gergely Nagy 8 years ago
parent c5980dc5a6
commit ae8cd514a2

@ -20,9 +20,10 @@
#include <Kaleidoscope-Focus.h>
#include "crc.h"
namespace FocusHooks {
namespace kaleidoscope {
namespace eeprom_settings {
bool settings(const char *command) {
bool settingsFocusHook(const char *command) {
enum {
ISVALID,
GETVERSION,
@ -43,23 +44,23 @@ bool settings(const char *command) {
switch (sub_command) {
case ISVALID:
Focus.printBool(EEPROMSettings.isValid());
Focus.printBool(::EEPROMSettings.isValid());
Serial.println();
break;
case GETVERSION:
Serial.println(EEPROMSettings.version());
Serial.println(::EEPROMSettings.version());
break;
case CRC:
Serial.print(::CRC.crc, HEX);
Serial.print(F("/"));
Serial.println(EEPROMSettings.crc(), HEX);
Serial.println(::EEPROMSettings.crc(), HEX);
break;
}
return true;
}
bool eeprom(const char *command) {
bool eepromFocusHook(const char *command) {
enum {
CONTENTS,
FREE,
@ -91,7 +92,7 @@ bool eeprom(const char *command) {
break;
}
case FREE:
Serial.println(EEPROM.length() - EEPROMSettings.used());
Serial.println(EEPROM.length() - ::EEPROMSettings.used());
break;
}
@ -99,3 +100,5 @@ bool eeprom(const char *command) {
}
}
}

@ -20,16 +20,22 @@
#include <Kaleidoscope.h>
namespace FocusHooks {
bool settings(const char *command);
bool eeprom(const char *command);
};
namespace kaleidoscope {
namespace eeprom_settings {
#define FOCUS_HOOK_SETTINGS FOCUS_HOOK(FocusHooks::settings, \
bool settingsFocusHook(const char *command);
bool eepromFocusHook(const char *command);
}
}
#define FOCUS_HOOK_SETTINGS FOCUS_HOOK \
(kaleidoscope::eeprom_settings::settingsFocusHook, \
"settings.valid?\n" \
"settings.version\n" \
"settings.crc")
#define FOCUS_HOOK_EEPROM FOCUS_HOOK(FocusHooks::eeprom, \
#define FOCUS_HOOK_EEPROM FOCUS_HOOK \
(kalediscope::eeprom_settings::eepromFocusHook, \
"eeprom.free\n" \
"eeprom.contents")

Loading…
Cancel
Save