From 8a9287055902491a840a528de67a0d9d7e6d67da Mon Sep 17 00:00:00 2001 From: Tilman Sauerbeck Date: Mon, 6 Jan 2020 10:44:21 +0100 Subject: [PATCH] common: Add the storage module. --- SConscript.libcommon | 1 + src/common/lib.rs | 1 + src/common/storage.rs | 26 ++++++++++++++++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 src/common/storage.rs diff --git a/SConscript.libcommon b/SConscript.libcommon index 061400f..5f9ffe2 100644 --- a/SConscript.libcommon +++ b/SConscript.libcommon @@ -22,6 +22,7 @@ source_files_rs = [ 'src/common/gps.rs', 'src/common/fmt.rs', 'src/common/time.rs', + 'src/common/storage.rs', 'src/common/mx25l.rs', ] diff --git a/src/common/lib.rs b/src/common/lib.rs index e06cc33..72b261a 100644 --- a/src/common/lib.rs +++ b/src/common/lib.rs @@ -44,4 +44,5 @@ pub mod display; pub mod gps; pub mod fmt; pub mod time; +pub mod storage; pub mod mx25l; diff --git a/src/common/storage.rs b/src/common/storage.rs new file mode 100644 index 0000000..7f09446 --- /dev/null +++ b/src/common/storage.rs @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2020 Tilman Sauerbeck (tilman at code-monkey de) + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +pub trait Storage { + fn read(&self, address: usize, buffer: &mut [u8]); +} -- 2.30.2