mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-29 17:22:56 +08:00
rm BL808 package
This commit is contained in:
parent
2fbe1cf0e6
commit
dfd5c8e9d4
@ -1,20 +0,0 @@
|
|||||||
import PikaStdDevice
|
|
||||||
|
|
||||||
|
|
||||||
class GPIO(PikaStdDevice.GPIO):
|
|
||||||
def platformHigh(self): ...
|
|
||||||
|
|
||||||
def platformLow(self): ...
|
|
||||||
|
|
||||||
def platformEnable(self): ...
|
|
||||||
|
|
||||||
def platformDisable(self): ...
|
|
||||||
|
|
||||||
def platformSetMode(self): ...
|
|
||||||
|
|
||||||
def platformRead(self): ...
|
|
||||||
|
|
||||||
class Time(PikaStdDevice.Time):
|
|
||||||
def sleep_s(self, s: int): ...
|
|
||||||
|
|
||||||
def sleep_ms(self, ms: int): ...
|
|
@ -1,74 +0,0 @@
|
|||||||
#include "BL808_GPIO.h"
|
|
||||||
#include <bl808_glb.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
void BL808_GPIO_platformDisable(PikaObj* self) {}
|
|
||||||
|
|
||||||
uint32_t getPinMode(char* mode) {
|
|
||||||
if (strEqu(mode, "out")) {
|
|
||||||
return GPIO_MODE_OUTPUT;
|
|
||||||
}
|
|
||||||
if (strEqu(mode, "in")) {
|
|
||||||
return GPIO_MODE_INPUT;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t getPinNum(char* pin) {
|
|
||||||
/* xx */
|
|
||||||
char* pin_num = pin + 1;
|
|
||||||
int pin_num_int = atoi(pin_num);
|
|
||||||
return pin_num_int;
|
|
||||||
}
|
|
||||||
|
|
||||||
void BL808_GPIO_platformEnable(PikaObj* self) {
|
|
||||||
/* Pxx */
|
|
||||||
char* pin = obj_getStr(self, "pin");
|
|
||||||
char* mode = obj_getStr(self, "mode");
|
|
||||||
printf("[ Info]: pin: %s, mode: %s, enable...\r\n", pin, mode);
|
|
||||||
// char *pull = obj_getStr(self, "pull");
|
|
||||||
|
|
||||||
GLB_GPIO_Cfg_Type cfg;
|
|
||||||
cfg.drive = 0;
|
|
||||||
cfg.smtCtrl = 1;
|
|
||||||
cfg.gpioFun = GPIO_FUN_GPIO;
|
|
||||||
cfg.outputMode = 0;
|
|
||||||
cfg.pullType = GPIO_PULL_NONE;
|
|
||||||
|
|
||||||
cfg.gpioPin = getPinNum(pin);
|
|
||||||
cfg.gpioMode = getPinMode(mode);
|
|
||||||
GLB_GPIO_Init(&cfg);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BL808_GPIO_platformHigh(PikaObj* self) {
|
|
||||||
char* pin = obj_getStr(self, "pin");
|
|
||||||
printf("[ Info]: pin: %s set high...\r\n", pin);
|
|
||||||
GLB_GPIO_Write(getPinNum(pin), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BL808_GPIO_platformLow(PikaObj* self) {
|
|
||||||
char* pin = obj_getStr(self, "pin");
|
|
||||||
printf("[ Info]: pin: %s set low...\r\n", pin);
|
|
||||||
GLB_GPIO_Write(getPinNum(pin), false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BL808_GPIO_platformRead(PikaObj* self) {
|
|
||||||
char* pin = obj_getStr(self, "pin");
|
|
||||||
obj_setInt(self, "readBuff", GLB_GPIO_Read(getPinNum(pin)));
|
|
||||||
}
|
|
||||||
|
|
||||||
void BL808_GPIO_platformSetMode(PikaObj* self) {
|
|
||||||
char* pin = obj_getStr(self, "pin");
|
|
||||||
char* mode = obj_getStr(self, "mode");
|
|
||||||
|
|
||||||
GLB_GPIO_Cfg_Type cfg;
|
|
||||||
cfg.drive = 0;
|
|
||||||
cfg.smtCtrl = 1;
|
|
||||||
cfg.gpioFun = GPIO_FUN_GPIO;
|
|
||||||
cfg.outputMode = 0;
|
|
||||||
cfg.pullType = GPIO_PULL_NONE;
|
|
||||||
|
|
||||||
cfg.gpioPin = getPinNum(pin);
|
|
||||||
cfg.gpioMode = getPinMode(mode);
|
|
||||||
GLB_GPIO_Init(&cfg);
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
#include "BL808_Time.h"
|
|
||||||
#include <FreeRTOS.h>
|
|
||||||
#include <task.h>
|
|
||||||
|
|
||||||
void BL808_Time_sleep_ms(PikaObj* self, int ms) {
|
|
||||||
vTaskDelay(pdMS_TO_TICKS(ms));
|
|
||||||
}
|
|
||||||
|
|
||||||
void BL808_Time_sleep_s(PikaObj* self, int s) {
|
|
||||||
vTaskDelay(pdMS_TO_TICKS(1000 * s));
|
|
||||||
}
|
|
@ -418,10 +418,6 @@ releases = [
|
|||||||
name = "modbus"
|
name = "modbus"
|
||||||
releases = [ "v0.0.1 729ce8a497d73b53888180b9f6d0dfdac145df26" ]
|
releases = [ "v0.0.1 729ce8a497d73b53888180b9f6d0dfdac145df26" ]
|
||||||
|
|
||||||
[[packages]]
|
|
||||||
name = "BL808"
|
|
||||||
releases = [ "v0.0.1 b3b2f1c0e30b703666342ae4628e544299cdbd11" ]
|
|
||||||
|
|
||||||
[[packages]]
|
[[packages]]
|
||||||
name = "pika_fatfs"
|
name = "pika_fatfs"
|
||||||
releases = [
|
releases = [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user