34 lines
852 B
C
Raw Normal View History

2021-10-01 00:21:50 +08:00
#include "PikaStdDevice_ADC.h"
#include "BaseObj.h"
void PikaStdDevice_ADC_enable(PikaObj* self) {
2021-12-10 22:26:13 +08:00
obj_run(self, "platformEnable()");
2021-10-01 00:21:50 +08:00
}
void PikaStdDevice_ADC_init(PikaObj* self) {
obj_setStr(self, "pin", "PA0");
}
void PikaStdDevice_ADC___init__(PikaObj* self) {
PikaStdDevice_ADC_init(self);
}
2021-10-01 00:21:50 +08:00
float PikaStdDevice_ADC_read(PikaObj* self) {
2021-12-10 22:26:13 +08:00
obj_run(self, "platformRead()");
2021-10-01 00:21:50 +08:00
return obj_getFloat(self, "val");
}
void PikaStdDevice_ADC_setPin(PikaObj* self, char* pin) {
2021-10-01 00:21:50 +08:00
obj_setStr(self, "pin", pin);
}
2021-12-10 22:26:13 +08:00
void PikaStdDevice_ADC_platformEnable(PikaObj* self) {
2021-10-01 00:21:50 +08:00
obj_setErrorCode(self, 1);
obj_setSysOut(self, "[error] platform method need to be override.");
}
2021-12-10 22:26:13 +08:00
void PikaStdDevice_ADC_platformRead(PikaObj* self) {
2021-10-01 00:21:50 +08:00
obj_setErrorCode(self, 1);
obj_setSysOut(self, "[error] platform method need to be override.");
2021-12-10 22:26:13 +08:00
}