← index #2701PR #5419
Related · high · value 1.086
QUERY · ISSUE

ESP8266 RTC.irq method rejects arguments. Missing RTC constants in machine module.

openby peterhinchopened 2016-12-19updated 2024-08-28
port-esp8266

Testing was done with a build using code of 27th Nov. I couldn't update because of https://github.com/micropython/micropython/issues/2700. Pasting the following:

import machine
import micropython
micropython.alloc_emergency_exception_buf(100)

def alarm_handler(rtc_o):
   print("Hello from alarm_handler")

rtc = machine.RTC()
rtc.alarm(machine.RTC.ALARM0, 10000)
rtc_i = rtc.irq(trigger=machine.RTC.ALARM0, handler=alarm_handler, wake=machine.DEEPSLEEP)

produced (from rtc_i = rtc.irq(args))

Traceback (most recent call last):
  File "<stdin>", line 10, in <module>
TypeError: extra keyword arguments given
>>> 

[EDIT]Further testing indicates that it objects to the handler arg. Is this not yet implemented?

The constants IDLE and SLEEP are missing from the machine module.

CANDIDATE · PULL REQUEST

[ESP8266] [Documentation] Add note that machine.RTC is not fully sup…

closedby oceanitesopened 2019-12-14updated 2019-12-17
docsport-esp8266

For the ESP8266 port, some methods of machine.RTC are not supported.

Add a note in the ESP8266 documentation, that RTC.now(), RTC.init(), RTC.deinit() and RTC.irq() with a handler keyword is currently not supported.

Supported are only RTC.ALARM0, RTC.alarm(), RTC.alarm_left(), RTC.datetime(), RTC.irq() and RTC.memory():

>>> from machine import rtc
>>> rtc = RTC()
>>> dir(rtc)
['__class__', 'ALARM0', 'alarm', 'alarm_left', 'datetime', 'irq', 'memory']

This is mentioned in #3220, #3710 and in #2701.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied