Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[ports/rp2] new machine_rtc.c module #6929

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 0 commits into from

Conversation

astrorafael
Copy link

I'm resubmitting PR #6923, hoping that this time will comply with the standars of coding and commits.

Although I was delighted to see micropython support in the new Raspberry Pi Pico, I as a bit surprised that there was no machine.RTC class for this port. So I took the plunge and began writting a basic machine_rtc.c module and learning in the process a bit about how to make an extension C module. This module is very basic for the time being (no interrupt handling) and conforms (I hope) to the interface documented in the MicroPython 1.14 official documentation.

The python test code is this:

from machine import RTC
from utime import sleep, sleep_ms

def test_main():
    rtc = RTC(0)
    print(rtc)
    print(rtc.now())
    remaining = rtc.alarm(0, 5000, repeat=False)
    while (remaining >0):
        print("{0:d} ms. left".format(remaining))
        sleep(1)
        remaining = rtc.alarm_left()
    print("done")

def test_cancel():
    rtc = RTC(0)
    print(rtc)
    print(rtc.now())
    remaining = rtc.alarm(0, 5000, repeat=False)
    while (remaining >0):
        print("{0:d} ms. left".format(remaining))
        sleep(1)
        remaining = rtc.alarm_left()
        rtc.cancel()

def test_1sec():
    rtc = RTC(0)
    rtc.init((2015, 1, 1, 1, 0, 0, 0, None))
    sleep_ms(1002)
    print(rtc.now())

@astrorafael
Copy link
Author

I'm really having a hard time trying to figure out what's wrong with my commit subject lines:

error: commit 50e057e: Subject line should contain ': ' and end in '.': ports/rp2: added basic machine.RTC class.
verify 8db8a1b
error: commit 8db8a1b: Subject line should contain ': ' and end in '.': micropython/.gitignore: ignore .vscode dir.
See https://github.com/micropython/micropython/blob/master/CODECONVENTIONS.md

@stinos
Copy link
Contributor

stinos commented Feb 19, 2021

Needs a capitalized verb after the ':'. See #6821

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants