Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
4f8eeaed
Commit
4f8eeaed
authored
Jun 11, 2015
by
Daniel Campora
Browse files
cc3200: Set WLAN date/time via the rtc.datetime method().
WLAN needs time info when validating certificates.
parent
d680e28a
Changes
1
Hide whitespace changes
Inline
Side-by-side
cc3200/mods/pybrtc.c
View file @
4f8eeaed
...
...
@@ -25,7 +25,7 @@
* THE SOFTWARE.
*/
#include
<std
io
.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
]);
//
S
kip the weekday
//
s
kip 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
;
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment