mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2025-12-13 13:09:49 +04:00
[FL-1061] iButton save and load from sd card (#394)
* SD App: fix queue adresses * sd-filesystem: fix making path on file select event * ibutton: add key reading from sd card * ibutton: save ibutton key to sd card * ibutton: add deleting keys from sd card * ibutton: remove KeyStore from application * ibutton: make directory if necessary on key save Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com> Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
@@ -28,12 +28,16 @@ iButtonApp::iButtonApp() {
|
||||
api_hal_power_insomnia_enter();
|
||||
|
||||
key_worker = new KeyWorker(&ibutton_gpio);
|
||||
sd_ex_api = static_cast<SdCard_Api*>(furi_record_open("sdcard-ex"));
|
||||
fs_api = static_cast<FS_Api*>(furi_record_open("sdcard"));
|
||||
|
||||
// we need random
|
||||
srand(DWT->CYCCNT);
|
||||
}
|
||||
|
||||
iButtonApp::~iButtonApp() {
|
||||
furi_record_close("sdcard-ex");
|
||||
furi_record_close("sdcard");
|
||||
api_hal_power_insomnia_exit();
|
||||
}
|
||||
|
||||
@@ -107,6 +111,22 @@ iButtonKey* iButtonApp::get_key() {
|
||||
return &key;
|
||||
}
|
||||
|
||||
SdCard_Api* iButtonApp::get_sd_ex_api() {
|
||||
return sd_ex_api;
|
||||
}
|
||||
|
||||
FS_Api* iButtonApp::get_fs_api() {
|
||||
return fs_api;
|
||||
}
|
||||
|
||||
char* iButtonApp::get_file_name() {
|
||||
return file_name;
|
||||
}
|
||||
|
||||
uint8_t iButtonApp::get_file_name_size() {
|
||||
return file_name_size;
|
||||
}
|
||||
|
||||
void iButtonApp::notify_init() {
|
||||
// TODO open record
|
||||
const GpioPin* vibro_record = &vibro_gpio;
|
||||
@@ -193,18 +213,6 @@ uint8_t iButtonApp::get_text_store_size() {
|
||||
return text_store_size;
|
||||
}
|
||||
|
||||
KeyStore* iButtonApp::get_key_store() {
|
||||
return &store;
|
||||
}
|
||||
|
||||
uint8_t iButtonApp::get_stored_key_index() {
|
||||
return key_index;
|
||||
}
|
||||
|
||||
void iButtonApp::set_stored_key_index(uint8_t _index) {
|
||||
key_index = _index;
|
||||
}
|
||||
|
||||
void iButtonApp::generate_random_name(char* name, uint8_t max_name_size) {
|
||||
const uint8_t prefix_size = 9;
|
||||
const char* prefix[prefix_size] = {
|
||||
|
||||
Reference in New Issue
Block a user