diff options
-rw-r--r-- | hid/lib/drivers-avr/eeprom.h | 16 | ||||
-rw-r--r-- | hid/lib/drivers-avr/factory.cpp | 4 | ||||
-rw-r--r-- | hid/lib/drivers/storage.h | 8 | ||||
-rw-r--r-- | hid/src/main.cpp | 4 |
4 files changed, 16 insertions, 16 deletions
diff --git a/hid/lib/drivers-avr/eeprom.h b/hid/lib/drivers-avr/eeprom.h index 7868f03d..f43b86f4 100644 --- a/hid/lib/drivers-avr/eeprom.h +++ b/hid/lib/drivers-avr/eeprom.h @@ -19,22 +19,22 @@ # # *****************************************************************************/ -#include "storage.h" -#ifdef HID_DYNAMIC + #include <avr/eeprom.h> -#endif -namespace DRIVERS { +#include "storage.h" + +namespace DRIVERS { struct Eeprom : public Storage { using Storage::Storage; - void read_block (void *_dst, const void *_src, size_t _n) override { - eeprom_read_block(_dst, _src, _n); + void readBlock(void *dest, const void *src, size_t size) override { + eeprom_read_block(dest, src, size); } - void update_block (const void *_src, void *_dst, size_t _n) override { - eeprom_update_block(_src, _dst, _n); + void updateBlock(const void *src, void *dest, size_t size) override { + eeprom_update_block(src, dest, size); } }; } diff --git a/hid/lib/drivers-avr/factory.cpp b/hid/lib/drivers-avr/factory.cpp index c6968777..989f4e2b 100644 --- a/hid/lib/drivers-avr/factory.cpp +++ b/hid/lib/drivers-avr/factory.cpp @@ -57,9 +57,9 @@ namespace DRIVERS { return new Mouse(DRIVERS::DUMMY); } } + Storage* Factory::makeStorage(type _type) { - switch (_type) - { + switch (_type) { # ifdef HID_DYNAMIC case NON_VOLATILE_STORAGE: return new Eeprom(DRIVERS::NON_VOLATILE_STORAGE); diff --git a/hid/lib/drivers/storage.h b/hid/lib/drivers/storage.h index 74c4f62a..4f04f3c1 100644 --- a/hid/lib/drivers/storage.h +++ b/hid/lib/drivers/storage.h @@ -19,16 +19,16 @@ # # *****************************************************************************/ + #pragma once #include "driver.h" -namespace DRIVERS { - +namespace DRIVERS { struct Storage : public Driver { using Driver::Driver; - virtual void read_block (void *_dst, const void *_src, size_t _n) {} - virtual void update_block (const void *_src, void *_dst, size_t _n) {} + virtual void readBlock(void *dest, const void *src, size_t size) {} + virtual void updateBlock(const void *src, void *dest, size_t size) {} }; } diff --git a/hid/src/main.cpp b/hid/src/main.cpp index 99c533b3..6f84fbc2 100644 --- a/hid/src/main.cpp +++ b/hid/src/main.cpp @@ -54,7 +54,7 @@ static DRIVERS::Storage *_storage = nullptr; static int _readOutputs(void) { uint8_t data[8]; - _storage->read_block(data, 0, 8); + _storage->readBlock(data, 0, 8); if (data[0] != PROTO::MAGIC || PROTO::crc16(data, 6) != PROTO::merge8(data[6], data[7])) { return -1; } @@ -73,7 +73,7 @@ static void _writeOutputs(uint8_t mask, uint8_t outputs, bool force) { data[0] = PROTO::MAGIC; data[1] = (old & ~mask) | outputs; PROTO::split16(PROTO::crc16(data, 6), &data[6], &data[7]); - _storage->read_block(data, 0, 8); + _storage->updateBlock(data, 0, 8); } #endif |