41 lines
998 B
C
Raw Normal View History

2022-04-07 13:32:53 +08:00
#include "PikaStdDevice_ADC.h"
#include "BaseObj.h"
2022-11-20 22:16:41 +08:00
#include "pika_hal.h"
2022-04-07 13:32:53 +08:00
void PikaStdDevice_ADC_enable(PikaObj* self) {
obj_runNativeMethod(self, "platformEnable", NULL);
}
void PikaStdDevice_ADC_disable(PikaObj* self) {
obj_runNativeMethod(self, "platformDisable", NULL);
}
void PikaStdDevice_ADC_init(PikaObj* self) {
obj_setStr(self, "pin", "PA0");
}
void PikaStdDevice_ADC___init__(PikaObj* self) {
PikaStdDevice_ADC_init(self);
}
pika_float PikaStdDevice_ADC_read(PikaObj* self) {
2022-04-07 13:32:53 +08:00
obj_runNativeMethod(self, "platformRead", NULL);
return obj_getFloat(self, "val");
}
void PikaStdDevice_ADC_setPin(PikaObj* self, char* pin) {
obj_setStr(self, "pin", pin);
}
void PikaStdDevice_ADC_platformEnable(PikaObj* self) {
2022-08-26 19:41:25 +08:00
ABSTRACT_METHOD_NEED_OVERRIDE_ERROR();
2022-04-07 13:32:53 +08:00
}
void PikaStdDevice_ADC_platformDisable(PikaObj* self) {
2022-08-26 19:41:25 +08:00
ABSTRACT_METHOD_NEED_OVERRIDE_ERROR();
2022-04-07 13:32:53 +08:00
}
void PikaStdDevice_ADC_platformRead(PikaObj* self) {
2022-08-26 19:41:25 +08:00
ABSTRACT_METHOD_NEED_OVERRIDE_ERROR();
2022-04-07 13:32:53 +08:00
}