gd32: Add a GD32Flash storage driver

Signed-off-by: Gergely Nagy <algernon@keyboard.io>
pull/1086/head
Gergely Nagy 3 years ago committed by Jesse Vincent
parent a524bd21a6
commit 17ba4fb8e8
No known key found for this signature in database
GPG Key ID: 122F5DF7108E4046

@ -22,12 +22,17 @@
#include <Arduino.h> #include <Arduino.h>
#include "kaleidoscope/device/Base.h" #include "kaleidoscope/device/Base.h"
#include "kaleidoscope/driver/storage/GD32Flash.h"
namespace kaleidoscope { namespace kaleidoscope {
namespace device { namespace device {
namespace gd32 { namespace gd32 {
struct EvalStorageProps: kaleidoscope::driver::storage::GD32FlashProps {};
struct EvalProps: kaleidoscope::device::BaseProps { struct EvalProps: kaleidoscope::device::BaseProps {
typedef EvalStorageProps StorageProps;
typedef kaleidoscope::driver::storage::GD32Flash<StorageProps> Storage;
static constexpr const char *short_name = "GD32Eval"; static constexpr const char *short_name = "GD32Eval";
}; };

@ -0,0 +1,47 @@
/* -*- mode: c++ -*-
* kaleidoscope::driver::storage::GD32Flash -- Storage driver with GD32 flash backend
* Copyright (C) 2021 Keyboard.io, Inc
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#if defined(ARDUINO_ARCH_GD32) || defined(KALEIDOSCOPE_VIRTUAL_BUILD)
#include "kaleidoscope/driver/storage/Base.h"
#include "FlashStorage.h"
#include "FlashAsEEPROM.h"
namespace kaleidoscope {
namespace driver {
namespace storage {
struct GD32FlashProps : kaleidoscope::driver::storage::BaseProps {
static constexpr uint16_t length = 10240;
};
template <typename _StorageProps>
class GD32Flash: public EEPROMClass<_StorageProps::length> {
public:
void setup() {
EEPROMClass<_StorageProps::length>::begin();
}
void commit() {}
};
} // namespace storage
} // namespace driver
} // namespace kaleidoscope
#endif
Loading…
Cancel
Save