Skip to content

Commit 2b00347

Browse files
committed
Merge remote-tracking branch 'adafruit/master' into es_lang
2 parents 64a333e + 9ad94f0 commit 2b00347

40 files changed

+215
-113
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
*.bin
88
*.map
99
*.hex
10-
!ports/nrf/**/bootloader/**/*.hex
1110
*.dis
1211
*.exe
1312

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ env:
3030
- TRAVIS_BOARD=pirkey_m0
3131
- TRAVIS_BOARD=gemma_m0
3232
- TRAVIS_BOARD=hallowing_m0_express
33-
- TRAVIS_BOARD=feather52832
33+
- TRAVIS_BOARD=feather_nrf52832
34+
- TRAVIS_BOARD=feather_nrf52840_express
3435

3536
addons:
3637
artifacts:
@@ -54,7 +55,7 @@ before_script:
5455
- ([[ -z "$TRAVIS_BOARD" || $TRAVIS_BOARD = "feather_huzzah" ]] || (wget https://s3.amazonaws.com/adafruit-circuit-python/gcc-arm-embedded_7-2018q2-1~trusty1_amd64.deb && sudo dpkg -i gcc-arm-embedded*_amd64.deb))
5556

5657
# For nrf builds
57-
- ([[ $TRAVIS_BOARD != "feather52832" && $TRAVIS_BOARD != "pca10056" ]] || sudo ports/nrf/drivers/bluetooth/download_ble_stack.sh)
58+
- ([[ $TRAVIS_BOARD != "feather_nrf52832" && $TRAVIS_BOARD != "feather_nrf52840_express" && $TRAVIS_BOARD != "pca10056" ]] || sudo ports/nrf/drivers/bluetooth/download_ble_stack.sh)
5859
# For huzzah builds
5960
- if [[ $TRAVIS_BOARD = "feather_huzzah" ]]; then wget https://github.com/jepler/esp-open-sdk/releases/download/2018-06-10/xtensa-lx106-elf-standalone.tar.gz && tar xavf xtensa-lx106-elf-standalone.tar.gz; PATH=$(readlink -f xtensa-lx106-elf/bin):$PATH; fi
6061
# For coverage testing (upgrade is used to get latest urllib3 version)

extmod/vfs_fat.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ STATIC mp_obj_t fat_vfs_stat(mp_obj_t vfs_in, mp_obj_t path_in) {
320320
} else {
321321
mode |= MP_S_IFREG;
322322
}
323-
mp_int_t seconds = timeutils_seconds_since_2000(
323+
mp_uint_t seconds = timeutils_seconds_since_epoch(
324324
1980 + ((fno.fdate >> 9) & 0x7f),
325325
(fno.fdate >> 5) & 0x0f,
326326
fno.fdate & 0x1f,
@@ -335,9 +335,9 @@ STATIC mp_obj_t fat_vfs_stat(mp_obj_t vfs_in, mp_obj_t path_in) {
335335
t->items[4] = MP_OBJ_NEW_SMALL_INT(0); // st_uid
336336
t->items[5] = MP_OBJ_NEW_SMALL_INT(0); // st_gid
337337
t->items[6] = mp_obj_new_int_from_uint(fno.fsize); // st_size
338-
t->items[7] = MP_OBJ_NEW_SMALL_INT(seconds); // st_atime
339-
t->items[8] = MP_OBJ_NEW_SMALL_INT(seconds); // st_mtime
340-
t->items[9] = MP_OBJ_NEW_SMALL_INT(seconds); // st_ctime
338+
t->items[7] = mp_obj_new_int_from_uint(seconds); // st_atime
339+
t->items[8] = mp_obj_new_int_from_uint(seconds); // st_mtime
340+
t->items[9] = mp_obj_new_int_from_uint(seconds); // st_ctime
341341

342342
return MP_OBJ_FROM_PTR(t);
343343
}

lib/timeutils/timeutils.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,17 @@ mp_uint_t timeutils_seconds_since_2000(mp_uint_t year, mp_uint_t month,
158158
+ (year - 2000) * 31536000;
159159
}
160160

161+
void timeutils_seconds_since_epoch_to_struct_time(mp_uint_t t, timeutils_struct_time_t *tm) {
162+
t -= EPOCH1970_EPOCH2000_DIFF_SECS;
163+
timeutils_seconds_since_2000_to_struct_time(t, tm);
164+
}
165+
166+
mp_uint_t timeutils_seconds_since_epoch(mp_uint_t year, mp_uint_t month, mp_uint_t date,
167+
mp_uint_t hour, mp_uint_t minute, mp_uint_t second) {
168+
mp_uint_t t = timeutils_seconds_since_2000(year, month, date, hour, minute, second);
169+
return t + EPOCH1970_EPOCH2000_DIFF_SECS;
170+
}
171+
161172
mp_uint_t timeutils_mktime(mp_uint_t year, mp_int_t month, mp_int_t mday,
162173
mp_int_t hours, mp_int_t minutes, mp_int_t seconds) {
163174

@@ -211,5 +222,5 @@ mp_uint_t timeutils_mktime(mp_uint_t year, mp_int_t month, mp_int_t mday,
211222
year++;
212223
}
213224
}
214-
return timeutils_seconds_since_2000(year, month, mday, hours, minutes, seconds);
225+
return timeutils_seconds_since_epoch(year, month, mday, hours, minutes, seconds);
215226
}

lib/timeutils/timeutils.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
#ifndef MICROPY_INCLUDED_LIB_TIMEUTILS_TIMEUTILS_H
2828
#define MICROPY_INCLUDED_LIB_TIMEUTILS_TIMEUTILS_H
2929

30+
#define EPOCH1970_EPOCH2000_DIFF_SECS 946684800
31+
3032
typedef struct _timeutils_struct_time_t {
3133
uint16_t tm_year; // i.e. 2014
3234
uint8_t tm_mon; // 1..12
@@ -48,6 +50,11 @@ void timeutils_seconds_since_2000_to_struct_time(mp_uint_t t,
4850
mp_uint_t timeutils_seconds_since_2000(mp_uint_t year, mp_uint_t month,
4951
mp_uint_t date, mp_uint_t hour, mp_uint_t minute, mp_uint_t second);
5052

53+
void timeutils_seconds_since_epoch_to_struct_time(mp_uint_t t, timeutils_struct_time_t *tm);
54+
55+
mp_uint_t timeutils_seconds_since_epoch(mp_uint_t year, mp_uint_t month, mp_uint_t date,
56+
mp_uint_t hour, mp_uint_t minute, mp_uint_t second);
57+
5158
mp_uint_t timeutils_mktime(mp_uint_t year, mp_int_t month, mp_int_t mday,
5259
mp_int_t hours, mp_int_t minutes, mp_int_t seconds);
5360

lib/tinyusb

Submodule tinyusb updated 47 files

ports/atmel-samd/fatfs_port.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,13 @@
2828
#include "py/runtime.h"
2929
#include "lib/oofatfs/ff.h" /* FatFs lower layer API */
3030
#include "lib/oofatfs/diskio.h" /* FatFs lower layer API */
31+
#include "lib/timeutils/timeutils.h"
32+
#include "shared-bindings/rtc/RTC.h"
3133

3234
DWORD get_fattime(void) {
33-
// TODO(tannewt): Support the RTC.
34-
return ((2016 - 1980) << 25) | ((9) << 21) | ((1) << 16) | ((16) << 11) | ((43) << 5) | (35 / 2);
35+
timeutils_struct_time_t tm;
36+
common_hal_rtc_get_time(&tm);
37+
38+
return ((tm.tm_year - 1980) << 25) | (tm.tm_mon << 21) | (tm.tm_mday << 16) |
39+
(tm.tm_hour << 11) | (tm.tm_min << 5) | (tm.tm_sec >> 1);
3540
}

ports/nrf/README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ the following links:
3636
> **NOTE**: These board specific readmes may be more up to date than the
3737
generic board-neutral documentation further down.
3838

39-
* Adafruit [Feather nRF52](boards/feather52/README.md): 512KB Flash, 64KB SRAM
40-
* Adafruit [Feather nRF52840](boards/feather52840/README.md): 1MB Flash, 256KB SRAM
41-
* Nordic PCA10056 see [Feather nRF52840](boards/feather52840/README.md)
39+
* Adafruit [Feather nRF52](boards/feather_nrf52832/README.md): 512KB Flash, 64KB SRAM
40+
* Adafruit [Feather nRF52840](boards/feather_nrf52840_express/README.md): 1MB Flash, 256KB SRAM
41+
* Nordic PCA10056 see [Feather nRF52840](boards/pca10056/README.md)
4242

4343
For all other board targets, see the generic notes below.
4444

@@ -74,12 +74,12 @@ Note: further tuning of features to include in bluetooth or even setting up the
7474

7575
## Target Boards and Make Flags
7676

77-
Target Board (BOARD) | Bluetooth Stack (SD) | Bluetooth Support | Flash Util
78-
---------------------|-------------------------|------------------------|-------------------------------
79-
pca10040 | s132 | Peripheral and Scanner | [Segger](#segger-targets)
80-
feather52832 | s132 | Peripheral and Scanner | [UART DFU](#dfu-targets)
81-
pca10056 | s140 | Peripheral and Scanner | [Segger](#segger-targets)
82-
feather52840 | s140 | Peripheral and Scanner | [UART DFU](#dfu-targets)
77+
Target Board (BOARD) | Bluetooth Stack (SD) | Bluetooth Support | Flash Util
78+
-------------------------|-------------------------|------------------------|-------------------------------
79+
pca10040 | s132 | Peripheral and Scanner | [Segger](#segger-targets)
80+
pca10056 | s140 | Peripheral and Scanner | [Segger](#segger-targets)
81+
feather_nrf52832 | s132 | Peripheral and Scanner | [UART DFU](#dfu-targets)
82+
feather_nrf52840_express | s140 | Peripheral and Scanner | UF2 bootloader
8383

8484
## Segger Targets
8585

@@ -107,10 +107,10 @@ run follow command to install [adafruit-nrfutil](https://github.com/adafruit/Ada
107107
* dfu-gen: Generates a Firmware zip to be used by the DFU flash application.
108108
* dfu-flash: Triggers the DFU flash application to upload the firmware from the generated Firmware zip file.
109109

110-
Example on how to generate and flash feather52832 target:
110+
Example on how to generate and flash feather_nrf52832 target:
111111

112-
make BOARD=feather52832 SD=s132
113-
make BOARD=feather52832 SD=s132 dfu-gen dfu-flash
112+
make BOARD=feather_nrf52832 SD=s132
113+
make BOARD=feather_nrf52832 SD=s132 dfu-gen dfu-flash
114114

115115
## Bluetooth LE REPL
116116

ports/nrf/boards/adafruit_nrf52840_s140_v6.ld

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
GNU linker script for NRF52840 w/S140 6.0.0 SoftDevice
2+
GNU linker script for NRF52840 w/S140 6.x.x SoftDevice
33

44
MEMORY MAP
55
------------------------------------------------------------------------
@@ -17,7 +17,7 @@
1717
0x00000000..0x00000FFF (4KB) Master Boot Record
1818
*/
1919

20-
/* Specify the memory areas (S140 6.0.0) */
20+
/* Specify the memory areas (S140 6.x.x) */
2121
MEMORY
2222
{
2323
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x100000

ports/nrf/boards/feather52832/mpconfigboard.mk

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)