update PikaStdDevice, use 'self' arg

This commit is contained in:
lyon1998 2022-04-07 22:57:59 +08:00
parent 7656b60e15
commit 5baa725885
3 changed files with 152 additions and 152 deletions

View File

@ -2,255 +2,255 @@ from PikaObj import *
class GPIO(TinyObj): class GPIO(TinyObj):
def __init__(): def __init__(self):
pass pass
def init(): def init(self):
pass pass
def setPin(pinName: str): def setPin(self, pinName: str):
pass pass
def setId(id: int): def setId(self, id: int):
pass pass
def getId() -> int: def getId(self) -> int:
pass pass
def getPin() -> str: def getPin(self) -> str:
pass pass
def setMode(mode: str): def setMode(self, mode: str):
pass pass
def getMode() -> str: def getMode(self) -> str:
pass pass
def setPull(pull: str): def setPull(self, pull: str):
pass pass
def enable(): def enable(self):
pass pass
def disable(): def disable(self):
pass pass
def high(): def high(self):
pass pass
def low(): def low(self):
pass pass
def read() -> int: def read(self) -> int:
pass pass
# need be overrid # need be overrid
def platformHigh(): def platformHigh(self):
pass pass
# need override # need override
def platformLow(): def platformLow(self):
pass pass
# need override # need override
def platformEnable(): def platformEnable(self):
pass pass
# need override # need override
def platformDisable(): def platformDisable(self):
pass pass
# need override # need override
def platformSetMode(): def platformSetMode(self):
pass pass
# need override # need override
def platformRead(): def platformRead(self):
pass pass
class Time(TinyObj): class Time(TinyObj):
# need override # need override
def sleep_s(s: int): def sleep_s(self, s: int):
pass pass
# need override # need override
def sleep_ms(ms: int): def sleep_ms(self, ms: int):
pass pass
class ADC(TinyObj): class ADC(TinyObj):
def __init__(): def __init__(self):
pass pass
def init(): def init(self):
pass pass
def setPin(pin: str): def setPin(self, pin: str):
pass pass
def enable(): def enable(self):
pass pass
def disable(): def disable(self):
pass pass
def read() -> float: def read(self) -> float:
pass pass
# need override # need override
def platformEnable(): def platformEnable(self):
pass pass
# need override # need override
def platformRead(): def platformRead(self):
pass pass
# need override # need override
def platformDisable(): def platformDisable(self):
pass pass
class UART(TinyObj): class UART(TinyObj):
def __init__(): def __init__(self):
pass pass
def init(): def init(self):
pass pass
def setBaudRate(baudRate: int): def setBaudRate(self, baudRate: int):
pass pass
def setId(id: int): def setId(self, id: int):
pass pass
def enable(): def enable(self):
pass pass
def disable(): def disable(self):
pass pass
def write(data: str): def write(self, data: str):
pass pass
def read(length: int) -> str: def read(self, length: int) -> str:
pass pass
# need override # need override
def platformEnable(): def platformEnable(self):
pass pass
# need override # need override
def platformWrite(): def platformWrite(self):
pass pass
# need override # need override
def platformRead(): def platformRead(self):
pass pass
# need override # need override
def platformDisable(): def platformDisable(self):
pass pass
class IIC(TinyObj): class IIC(TinyObj):
def __init__(): def __init__(self):
pass pass
def init(): def init(self):
pass pass
def setPinSCL(pin: str): def setPinSCL(self, pin: str):
pass pass
def setPinSDA(pin: str): def setPinSDA(self, pin: str):
pass pass
def setDeviceAddr(addr: int): def setDeviceAddr(self, addr: int):
pass pass
def enable(): def enable(self):
pass pass
def disable(): def disable(self):
pass pass
def write(addr: int, data: str): def write(self, addr: int, data: str):
pass pass
def read(addr: int, length: int) -> str: def read(self, addr: int, length: int) -> str:
pass pass
# need override # need override
def platformEnable(): def platformEnable(self):
pass pass
# need override # need override
def platformWrite(): def platformWrite(self):
pass pass
# need override # need override
def platformRead(): def platformRead(self):
pass pass
# need override # need override
def platformDisable(): def platformDisable(self):
pass pass
class PWM(TinyObj): class PWM(TinyObj):
def __init__(): def __init__(self):
pass pass
def init(): def init(self):
pass pass
def setName(name: str): def setName(self, name: str):
pass pass
def getName() -> str: def getName(self) -> str:
pass pass
def setChannel(ch: int): def setChannel(self, ch: int):
pass pass
def getChannel() -> int: def getChannel(self) -> int:
pass pass
def setPin(pin: str): def setPin(self, pin: str):
pass pass
def setFrequency(freq: int): def setFrequency(self, freq: int):
pass pass
def setFreq(freq: int): def setFreq(self, freq: int):
pass pass
def setDuty(duty: float): def setDuty(self, duty: float):
pass pass
def enable(): def enable(self):
pass pass
def disable(): def disable(self):
pass pass
def getFrequency() -> int: def getFrequency(self) -> int:
pass pass
def getDuty() -> float: def getDuty(self) -> float:
pass pass
# need override # need override
def platformEnable(): def platformEnable(self):
pass pass
# need override # need override
def platformSetFrequency(): def platformSetFrequency(self):
pass pass
# need override # need override
def platformSetDuty(): def platformSetDuty(self):
pass pass
# need override # need override
def platformDisable(): def platformDisable(self):
pass pass

View File

@ -2,255 +2,255 @@ from PikaObj import *
class GPIO(TinyObj): class GPIO(TinyObj):
def __init__(): def __init__(self):
pass pass
def init(): def init(self):
pass pass
def setPin(pinName: str): def setPin(self, pinName: str):
pass pass
def setId(id: int): def setId(self, id: int):
pass pass
def getId() -> int: def getId(self) -> int:
pass pass
def getPin() -> str: def getPin(self) -> str:
pass pass
def setMode(mode: str): def setMode(self, mode: str):
pass pass
def getMode() -> str: def getMode(self) -> str:
pass pass
def setPull(pull: str): def setPull(self, pull: str):
pass pass
def enable(): def enable(self):
pass pass
def disable(): def disable(self):
pass pass
def high(): def high(self):
pass pass
def low(): def low(self):
pass pass
def read() -> int: def read(self) -> int:
pass pass
# need be overrid # need be overrid
def platformHigh(): def platformHigh(self):
pass pass
# need override # need override
def platformLow(): def platformLow(self):
pass pass
# need override # need override
def platformEnable(): def platformEnable(self):
pass pass
# need override # need override
def platformDisable(): def platformDisable(self):
pass pass
# need override # need override
def platformSetMode(): def platformSetMode(self):
pass pass
# need override # need override
def platformRead(): def platformRead(self):
pass pass
class Time(TinyObj): class Time(TinyObj):
# need override # need override
def sleep_s(s: int): def sleep_s(self, s: int):
pass pass
# need override # need override
def sleep_ms(ms: int): def sleep_ms(self, ms: int):
pass pass
class ADC(TinyObj): class ADC(TinyObj):
def __init__(): def __init__(self):
pass pass
def init(): def init(self):
pass pass
def setPin(pin: str): def setPin(self, pin: str):
pass pass
def enable(): def enable(self):
pass pass
def disable(): def disable(self):
pass pass
def read() -> float: def read(self) -> float:
pass pass
# need override # need override
def platformEnable(): def platformEnable(self):
pass pass
# need override # need override
def platformRead(): def platformRead(self):
pass pass
# need override # need override
def platformDisable(): def platformDisable(self):
pass pass
class UART(TinyObj): class UART(TinyObj):
def __init__(): def __init__(self):
pass pass
def init(): def init(self):
pass pass
def setBaudRate(baudRate: int): def setBaudRate(self, baudRate: int):
pass pass
def setId(id: int): def setId(self, id: int):
pass pass
def enable(): def enable(self):
pass pass
def disable(): def disable(self):
pass pass
def write(data: str): def write(self, data: str):
pass pass
def read(length: int) -> str: def read(self, length: int) -> str:
pass pass
# need override # need override
def platformEnable(): def platformEnable(self):
pass pass
# need override # need override
def platformWrite(): def platformWrite(self):
pass pass
# need override # need override
def platformRead(): def platformRead(self):
pass pass
# need override # need override
def platformDisable(): def platformDisable(self):
pass pass
class IIC(TinyObj): class IIC(TinyObj):
def __init__(): def __init__(self):
pass pass
def init(): def init(self):
pass pass
def setPinSCL(pin: str): def setPinSCL(self, pin: str):
pass pass
def setPinSDA(pin: str): def setPinSDA(self, pin: str):
pass pass
def setDeviceAddr(addr: int): def setDeviceAddr(self, addr: int):
pass pass
def enable(): def enable(self):
pass pass
def disable(): def disable(self):
pass pass
def write(addr: int, data: str): def write(self, addr: int, data: str):
pass pass
def read(addr: int, length: int) -> str: def read(self, addr: int, length: int) -> str:
pass pass
# need override # need override
def platformEnable(): def platformEnable(self):
pass pass
# need override # need override
def platformWrite(): def platformWrite(self):
pass pass
# need override # need override
def platformRead(): def platformRead(self):
pass pass
# need override # need override
def platformDisable(): def platformDisable(self):
pass pass
class PWM(TinyObj): class PWM(TinyObj):
def __init__(): def __init__(self):
pass pass
def init(): def init(self):
pass pass
def setName(name: str): def setName(self, name: str):
pass pass
def getName() -> str: def getName(self) -> str:
pass pass
def setChannel(ch: int): def setChannel(self, ch: int):
pass pass
def getChannel() -> int: def getChannel(self) -> int:
pass pass
def setPin(pin: str): def setPin(self, pin: str):
pass pass
def setFrequency(freq: int): def setFrequency(self, freq: int):
pass pass
def setFreq(freq: int): def setFreq(self, freq: int):
pass pass
def setDuty(duty: float): def setDuty(self, duty: float):
pass pass
def enable(): def enable(self):
pass pass
def disable(): def disable(self):
pass pass
def getFrequency() -> int: def getFrequency(self) -> int:
pass pass
def getDuty() -> float: def getDuty(self) -> float:
pass pass
# need override # need override
def platformEnable(): def platformEnable(self):
pass pass
# need override # need override
def platformSetFrequency(): def platformSetFrequency(self):
pass pass
# need override # need override
def platformSetDuty(): def platformSetDuty(self):
pass pass
# need override # need override
def platformDisable(): def platformDisable(self):
pass pass

View File

@ -1,6 +1,6 @@
pkg=$1 pkg=$1
cp package/pikascript/pikascript-lib/PikaStdLib ../../package/ -r cp package/pikascript/pikascript-lib/$pkg ../../package/ -r
cp package/pikascript/$pkg.py ../../package/PikaStdLib/ cp package/pikascript/$pkg.py ../../package/$pkg/
git add package/pikascript/pikascript-lib/PikaStdLib git add package/pikascript/pikascript-lib/$pkg
git add package/pikascript/$pkg.py git add package/pikascript/$pkg.py
git add ../../package/PikaStdLib git add ../../package/$pkg