src/eric7/MicroPython/MicroPythonCommandsInterface.py

branch
eric7
changeset 9755
1a09700229e7
parent 9751
606ac0e26533
child 9760
11245ac9c258
diff -r ddf0407d42be -r 1a09700229e7 src/eric7/MicroPython/MicroPythonCommandsInterface.py
--- a/src/eric7/MicroPython/MicroPythonCommandsInterface.py	Sun Feb 12 15:14:28 2023 +0100
+++ b/src/eric7/MicroPython/MicroPythonCommandsInterface.py	Sun Feb 12 18:11:20 2023 +0100
@@ -973,6 +973,20 @@
                     "    rtc.datetime(rtc_time[:7] + (0,))",
                 ]
             )
+        elif deviceType == "teensy":
+            # The pyb.RTC.datetime function takes the arguments in the
+            # order: (year, month, day, weekday, hour, minute, second,
+            # subseconds)
+            # https://docs.micropython.org/en/latest/library/machine.RTC.html
+            # #machine-rtc
+            set_time = "\n".join(
+                [
+                    "def set_time(rtc_time):",
+                    "    import machine",
+                    "    rtc = machine.RTC()",
+                    "    rtc.init(rtc_time[:7] + (0,))",
+                ]
+            )
         elif deviceType == "esp":
             # The machine.RTC documentation was incorrect and doesn't agree
             # with the code, so no link is presented here. The order of the

eric ide

mercurial