diff -r afcd3f0662b1 -r 2c3f30af031d MicroPython/machine.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MicroPython/machine.py Sun Aug 25 19:25:37 2019 +0200 @@ -0,0 +1,315 @@ +# -*- coding: utf-8 -*- + +# Copyright (c) 2019 Detlev Offenbach <detlev@die-offenbachs.de> +# + +""" +Module containing stubs for API generation of the def 'machine' module. +""" + +IDLE = 0 +SLEEP = 0 +DEEPSLEEP = 0 +PWRON_RESET = 0 +HARD_RESET = 0 +WDT_RESET = 0 +DEEPSLEEP_RESET = 0 +SOFT_RESET = 0 +WLAN_WAKE = 0 +PIN_WAKE = 0 +RTC_WAKE = 0 + +def reset(): + pass + +def reset_cause(): + pass + +def disable_irq(): + pass + +def enable_irq(state): + pass + +def freq(): + pass + +def idle(): + pass + +def sleep(): + pass + +def lightsleep(time_ms=None): + pass + +def deepsleep(time_ms=None): + pass + +def wake_reason(): + pass + +def unique_id(): + pass + +def time_pulse_us(pin, pulse_level, timeout_us=1000000): + pass + +def rng(): + pass + +class Pin(): + IN = 0 + OUT = 0 + OPEN_DRAIN = 0 + ALT = 0 + ALT_OPEN_DRAIN = 0 + PULL_UP = 0 + PULL_DOWN = 0 + PULL_HOLD = 0 + LOW_POWER = 0 + MED_POWER = 0 + HIGH_POWER = 0 + IRQ_FALLING = 0 + IRQ_RISING = 0 + IRQ_LOW_LEVEL = 0 + IRQ_HIGH_LEVEL = 0 + + def __init__(self, id, mode=-1, pull=-1, *, value, drive, alt): + pass + + def init(self, mode=-1, pull=-1, *, value, drive, alt): + pass + + def value(self, x=None): + pass + + def on(self): + pass + + def off(self): + pass + + def mode(self, mode=-1): + pass + + def pull(self, pull=-1): + pass + + def drive(self, drive=None): + pass + + def irq(self, handler=None, trigger=(IRQ_FALLING | IRQ_RISING), *, + priority=1, wake=None, hard=False): + pass + +class Signal(): + def __init__(self, pin, *, invert=False): + pass + + def value(self, x=None): + pass + + def on(self): + pass + + def off(self): + pass + +class ADC(): + def __init__(self, id=0, *, bits=12): + pass + + def channel(self, id, *, pin): + pass + + def init(self): + pass + + def deinit(self): + pass + +class ADCChannel(): + def value(self): + pass + + def init(self): + pass + + def deinit(self): + pass + +def adcchannel(): + pass + +class UART(): + RX_ANY = 0 + + def __init__(self, id, baudrate=9600, bits=8, parity=None, stop=1, + **kwargs): + pass + + def init(baudrate=9600, bits=8, parity=None, stop=1, **kwargs): + pass + + def deinit(self): + pass + + def any(self): + pass + + def read(self, nbytes=None): + pass + + def readinto(self, buf, nbytes=None): + pass + + def readline(self): + pass + + def write(self, buf): + pass + + def sendbreak(self): + pass + + def irq(self, trigger, priority=1, handler=None, wake=IDLE): + pass + +class SPI(): + MASTER = 0 + MSB = 0 + LSB = 0 + + def __init__(self, id, baudrate=1000000, *, polarity=0, phase=0, bits=8, + firstbit=MSB, sck=None, mosi=None, miso=None, + pins=("SCK", "MOSI", "MISO")): + pass + + def init(self, baudrate=1000000, *, polarity=0, phase=0, bits=8, + firstbit=MSB, sck=None, mosi=None, miso=None, + pins=("SCK", "MOSI", "MISO")): + pass + + def deinit(self): + pass + + def read(self, nbytes, write=0x00): + pass + + def readinto(self, buf, write=0x00): + pass + + def write(self, buf): + pass + + def write_readinto(self, write_buf, read_buf): + pass + +class I2C(): + def __init__(self, id=-1, *, scl, sda, freq=400000): + pass + + def init(self, scl, sda, *, freq=400000): + pass + + def deinit(self): + pass + + def scan(self): + pass + + def start(self): + pass + + def stop(self): + pass + + def readinto(self, buf, nack=True): + pass + + def write(self, buf): + pass + + def readfrom(self, addr, nbytes, stop=True): + pass + + def readfrom_into(self, addr, buf, stop=True): + pass + + def writeto(self, addr, buf, stop=True): + pass + + def writevto(self, addr, vector, stop=True): + pass + + def readfrom_mem(self, addr, memaddr, nbytes, *, addrsize=8): + pass + + def readfrom_mem_into(self, addr, memaddr, buf, *, addrsize=8): + pass + + def writeto_mem(self, addr, memaddr, buf, *, addrsize=8): + pass + +class RTC(): + ALARM0 = 0 + + def __init__(self, id=0, datetime=None): + pass + + def init(self, datetime): + pass + + def now(self): + pass + + def deinit(self): + pass + + def alarm(self, id, time, *, repeat=False): + pass + + def alarm_left(self, alarm_id=0): + pass + + def cancel(self, alarm_id=0): + pass + + def irq(self, *, trigger, handler=None, wake=IDLE): + pass + +class Timer(): + ONE_SHOT = 0 + PERIODIC = 0 + + def __init__(self, id, *, mode=PERIODIC, period=-1, callback=None): + pass + + def init(self, *, mode=PERIODIC, period=-1, callback=None): + pass + + def deinit(self): + pass + +class WDT(): + def __init__(self, id=0, timeout=5000): + pass + + def feed(self): + pass + +class SD(): + def __init__(self, id=0, pins=('GP10', 'GP11', 'GP15')): + pass + + def init(self, id=0, pins=('GP10', 'GP11', 'GP15')): + pass + + def deinit(self): + pass + +class SDcard(): + def __init__(self, lot=1, width=1, cd=None, wp=None, sck=None, miso=None, + mosi=None, cs=None): + pass