diff options
author | Daniel Campora <daniel@wipy.io> | 2015-06-11 15:43:53 +0200 |
---|---|---|
committer | Daniel Campora <daniel@wipy.io> | 2015-07-02 16:29:43 +0200 |
commit | 4f8eeaedef1e65a48c91c8e7b4b6fa2c03abb5ee (patch) | |
tree | c5ffd9adf7e357cfd288a8cddeffea3164a4a0b1 | |
parent | d680e28a11cd5081bd8c0ebe12d5879b1f7e024e (diff) | |
download | micropython-4f8eeaedef1e65a48c91c8e7b4b6fa2c03abb5ee.tar.gz micropython-4f8eeaedef1e65a48c91c8e7b4b6fa2c03abb5ee.zip |
cc3200: Set WLAN date/time via the rtc.datetime method().
WLAN needs time info when validating certificates.
-rw-r--r-- | cc3200/mods/pybrtc.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/cc3200/mods/pybrtc.c b/cc3200/mods/pybrtc.c index 1cd0f9b89e..32231b9088 100644 --- a/cc3200/mods/pybrtc.c +++ b/cc3200/mods/pybrtc.c @@ -25,7 +25,7 @@ * THE SOFTWARE. */ -#include <stdio.h> +#include <std.h> #include "py/mpconfig.h" #include MICROPY_HAL_H @@ -40,6 +40,7 @@ #include "pybsleep.h" #include "mpcallback.h" #include "timeutils.h" +#include "simplelink.h" /// \moduleref pyb /// \class RTC - real time clock @@ -177,7 +178,7 @@ mp_obj_t pyb_rtc_datetime(mp_uint_t n_args, const mp_obj_t *args) { tm.tm_year = mp_obj_get_int(items[0]); tm.tm_mon = mp_obj_get_int(items[1]); tm.tm_mday = mp_obj_get_int(items[2]); - // Skip the weekday + // skip the weekday tm.tm_hour = mp_obj_get_int(items[4]); tm.tm_min = mp_obj_get_int(items[5]); tm.tm_sec = mp_obj_get_int(items[6]); @@ -187,6 +188,15 @@ mp_obj_t pyb_rtc_datetime(mp_uint_t n_args, const mp_obj_t *args) { mseconds = RTC_U16MS_CYCLES(mseconds); MAP_PRCMRTCSet(seconds, mseconds); + // set simplelink's time and date, this is needed to verify certificates + SlDateTime_t sl_datetime = {0}; + sl_datetime.sl_tm_day = tm.tm_mday; + sl_datetime.sl_tm_mon = tm.tm_mon; + sl_datetime.sl_tm_year = tm.tm_year; + sl_datetime.sl_tm_hour = tm.tm_hour; + sl_datetime.sl_tm_min = tm.tm_min; + sl_datetime.sl_tm_sec = tm.tm_sec; + sl_DevSet(SL_DEVICE_GENERAL_CONFIGURATION, SL_DEVICE_GENERAL_CONFIGURATION_DATE_TIME, sizeof(SlDateTime_t), (_u8 *)(&sl_datetime)); return mp_const_none; } } |