mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-29 17:22:56 +08:00
change deivce to device
This commit is contained in:
parent
bb10916803
commit
01ce4ecedd
@ -10,13 +10,13 @@
|
||||
<TargetName>stm32g070</TargetName>
|
||||
<ToolsetNumber>0x4</ToolsetNumber>
|
||||
<ToolsetName>ARM-ADS</ToolsetName>
|
||||
<pCCUsed>6160000::V6.16::ARMCLANG</pCCUsed>
|
||||
<pCCUsed>6120000::V6.12::.\ARMCLANG</pCCUsed>
|
||||
<uAC6>1</uAC6>
|
||||
<TargetOption>
|
||||
<TargetCommonOption>
|
||||
<Device>STM32G070CBTx</Device>
|
||||
<Vendor>STMicroelectronics</Vendor>
|
||||
<PackID>Keil.STM32G0xx_DFP.1.3.0</PackID>
|
||||
<PackID>Keil.STM32G0xx_DFP.1.2.0</PackID>
|
||||
<PackURL>http://www.keil.com/pack/</PackURL>
|
||||
<Cpu>IRAM(0x20000000-0x20008FFF) IROM(0x8000000-0x801FFFF) CLOCK(8000000) CPUTYPE("Cortex-M0+") TZ</Cpu>
|
||||
<FlashUtilSpec></FlashUtilSpec>
|
||||
@ -137,7 +137,7 @@
|
||||
<DriverSelection>4101</DriverSelection>
|
||||
</Flash1>
|
||||
<bUseTDR>1</bUseTDR>
|
||||
<Flash2>BIN\UL2V8M.DLL</Flash2>
|
||||
<Flash2>BIN\UL2CM3.DLL</Flash2>
|
||||
<Flash3></Flash3>
|
||||
<Flash4></Flash4>
|
||||
<pFcarmOut></pFcarmOut>
|
||||
@ -185,7 +185,6 @@
|
||||
<uocXRam>0</uocXRam>
|
||||
<RvdsVP>0</RvdsVP>
|
||||
<RvdsMve>0</RvdsMve>
|
||||
<RvdsCdeCp>0</RvdsCdeCp>
|
||||
<hadIRAM2>0</hadIRAM2>
|
||||
<hadIROM2>0</hadIROM2>
|
||||
<StupSel>8</StupSel>
|
||||
@ -352,7 +351,7 @@
|
||||
<NoWarn>0</NoWarn>
|
||||
<uSurpInc>0</uSurpInc>
|
||||
<useXO>0</useXO>
|
||||
<ClangAsOpt>4</ClangAsOpt>
|
||||
<uClangAs>0</uClangAs>
|
||||
<VariousControls>
|
||||
<MiscControls></MiscControls>
|
||||
<Define></Define>
|
||||
@ -623,26 +622,26 @@
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\pikascript\pikascript-api\PikaStdLib_SysObj-api.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>PikaStdDeivce_GPIO-api.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\pikascript\pikascript-api\PikaStdDeivce_GPIO-api.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>STM32_GPIO-api.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\pikascript\pikascript-api\STM32_GPIO-api.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>PikaStdDeivce_Time-api.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\pikascript\pikascript-api\PikaStdDeivce_Time-api.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>STM32_Time-api.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\pikascript\pikascript-api\STM32_Time-api.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>PikaStdDevice_GPIO-api.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\pikascript\pikascript-api\PikaStdDevice_GPIO-api.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>PikaStdDevice_Time-api.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\pikascript\pikascript-api\PikaStdDevice_Time-api.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
|
@ -1,7 +1,7 @@
|
||||
import PikaStdDeivce
|
||||
import PikaStdDevice
|
||||
|
||||
|
||||
class GPIO(PikaStdDeivce.GPIO):
|
||||
class GPIO(PikaStdDevice.GPIO):
|
||||
# override
|
||||
def platformHigh():
|
||||
pass
|
||||
@ -23,7 +23,7 @@ class GPIO(PikaStdDeivce.GPIO):
|
||||
pass
|
||||
|
||||
|
||||
class Time(PikaStdDeivce.Time):
|
||||
class Time(PikaStdDevice.Time):
|
||||
# override
|
||||
def sleep_s(s: int):
|
||||
pass
|
||||
|
@ -1,88 +0,0 @@
|
||||
/* ******************************** */
|
||||
/* Warning! Don't modify this file! */
|
||||
/* ******************************** */
|
||||
#include "PikaStdDeivce_GPIO.h"
|
||||
#include "TinyObj.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "BaseObj.h"
|
||||
|
||||
void PikaStdDeivce_GPIO_disableMethod(PikaObj *self, Args *args){
|
||||
PikaStdDeivce_GPIO_disable(self);
|
||||
}
|
||||
|
||||
void PikaStdDeivce_GPIO_enableMethod(PikaObj *self, Args *args){
|
||||
PikaStdDeivce_GPIO_enable(self);
|
||||
}
|
||||
|
||||
void PikaStdDeivce_GPIO_getModeMethod(PikaObj *self, Args *args){
|
||||
char * res = PikaStdDeivce_GPIO_getMode(self);
|
||||
method_returnStr(args, res);
|
||||
}
|
||||
|
||||
void PikaStdDeivce_GPIO_getPinMethod(PikaObj *self, Args *args){
|
||||
char * res = PikaStdDeivce_GPIO_getPin(self);
|
||||
method_returnStr(args, res);
|
||||
}
|
||||
|
||||
void PikaStdDeivce_GPIO_highMethod(PikaObj *self, Args *args){
|
||||
PikaStdDeivce_GPIO_high(self);
|
||||
}
|
||||
|
||||
void PikaStdDeivce_GPIO_initMethod(PikaObj *self, Args *args){
|
||||
PikaStdDeivce_GPIO_init(self);
|
||||
}
|
||||
|
||||
void PikaStdDeivce_GPIO_lowMethod(PikaObj *self, Args *args){
|
||||
PikaStdDeivce_GPIO_low(self);
|
||||
}
|
||||
|
||||
void PikaStdDeivce_GPIO_platformDisableMethod(PikaObj *self, Args *args){
|
||||
PikaStdDeivce_GPIO_platformDisable(self);
|
||||
}
|
||||
|
||||
void PikaStdDeivce_GPIO_platformEnableMethod(PikaObj *self, Args *args){
|
||||
PikaStdDeivce_GPIO_platformEnable(self);
|
||||
}
|
||||
|
||||
void PikaStdDeivce_GPIO_platformHighMethod(PikaObj *self, Args *args){
|
||||
PikaStdDeivce_GPIO_platformHigh(self);
|
||||
}
|
||||
|
||||
void PikaStdDeivce_GPIO_platformLowMethod(PikaObj *self, Args *args){
|
||||
PikaStdDeivce_GPIO_platformLow(self);
|
||||
}
|
||||
|
||||
void PikaStdDeivce_GPIO_platformSetModeMethod(PikaObj *self, Args *args){
|
||||
char * mode = args_getStr(args, "mode");
|
||||
PikaStdDeivce_GPIO_platformSetMode(self, mode);
|
||||
}
|
||||
|
||||
void PikaStdDeivce_GPIO_setModeMethod(PikaObj *self, Args *args){
|
||||
char * mode = args_getStr(args, "mode");
|
||||
PikaStdDeivce_GPIO_setMode(self, mode);
|
||||
}
|
||||
|
||||
void PikaStdDeivce_GPIO_setPinMethod(PikaObj *self, Args *args){
|
||||
char * pinName = args_getStr(args, "pinName");
|
||||
PikaStdDeivce_GPIO_setPin(self, pinName);
|
||||
}
|
||||
|
||||
PikaObj *New_PikaStdDeivce_GPIO(Args *args){
|
||||
PikaObj *self = New_TinyObj(args);
|
||||
class_defineMethod(self, "disable()", PikaStdDeivce_GPIO_disableMethod);
|
||||
class_defineMethod(self, "enable()", PikaStdDeivce_GPIO_enableMethod);
|
||||
class_defineMethod(self, "getMode()->str", PikaStdDeivce_GPIO_getModeMethod);
|
||||
class_defineMethod(self, "getPin()->str", PikaStdDeivce_GPIO_getPinMethod);
|
||||
class_defineMethod(self, "high()", PikaStdDeivce_GPIO_highMethod);
|
||||
class_defineMethod(self, "init()", PikaStdDeivce_GPIO_initMethod);
|
||||
class_defineMethod(self, "low()", PikaStdDeivce_GPIO_lowMethod);
|
||||
class_defineMethod(self, "platformDisable()", PikaStdDeivce_GPIO_platformDisableMethod);
|
||||
class_defineMethod(self, "platformEnable()", PikaStdDeivce_GPIO_platformEnableMethod);
|
||||
class_defineMethod(self, "platformHigh()", PikaStdDeivce_GPIO_platformHighMethod);
|
||||
class_defineMethod(self, "platformLow()", PikaStdDeivce_GPIO_platformLowMethod);
|
||||
class_defineMethod(self, "platformSetMode(mode:str)", PikaStdDeivce_GPIO_platformSetModeMethod);
|
||||
class_defineMethod(self, "setMode(mode:str)", PikaStdDeivce_GPIO_setModeMethod);
|
||||
class_defineMethod(self, "setPin(pinName:str)", PikaStdDeivce_GPIO_setPinMethod);
|
||||
return self;
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
/* ******************************** */
|
||||
/* Warning! Don't modify this file! */
|
||||
/* ******************************** */
|
||||
#ifndef __PikaStdDeivce_GPIO__H
|
||||
#define __PikaStdDeivce_GPIO__H
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "PikaObj.h"
|
||||
|
||||
PikaObj *New_PikaStdDeivce_GPIO(Args *args);
|
||||
|
||||
void PikaStdDeivce_GPIO_disable(PikaObj *self);
|
||||
void PikaStdDeivce_GPIO_enable(PikaObj *self);
|
||||
char * PikaStdDeivce_GPIO_getMode(PikaObj *self);
|
||||
char * PikaStdDeivce_GPIO_getPin(PikaObj *self);
|
||||
void PikaStdDeivce_GPIO_high(PikaObj *self);
|
||||
void PikaStdDeivce_GPIO_init(PikaObj *self);
|
||||
void PikaStdDeivce_GPIO_low(PikaObj *self);
|
||||
void PikaStdDeivce_GPIO_platformDisable(PikaObj *self);
|
||||
void PikaStdDeivce_GPIO_platformEnable(PikaObj *self);
|
||||
void PikaStdDeivce_GPIO_platformHigh(PikaObj *self);
|
||||
void PikaStdDeivce_GPIO_platformLow(PikaObj *self);
|
||||
void PikaStdDeivce_GPIO_platformSetMode(PikaObj *self, char * mode);
|
||||
void PikaStdDeivce_GPIO_setMode(PikaObj *self, char * mode);
|
||||
void PikaStdDeivce_GPIO_setPin(PikaObj *self, char * pinName);
|
||||
|
||||
#endif
|
@ -1,25 +0,0 @@
|
||||
/* ******************************** */
|
||||
/* Warning! Don't modify this file! */
|
||||
/* ******************************** */
|
||||
#include "PikaStdDeivce_Time.h"
|
||||
#include "TinyObj.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "BaseObj.h"
|
||||
|
||||
void PikaStdDeivce_Time_sleep_msMethod(PikaObj *self, Args *args){
|
||||
int ms = args_getInt(args, "ms");
|
||||
PikaStdDeivce_Time_sleep_ms(self, ms);
|
||||
}
|
||||
|
||||
void PikaStdDeivce_Time_sleep_sMethod(PikaObj *self, Args *args){
|
||||
int s = args_getInt(args, "s");
|
||||
PikaStdDeivce_Time_sleep_s(self, s);
|
||||
}
|
||||
|
||||
PikaObj *New_PikaStdDeivce_Time(Args *args){
|
||||
PikaObj *self = New_TinyObj(args);
|
||||
class_defineMethod(self, "sleep_ms(ms:int)", PikaStdDeivce_Time_sleep_msMethod);
|
||||
class_defineMethod(self, "sleep_s(s:int)", PikaStdDeivce_Time_sleep_sMethod);
|
||||
return self;
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
/* ******************************** */
|
||||
/* Warning! Don't modify this file! */
|
||||
/* ******************************** */
|
||||
#ifndef __PikaStdDeivce_Time__H
|
||||
#define __PikaStdDeivce_Time__H
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "PikaObj.h"
|
||||
|
||||
PikaObj *New_PikaStdDeivce_Time(Args *args);
|
||||
|
||||
void PikaStdDeivce_Time_sleep_ms(PikaObj *self, int ms);
|
||||
void PikaStdDeivce_Time_sleep_s(PikaObj *self, int s);
|
||||
|
||||
#endif
|
@ -0,0 +1,88 @@
|
||||
/* ******************************** */
|
||||
/* Warning! Don't modify this file! */
|
||||
/* ******************************** */
|
||||
#include "PikaStdDevice_GPIO.h"
|
||||
#include "TinyObj.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "BaseObj.h"
|
||||
|
||||
void PikaStdDevice_GPIO_disableMethod(PikaObj *self, Args *args){
|
||||
PikaStdDevice_GPIO_disable(self);
|
||||
}
|
||||
|
||||
void PikaStdDevice_GPIO_enableMethod(PikaObj *self, Args *args){
|
||||
PikaStdDevice_GPIO_enable(self);
|
||||
}
|
||||
|
||||
void PikaStdDevice_GPIO_getModeMethod(PikaObj *self, Args *args){
|
||||
char * res = PikaStdDevice_GPIO_getMode(self);
|
||||
method_returnStr(args, res);
|
||||
}
|
||||
|
||||
void PikaStdDevice_GPIO_getPinMethod(PikaObj *self, Args *args){
|
||||
char * res = PikaStdDevice_GPIO_getPin(self);
|
||||
method_returnStr(args, res);
|
||||
}
|
||||
|
||||
void PikaStdDevice_GPIO_highMethod(PikaObj *self, Args *args){
|
||||
PikaStdDevice_GPIO_high(self);
|
||||
}
|
||||
|
||||
void PikaStdDevice_GPIO_initMethod(PikaObj *self, Args *args){
|
||||
PikaStdDevice_GPIO_init(self);
|
||||
}
|
||||
|
||||
void PikaStdDevice_GPIO_lowMethod(PikaObj *self, Args *args){
|
||||
PikaStdDevice_GPIO_low(self);
|
||||
}
|
||||
|
||||
void PikaStdDevice_GPIO_platformDisableMethod(PikaObj *self, Args *args){
|
||||
PikaStdDevice_GPIO_platformDisable(self);
|
||||
}
|
||||
|
||||
void PikaStdDevice_GPIO_platformEnableMethod(PikaObj *self, Args *args){
|
||||
PikaStdDevice_GPIO_platformEnable(self);
|
||||
}
|
||||
|
||||
void PikaStdDevice_GPIO_platformHighMethod(PikaObj *self, Args *args){
|
||||
PikaStdDevice_GPIO_platformHigh(self);
|
||||
}
|
||||
|
||||
void PikaStdDevice_GPIO_platformLowMethod(PikaObj *self, Args *args){
|
||||
PikaStdDevice_GPIO_platformLow(self);
|
||||
}
|
||||
|
||||
void PikaStdDevice_GPIO_platformSetModeMethod(PikaObj *self, Args *args){
|
||||
char * mode = args_getStr(args, "mode");
|
||||
PikaStdDevice_GPIO_platformSetMode(self, mode);
|
||||
}
|
||||
|
||||
void PikaStdDevice_GPIO_setModeMethod(PikaObj *self, Args *args){
|
||||
char * mode = args_getStr(args, "mode");
|
||||
PikaStdDevice_GPIO_setMode(self, mode);
|
||||
}
|
||||
|
||||
void PikaStdDevice_GPIO_setPinMethod(PikaObj *self, Args *args){
|
||||
char * pinName = args_getStr(args, "pinName");
|
||||
PikaStdDevice_GPIO_setPin(self, pinName);
|
||||
}
|
||||
|
||||
PikaObj *New_PikaStdDevice_GPIO(Args *args){
|
||||
PikaObj *self = New_TinyObj(args);
|
||||
class_defineMethod(self, "disable()", PikaStdDevice_GPIO_disableMethod);
|
||||
class_defineMethod(self, "enable()", PikaStdDevice_GPIO_enableMethod);
|
||||
class_defineMethod(self, "getMode()->str", PikaStdDevice_GPIO_getModeMethod);
|
||||
class_defineMethod(self, "getPin()->str", PikaStdDevice_GPIO_getPinMethod);
|
||||
class_defineMethod(self, "high()", PikaStdDevice_GPIO_highMethod);
|
||||
class_defineMethod(self, "init()", PikaStdDevice_GPIO_initMethod);
|
||||
class_defineMethod(self, "low()", PikaStdDevice_GPIO_lowMethod);
|
||||
class_defineMethod(self, "platformDisable()", PikaStdDevice_GPIO_platformDisableMethod);
|
||||
class_defineMethod(self, "platformEnable()", PikaStdDevice_GPIO_platformEnableMethod);
|
||||
class_defineMethod(self, "platformHigh()", PikaStdDevice_GPIO_platformHighMethod);
|
||||
class_defineMethod(self, "platformLow()", PikaStdDevice_GPIO_platformLowMethod);
|
||||
class_defineMethod(self, "platformSetMode(mode:str)", PikaStdDevice_GPIO_platformSetModeMethod);
|
||||
class_defineMethod(self, "setMode(mode:str)", PikaStdDevice_GPIO_setModeMethod);
|
||||
class_defineMethod(self, "setPin(pinName:str)", PikaStdDevice_GPIO_setPinMethod);
|
||||
return self;
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
/* ******************************** */
|
||||
/* Warning! Don't modify this file! */
|
||||
/* ******************************** */
|
||||
#ifndef __PikaStdDevice_GPIO__H
|
||||
#define __PikaStdDevice_GPIO__H
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "PikaObj.h"
|
||||
|
||||
PikaObj *New_PikaStdDevice_GPIO(Args *args);
|
||||
|
||||
void PikaStdDevice_GPIO_disable(PikaObj *self);
|
||||
void PikaStdDevice_GPIO_enable(PikaObj *self);
|
||||
char * PikaStdDevice_GPIO_getMode(PikaObj *self);
|
||||
char * PikaStdDevice_GPIO_getPin(PikaObj *self);
|
||||
void PikaStdDevice_GPIO_high(PikaObj *self);
|
||||
void PikaStdDevice_GPIO_init(PikaObj *self);
|
||||
void PikaStdDevice_GPIO_low(PikaObj *self);
|
||||
void PikaStdDevice_GPIO_platformDisable(PikaObj *self);
|
||||
void PikaStdDevice_GPIO_platformEnable(PikaObj *self);
|
||||
void PikaStdDevice_GPIO_platformHigh(PikaObj *self);
|
||||
void PikaStdDevice_GPIO_platformLow(PikaObj *self);
|
||||
void PikaStdDevice_GPIO_platformSetMode(PikaObj *self, char * mode);
|
||||
void PikaStdDevice_GPIO_setMode(PikaObj *self, char * mode);
|
||||
void PikaStdDevice_GPIO_setPin(PikaObj *self, char * pinName);
|
||||
|
||||
#endif
|
@ -0,0 +1,25 @@
|
||||
/* ******************************** */
|
||||
/* Warning! Don't modify this file! */
|
||||
/* ******************************** */
|
||||
#include "PikaStdDevice_Time.h"
|
||||
#include "TinyObj.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "BaseObj.h"
|
||||
|
||||
void PikaStdDevice_Time_sleep_msMethod(PikaObj *self, Args *args){
|
||||
int ms = args_getInt(args, "ms");
|
||||
PikaStdDevice_Time_sleep_ms(self, ms);
|
||||
}
|
||||
|
||||
void PikaStdDevice_Time_sleep_sMethod(PikaObj *self, Args *args){
|
||||
int s = args_getInt(args, "s");
|
||||
PikaStdDevice_Time_sleep_s(self, s);
|
||||
}
|
||||
|
||||
PikaObj *New_PikaStdDevice_Time(Args *args){
|
||||
PikaObj *self = New_TinyObj(args);
|
||||
class_defineMethod(self, "sleep_ms(ms:int)", PikaStdDevice_Time_sleep_msMethod);
|
||||
class_defineMethod(self, "sleep_s(s:int)", PikaStdDevice_Time_sleep_sMethod);
|
||||
return self;
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
/* ******************************** */
|
||||
/* Warning! Don't modify this file! */
|
||||
/* ******************************** */
|
||||
#ifndef __PikaStdDevice_Time__H
|
||||
#define __PikaStdDevice_Time__H
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "PikaObj.h"
|
||||
|
||||
PikaObj *New_PikaStdDevice_Time(Args *args);
|
||||
|
||||
void PikaStdDevice_Time_sleep_ms(PikaObj *self, int ms);
|
||||
void PikaStdDevice_Time_sleep_s(PikaObj *self, int s);
|
||||
|
||||
#endif
|
@ -2,7 +2,7 @@
|
||||
/* Warning! Don't modify this file! */
|
||||
/* ******************************** */
|
||||
#include "STM32_GPIO.h"
|
||||
#include "PikaStdDeivce_GPIO.h"
|
||||
#include "PikaStdDevice_GPIO.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "BaseObj.h"
|
||||
@ -29,7 +29,7 @@ void STM32_GPIO_platformSetModeMethod(PikaObj *self, Args *args){
|
||||
}
|
||||
|
||||
PikaObj *New_STM32_GPIO(Args *args){
|
||||
PikaObj *self = New_PikaStdDeivce_GPIO(args);
|
||||
PikaObj *self = New_PikaStdDevice_GPIO(args);
|
||||
class_defineMethod(self, "platformDisable()", STM32_GPIO_platformDisableMethod);
|
||||
class_defineMethod(self, "platformEnable()", STM32_GPIO_platformEnableMethod);
|
||||
class_defineMethod(self, "platformHigh()", STM32_GPIO_platformHighMethod);
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* Warning! Don't modify this file! */
|
||||
/* ******************************** */
|
||||
#include "STM32_Time.h"
|
||||
#include "PikaStdDeivce_Time.h"
|
||||
#include "PikaStdDevice_Time.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "BaseObj.h"
|
||||
@ -18,7 +18,7 @@ void STM32_Time_sleep_sMethod(PikaObj *self, Args *args){
|
||||
}
|
||||
|
||||
PikaObj *New_STM32_Time(Args *args){
|
||||
PikaObj *self = New_PikaStdDeivce_Time(args);
|
||||
PikaObj *self = New_PikaStdDevice_Time(args);
|
||||
class_defineMethod(self, "sleep_ms(ms:int)", STM32_Time_sleep_msMethod);
|
||||
class_defineMethod(self, "sleep_s(s:int)", STM32_Time_sleep_sMethod);
|
||||
return self;
|
||||
|
File diff suppressed because one or more lines are too long
@ -5,24 +5,24 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
PikaObj * pikaScriptInit(){
|
||||
PikaObj * pikaMain = newRootObj("pikaMain", New_PikaMain);
|
||||
obj_run(pikaMain, "print('hello pikascript')");
|
||||
obj_run(pikaMain, "io1.init()");
|
||||
obj_run(pikaMain, "io1.setPin('PB4')");
|
||||
obj_run(pikaMain, "io1.setMode('out')");
|
||||
obj_run(pikaMain, "io1.enable()");
|
||||
obj_run(pikaMain, "io1.low()");
|
||||
obj_run(pikaMain, "print('mem.max :')");
|
||||
obj_run(pikaMain, "mem.max()");
|
||||
obj_run(pikaMain, "print('mem.now :')");
|
||||
obj_run(pikaMain, "mem.now()");
|
||||
obj_run(pikaMain, "while True:");
|
||||
obj_run(pikaMain, " io1.low()");
|
||||
obj_run(pikaMain, " time.sleep_ms(500)");
|
||||
obj_run(pikaMain, " io1.high()");
|
||||
obj_run(pikaMain, " time.sleep_ms(500)");
|
||||
obj_run(pikaMain, "");
|
||||
return pikaMain;
|
||||
}
|
||||
|
||||
PikaObj * pikaScriptInit(){
|
||||
PikaObj * pikaMain = newRootObj("pikaMain", New_PikaMain);
|
||||
obj_run(pikaMain, "io1.init()");
|
||||
obj_run(pikaMain, "io1.setPin('PB4')");
|
||||
obj_run(pikaMain, "io1.setMode('out')");
|
||||
obj_run(pikaMain, "io1.enable()");
|
||||
obj_run(pikaMain, "io1.low()");
|
||||
obj_run(pikaMain, "print('hello pikascript')");
|
||||
obj_run(pikaMain, "print('mem.max :')");
|
||||
obj_run(pikaMain, "mem.max()");
|
||||
obj_run(pikaMain, "print('mem.now :')");
|
||||
obj_run(pikaMain, "mem.now()");
|
||||
obj_run(pikaMain, "while True:");
|
||||
obj_run(pikaMain, " io1.low()");
|
||||
obj_run(pikaMain, " time.sleep_ms(500)");
|
||||
obj_run(pikaMain, " io1.high()");
|
||||
obj_run(pikaMain, " time.sleep_ms(500)");
|
||||
obj_run(pikaMain, "");
|
||||
return pikaMain;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "BaseObj.h"
|
||||
#include "PikaStdDeivce_GPIO.h"
|
||||
#include "PikaStdDevice_GPIO.h"
|
||||
|
||||
void PikaStdDeivce_GPIO_init(PikaObj *self)
|
||||
void PikaStdDevice_GPIO_init(PikaObj *self)
|
||||
{
|
||||
obj_setInt(self, "isEnable", 0);
|
||||
obj_setStr(self, "pin", "PA0");
|
||||
@ -9,87 +9,87 @@ void PikaStdDeivce_GPIO_init(PikaObj *self)
|
||||
obj_setInt(self, "isOn", 0);
|
||||
}
|
||||
|
||||
void PikaStdDeivce_GPIO_disable(PikaObj *self)
|
||||
void PikaStdDevice_GPIO_disable(PikaObj *self)
|
||||
{
|
||||
obj_setInt(self, "isEnable", 0);
|
||||
obj_run(self, "platformDisable()");
|
||||
}
|
||||
|
||||
void PikaStdDeivce_GPIO_enable(PikaObj *self)
|
||||
void PikaStdDevice_GPIO_enable(PikaObj *self)
|
||||
{
|
||||
obj_setInt(self, "isEnable", 1);
|
||||
obj_run(self, "platformEnable()");
|
||||
}
|
||||
|
||||
char *PikaStdDeivce_GPIO_getMode(PikaObj *self)
|
||||
char *PikaStdDevice_GPIO_getMode(PikaObj *self)
|
||||
{
|
||||
return obj_getStr(self, "mode");
|
||||
}
|
||||
|
||||
char *PikaStdDeivce_GPIO_getPin(PikaObj *self)
|
||||
char *PikaStdDevice_GPIO_getPin(PikaObj *self)
|
||||
{
|
||||
return obj_getStr(self, "pin");
|
||||
}
|
||||
|
||||
void PikaStdDeivce_GPIO_low(PikaObj *self)
|
||||
void PikaStdDevice_GPIO_low(PikaObj *self)
|
||||
{
|
||||
obj_setInt(self, "isOn", 0);
|
||||
obj_run(self, "platformLow()");
|
||||
}
|
||||
|
||||
void PikaStdDeivce_GPIO_high(PikaObj *self)
|
||||
void PikaStdDevice_GPIO_high(PikaObj *self)
|
||||
{
|
||||
obj_setInt(self, "isOn", 1);
|
||||
obj_run(self, "platformHigh()");
|
||||
}
|
||||
|
||||
void PikaStdDeivce_GPIO_setMode(PikaObj *self, char *mode)
|
||||
void PikaStdDevice_GPIO_setMode(PikaObj *self, char *mode)
|
||||
{
|
||||
obj_setStr(self, "mode", mode);
|
||||
obj_run(self, "platformSetMode(mode)");
|
||||
}
|
||||
|
||||
void PikaStdDeivce_GPIO_setPin(PikaObj *self, char *pinName)
|
||||
void PikaStdDevice_GPIO_setPin(PikaObj *self, char *pinName)
|
||||
{
|
||||
obj_setStr(self, "pin", pinName);
|
||||
}
|
||||
|
||||
void PikaStdDeivce_GPIO_platformDisable(PikaObj *self)
|
||||
void PikaStdDevice_GPIO_platformDisable(PikaObj *self)
|
||||
{
|
||||
obj_setErrorCode(self, 1);
|
||||
obj_setSysOut(self, "[error] platform method need to be override.");
|
||||
}
|
||||
|
||||
void PikaStdDeivce_GPIO_platformEnable(PikaObj *self)
|
||||
void PikaStdDevice_GPIO_platformEnable(PikaObj *self)
|
||||
{
|
||||
obj_setErrorCode(self, 1);
|
||||
obj_setSysOut(self, "[error] platform method need to be override.");
|
||||
}
|
||||
void PikaStdDeivce_GPIO_platformLow(PikaObj *self)
|
||||
void PikaStdDevice_GPIO_platformLow(PikaObj *self)
|
||||
{
|
||||
obj_setErrorCode(self, 1);
|
||||
obj_setSysOut(self, "[error] platform method need to be override.");
|
||||
}
|
||||
|
||||
void PikaStdDeivce_GPIO_platformHigh(PikaObj *self)
|
||||
void PikaStdDevice_GPIO_platformHigh(PikaObj *self)
|
||||
{
|
||||
obj_setErrorCode(self, 1);
|
||||
obj_setSysOut(self, "[error] platform method need to be override.");
|
||||
}
|
||||
|
||||
void PikaStdDeivce_GPIO_platformSetMode(PikaObj *self, char *mode)
|
||||
void PikaStdDevice_GPIO_platformSetMode(PikaObj *self, char *mode)
|
||||
{
|
||||
obj_setErrorCode(self, 1);
|
||||
obj_setSysOut(self, "[error] platform method need to be override.");
|
||||
}
|
||||
|
||||
void PikaStdDeivce_GPIO_platformOff(PikaObj *self)
|
||||
void PikaStdDevice_GPIO_platformOff(PikaObj *self)
|
||||
{
|
||||
obj_setErrorCode(self, 1);
|
||||
obj_setSysOut(self, "[error] platform method need to be override.");
|
||||
}
|
||||
|
||||
void PikaStdDeivce_GPIO_platformOn(PikaObj *self)
|
||||
void PikaStdDevice_GPIO_platformOn(PikaObj *self)
|
||||
{
|
||||
obj_setErrorCode(self, 1);
|
||||
obj_setSysOut(self, "[error] platform method need to be override.");
|
||||
|
@ -1,12 +1,12 @@
|
||||
#include "BaseObj.h"
|
||||
#include "PikaStdDeivce_Time.h"
|
||||
#include "PikaStdDevice_Time.h"
|
||||
|
||||
void PikaStdDeivce_Time_sleep_ms(PikaObj *self, int ms)
|
||||
void PikaStdDevice_Time_sleep_ms(PikaObj *self, int ms)
|
||||
{
|
||||
obj_setErrorCode(self, 1);
|
||||
obj_setSysOut(self, "[error] platform method need to be override.");
|
||||
}
|
||||
void PikaStdDeivce_Time_sleep_s(PikaObj *self, int s)
|
||||
void PikaStdDevice_Time_sleep_s(PikaObj *self, int s)
|
||||
{
|
||||
obj_setErrorCode(self, 1);
|
||||
obj_setSysOut(self, "[error] platform method need to be override.");
|
||||
|
Loading…
x
Reference in New Issue
Block a user