mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-15 17:02:53 +08:00
36 lines
927 B
C
36 lines
927 B
C
#include "main.h"
|
|
#include "baseObj.h"
|
|
|
|
static void led1onFun(MimiObj *self, Args *args)
|
|
{
|
|
HAL_GPIO_WritePin(GPIOF, GPIO_PIN_10, GPIO_PIN_RESET);
|
|
}
|
|
|
|
static void led1offFun(MimiObj *self, Args *args)
|
|
{
|
|
HAL_GPIO_WritePin(GPIOF, GPIO_PIN_10, GPIO_PIN_SET);
|
|
}
|
|
|
|
static void led2onFun(MimiObj *self, Args *args)
|
|
{
|
|
HAL_GPIO_WritePin(GPIOF, GPIO_PIN_9, GPIO_PIN_RESET);
|
|
}
|
|
|
|
static void led2offFun(MimiObj *self, Args *args)
|
|
{
|
|
HAL_GPIO_WritePin(GPIOF, GPIO_PIN_9, GPIO_PIN_SET);
|
|
}
|
|
|
|
MimiObj *New_LED(Args *args)
|
|
{
|
|
/* Derive from the tiny object class.
|
|
Tiny object can not import sub object.
|
|
Tiny object is the smallest object. */
|
|
MimiObj *self = New_TinyObj(args);
|
|
class_defineMethod(self, "led1on()", led1onFun);
|
|
class_defineMethod(self, "led1off()", led1offFun);
|
|
class_defineMethod(self, "led2on()", led2onFun);
|
|
class_defineMethod(self, "led2off()", led2offFun);
|
|
return self;
|
|
}
|