971 " import pyb", |
971 " import pyb", |
972 " rtc = pyb.RTC()", |
972 " rtc = pyb.RTC()", |
973 " rtc.datetime(rtc_time[:7] + (0,))", |
973 " rtc.datetime(rtc_time[:7] + (0,))", |
974 ] |
974 ] |
975 ) |
975 ) |
|
976 elif deviceType == "teensy": |
|
977 # The pyb.RTC.datetime function takes the arguments in the |
|
978 # order: (year, month, day, weekday, hour, minute, second, |
|
979 # subseconds) |
|
980 # https://docs.micropython.org/en/latest/library/machine.RTC.html |
|
981 # #machine-rtc |
|
982 set_time = "\n".join( |
|
983 [ |
|
984 "def set_time(rtc_time):", |
|
985 " import machine", |
|
986 " rtc = machine.RTC()", |
|
987 " rtc.init(rtc_time[:7] + (0,))", |
|
988 ] |
|
989 ) |
976 elif deviceType == "esp": |
990 elif deviceType == "esp": |
977 # The machine.RTC documentation was incorrect and doesn't agree |
991 # The machine.RTC documentation was incorrect and doesn't agree |
978 # with the code, so no link is presented here. The order of the |
992 # with the code, so no link is presented here. The order of the |
979 # arguments is the same as the pyboard except for LoBo MPy. |
993 # arguments is the same as the pyboard except for LoBo MPy. |
980 set_time = "\n".join( |
994 set_time = "\n".join( |