make astyle

pull/365/head
Jesse Vincent 8 years ago
parent 59c361e6c8
commit e3dc58f384
No known key found for this signature in database
GPG Key ID: 122F5DF7108E4046

@ -21,7 +21,7 @@
#include "crc.h" #include "crc.h"
namespace FocusHooks { namespace FocusHooks {
bool settings (const char *command) { bool settings (const char *command) {
enum { enum {
ISVALID, ISVALID,
GETVERSION, GETVERSION,
@ -56,9 +56,9 @@ namespace FocusHooks {
} }
return true; return true;
} }
bool eeprom (const char *command) { bool eeprom (const char *command) {
enum { enum {
CONTENTS, CONTENTS,
FREE, FREE,
@ -95,5 +95,5 @@ namespace FocusHooks {
} }
return true; return true;
} }
}; };

@ -21,8 +21,8 @@
#include <Kaleidoscope.h> #include <Kaleidoscope.h>
namespace FocusHooks { namespace FocusHooks {
bool settings (const char *command); bool settings (const char *command);
bool eeprom (const char *command); bool eeprom (const char *command);
}; };
#define FOCUS_HOOK_SETTINGS FOCUS_HOOK(FocusHooks::settings, \ #define FOCUS_HOOK_SETTINGS FOCUS_HOOK(FocusHooks::settings, \

@ -20,33 +20,33 @@
#include "crc.h" #include "crc.h"
namespace KaleidoscopePlugins { namespace KaleidoscopePlugins {
struct EEPROMSettings::settings EEPROMSettings::settings; struct EEPROMSettings::settings EEPROMSettings::settings;
bool EEPROMSettings::_isValid; bool EEPROMSettings::_isValid;
bool EEPROMSettings::sealed; bool EEPROMSettings::sealed;
uint16_t EEPROMSettings::nextStart = sizeof (EEPROMSettings::settings); uint16_t EEPROMSettings::nextStart = sizeof (EEPROMSettings::settings);
EEPROMSettings::EEPROMSettings (void) { EEPROMSettings::EEPROMSettings (void) {
} }
void void
EEPROMSettings::begin (void) { EEPROMSettings::begin (void) {
EEPROM.get (0, settings); EEPROM.get (0, settings);
} }
bool bool
EEPROMSettings::isValid (void) { EEPROMSettings::isValid (void) {
return _isValid; return _isValid;
} }
uint16_t uint16_t
EEPROMSettings::crc (void) { EEPROMSettings::crc (void) {
if (sealed) if (sealed)
return settings.crc; return settings.crc;
return 0; return 0;
} }
void void
EEPROMSettings::seal (void) { EEPROMSettings::seal (void) {
sealed = true; sealed = true;
CRC.finalize (); CRC.finalize ();
@ -62,10 +62,10 @@ namespace KaleidoscopePlugins {
if (settings.crc != CRC.crc) if (settings.crc != CRC.crc)
_isValid = false; _isValid = false;
} }
uint16_t uint16_t
EEPROMSettings::requestSlice (uint16_t size) { EEPROMSettings::requestSlice (uint16_t size) {
if (sealed) if (sealed)
return 0; return 0;
@ -75,36 +75,36 @@ namespace KaleidoscopePlugins {
CRC.update ((const void *)&size, sizeof (size)); CRC.update ((const void *)&size, sizeof (size));
return start; return start;
} }
void void
EEPROMSettings::invalidate (void) { EEPROMSettings::invalidate (void) {
_isValid = false; _isValid = false;
} }
uint16_t uint16_t
EEPROMSettings::used (void) { EEPROMSettings::used (void) {
return nextStart; return nextStart;
} }
void void
EEPROMSettings::update (void) { EEPROMSettings::update (void) {
settings.crc = CRC.crc; settings.crc = CRC.crc;
EEPROM.put (0, settings); EEPROM.put (0, settings);
_isValid = true; _isValid = true;
} }
uint8_t uint8_t
EEPROMSettings::version (void) { EEPROMSettings::version (void) {
return settings.version; return settings.version;
} }
void void
EEPROMSettings::version (uint8_t ver) { EEPROMSettings::version (uint8_t ver) {
settings.version = ver; settings.version = ver;
update (); update ();
} }
}; };
KaleidoscopePlugins::EEPROMSettings EEPROMSettings; KaleidoscopePlugins::EEPROMSettings EEPROMSettings;

@ -22,7 +22,7 @@
#include <EEPROM.h> #include <EEPROM.h>
namespace KaleidoscopePlugins { namespace KaleidoscopePlugins {
class EEPROMSettings : public KaleidoscopePlugin { class EEPROMSettings : public KaleidoscopePlugin {
public: public:
EEPROMSettings (void); EEPROMSettings (void);
@ -49,7 +49,7 @@ namespace KaleidoscopePlugins {
uint8_t version; uint8_t version;
uint16_t crc; uint16_t crc;
} settings; } settings;
}; };
}; };
extern KaleidoscopePlugins::EEPROMSettings EEPROMSettings; extern KaleidoscopePlugins::EEPROMSettings EEPROMSettings;

@ -44,8 +44,7 @@ CRC_::reflect (uint8_t len) {
} }
void void
CRC_::update (const void *data, uint8_t len) CRC_::update (const void *data, uint8_t len) {
{
const uint8_t *d = (const uint8_t *)data; const uint8_t *d = (const uint8_t *)data;
uint8_t i; uint8_t i;
bool bit; bool bit;

@ -38,7 +38,9 @@ class CRC_ {
CRC_ (void) {}; CRC_ (void) {};
void update (const void *data, uint8_t len); void update (const void *data, uint8_t len);
void finalize (void) { reflect (16); }; void finalize (void) {
reflect (16);
};
void reflect (uint8_t len); void reflect (uint8_t len);
}; };

Loading…
Cancel
Save