8000 Merge pull request #5340 from tannewt/ble_file_modification · unwiredben/circuitpython@6bf0db7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6bf0db7

Browse files
authored
Merge pull request adafruit#5340 from tannewt/ble_file_modification
BLE file service v4
2 parents 9b2d8ad + 4659102 commit 6bf0db7

File tree

4 files changed

+258
-53
lines changed

4 files changed

+258
-53
lines changed

ports/nrf/fatfs_port.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@
3030
#include "shared-bindings/rtc/RTC.h"
3131
#include "shared-bindings/time/__init__.h"
3232

33+
DWORD _time_override = 0;
3334
DWORD get_fattime(void) {
35+
if (_time_override > 0) {
36+
return _time_override;
37+
}
3438
#if CIRCUITPY_RTC
3539
timeutils_struct_time_t tm;
3640
common_hal_rtc_get_time(&tm);
@@ -40,3 +44,7 @@ DWORD get_fattime(void) {
4044
return ((2016 - 1980) << 25) | ((9) << 21) | ((1) << 16) | ((16) << 11) | ((43) << 5) | (35 / 2);
4145
#endif
4246
}
47+
48+
void override_fattime(DWORD time) {
49+
_time_override = time;
50+
}

supervisor/fatfs_port.h

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* This file is part of the MicroPython project, http://micropython.org/
3+
*
4+
* The MIT License (MIT)
5+
*
6+
* Copyright (c) 2021 Scott Shawcroft for Adafruit Industries
7+
*
8+
* Permission is hereby granted, free of charge, to any person obtaining a copy
9+
* of this software and associated documentation files (the "Software"), to deal
10+
* in the Software without restriction, including without limitation the rights
11+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
* copies of the Software, and to permit persons to whom the Software is
13+
* furnished to do so, subject to the following conditions:
14+
*
15+
* The above copyright notice and this permission notice shall be included in
16+
* all copies or substantial portions of the Software.
17+
*
18+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24+
* THE SOFTWARE.
25+
*/
26+
27+
#ifndef MICROPY_INCLUDED_SUPERVISOR_FATFS_PORT_H
28+
#define MICROPY_INCLUDED_SUPERVISOR_FATFS_PORT_H
29+
30+
#include "lib/oofatfs/ff.h"
31+
32+
void override_fattime(DWORD time);
33+
34+
#endif // MICROPY_INCLUDED_SUPERVISOR_FATFS_PORT_H

0 commit comments

Comments
 (0)
0