Skip to main content

Timer is module ported from micropython's machine.Timer and adapted to work with Python

Project description

Timer

Version 1.0

Description

Timer is module ported from micropython's machine.Timer and adapted to work with Python

Timer(tid)

Returns a timer object with the folowing functions

init(period,mode,interrupt,callback)

Sets the timers data

period (int):

timer length in milliseconds.

mode (var):

Can be the folowing

  • Timer.ONE_SHOT: A timer that only runs once
  • Timer.PERIODIC: A timer that runs forever until deinitalized

interrupt (bool)

Defaults to False
Whether to interupt main before executing callback

callback (object)

The function to call when the timer is finished.

cancel()

Cancels the timer and waits to be re-initalized

start()

Starts the timer

pause()

Pauses the timer

reset()

Restarts the timer from 0

deinit()

Kills the timer and removes it form memory.

dump()

Kills the timer while keeping its data in memory.

setCallback(callback)

Set's the timers callback.

callback (object)

The function to call when the timer is finished.

status()

Returns the timer status

Constants

  • Timer.ONE_SHOT: A timer that only runs once
  • Timer.PERIODIC: A timer that runs forever until deinitalized
  • Timer.NOT_RUNNING: The timer is not started
  • Timer.PAUSED: The timer is paused
  • Timer.FINISHED: The timer is finished
  • Timer.DUMPED:The timer was dumped

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mptimer-0.0.0.0.0.1.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

mptimer-0.0.0.0.0.1-py3-none-any.whl (2.6 kB view details)

Uploaded Python 3

File details

Details for the file mptimer-0.0.0.0.0.1.tar.gz.

File metadata

  • Download URL: mptimer-0.0.0.0.0.1.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/3.10.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.12

File hashes

Hashes for mptimer-0.0.0.0.0.1.tar.gz
Algorithm Hash digest
SHA256 8a6a1e8b45d96cd974c3a62b1d7e3d93e2ce821cc3db347033268989893e5e70
MD5 63adb75173f97313aaa75ab84709fc77
BLAKE2b-256 7f6f3c9de3955949d70cf8e99b58e52cecffd3c61c223180fb8506cf59c5866b

See more details on using hashes here.

File details

Details for the file mptimer-0.0.0.0.0.1-py3-none-any.whl.

File metadata

  • Download URL: mptimer-0.0.0.0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 2.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/3.10.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.12

File hashes

Hashes for mptimer-0.0.0.0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 76d7b8a7aa68fc15c8580a01aac79d3b67ead81a0c05833e8f495ddd4fc95e51
MD5 ec01aab0c3f0ad6736ab595737382def
BLAKE2b-256 09b739b050f0bf5d93b7e7bf79d1bc8b7744acf69d9df2e737c9d076484fd56a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page