From 0fb6fc05a53981f8936b69874a0c5932fa1b613e Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Sun, 22 May 2016 22:23:14 +0200 Subject: [PATCH] further changes to trezor.storage --- extmod/modtrezorstorage/modtrezorstorage.c | 6 ++++-- extmod/modtrezorstorage/storage-stmhal.h | 8 ++++++++ extmod/modtrezorstorage/storage-unix.h | 6 ++++++ extmod/modtrezorstorage/storage.c | 12 ++++++++++++ extmod/modtrezorstorage/storage.h | 11 +++++++++++ src/trezor/storage.py | 9 ++++----- vendor/micropython | 2 +- 7 files changed, 46 insertions(+), 8 deletions(-) create mode 100644 extmod/modtrezorstorage/storage-stmhal.h create mode 100644 extmod/modtrezorstorage/storage-unix.h create mode 100644 extmod/modtrezorstorage/storage.c create mode 100644 extmod/modtrezorstorage/storage.h diff --git a/extmod/modtrezorstorage/modtrezorstorage.c b/extmod/modtrezorstorage/modtrezorstorage.c index 33d0f14e26..d3846a7392 100644 --- a/extmod/modtrezorstorage/modtrezorstorage.c +++ b/extmod/modtrezorstorage/modtrezorstorage.c @@ -16,6 +16,8 @@ #if MICROPY_PY_TREZORSTORAGE +#include "storage.h" + typedef struct _mp_obj_Storage_t { mp_obj_base_t base; } mp_obj_Storage_t; @@ -27,12 +29,12 @@ STATIC mp_obj_t mod_TrezorStorage_Storage_make_new(const mp_obj_type_t *type, si return MP_OBJ_FROM_PTR(o); } -STATIC mp_obj_t mod_TrezorStorage_Storage_get(mp_obj_t self, mp_obj_t name, mp_obj_t defval) { +STATIC mp_obj_t mod_TrezorStorage_Storage_get(mp_obj_t self, mp_obj_t key, mp_obj_t defval) { return mp_const_none; } STATIC MP_DEFINE_CONST_FUN_OBJ_3(mod_TrezorStorage_Storage_get_obj, mod_TrezorStorage_Storage_get); -STATIC mp_obj_t mod_TrezorStorage_Storage_set(mp_obj_t self, mp_obj_t name, mp_obj_t value) { +STATIC mp_obj_t mod_TrezorStorage_Storage_set(mp_obj_t self, mp_obj_t key, mp_obj_t value) { return mp_const_none; } STATIC MP_DEFINE_CONST_FUN_OBJ_3(mod_TrezorStorage_Storage_set_obj, mod_TrezorStorage_Storage_set); diff --git a/extmod/modtrezorstorage/storage-stmhal.h b/extmod/modtrezorstorage/storage-stmhal.h new file mode 100644 index 0000000000..001a2bd497 --- /dev/null +++ b/extmod/modtrezorstorage/storage-stmhal.h @@ -0,0 +1,8 @@ +/* + * Copyright (c) Pavol Rusnak, SatoshiLabs + * + * Licensed under Microsoft Reference Source License (Ms-RSL) + * see LICENSE.md file for details + */ + +#include STM32_HAL_H diff --git a/extmod/modtrezorstorage/storage-unix.h b/extmod/modtrezorstorage/storage-unix.h new file mode 100644 index 0000000000..c6e0a3731a --- /dev/null +++ b/extmod/modtrezorstorage/storage-unix.h @@ -0,0 +1,6 @@ +/* + * Copyright (c) Pavol Rusnak, SatoshiLabs + * + * Licensed under Microsoft Reference Source License (Ms-RSL) + * see LICENSE.md file for details + */ diff --git a/extmod/modtrezorstorage/storage.c b/extmod/modtrezorstorage/storage.c new file mode 100644 index 0000000000..97b414b800 --- /dev/null +++ b/extmod/modtrezorstorage/storage.c @@ -0,0 +1,12 @@ +/* + * Copyright (c) Pavol Rusnak, SatoshiLabs + * + * Licensed under Microsoft Reference Source License (Ms-RSL) + * see LICENSE.md file for details + */ + +#if defined STM32_HAL_H +#include "storage-stmhal.h" +#else +#include "storage-unix.h" +#endif diff --git a/extmod/modtrezorstorage/storage.h b/extmod/modtrezorstorage/storage.h new file mode 100644 index 0000000000..29d61a9ced --- /dev/null +++ b/extmod/modtrezorstorage/storage.h @@ -0,0 +1,11 @@ +/* + * Copyright (c) Pavol Rusnak, SatoshiLabs + * + * Licensed under Microsoft Reference Source License (Ms-RSL) + * see LICENSE.md file for details + */ + +#ifndef __STORAGE_H__ +#define __STORAGE_H__ + +#endif diff --git a/src/trezor/storage.py b/src/trezor/storage.py index a058a75253..47a57ab937 100644 --- a/src/trezor/storage.py +++ b/src/trezor/storage.py @@ -2,10 +2,9 @@ from TrezorStorage import Storage _storage = Storage() - -def get(name, defval=None): - return _storage.get(name, defval) +def get(key, defval=None): + return _storage.get(key, defval) -def set(name, value): - return _storage.set(name, value) +def set(key, value): + return _storage.set(key, value) diff --git a/vendor/micropython b/vendor/micropython index daf5c296c3..9cee3cdb8f 160000 --- a/vendor/micropython +++ b/vendor/micropython @@ -1 +1 @@ -Subproject commit daf5c296c3ff98cb9f043b365b478ede586ee5d1 +Subproject commit 9cee3cdb8fc0444e292308cbbabee12e98e2fd07