pikapython/package/TemplateDevice/TemplateDevice_UART.c
李昂 b0840b9869 !30 add pks_eventLister and support event signal
* format
* use inner_bytecode instead of obj_run
* add asserts for event-test
* test event for PikaStdDevice is ok
* adding event fealure
* fetch PikaStdDevice_Time to port linux
2022-06-17 05:22:47 +00:00

27 lines
935 B
C

#include "TemplateDevice_UART.h"
#include <stdio.h>
void TemplateDevice_UART_platformDisable(PikaObj* self) {}
void TemplateDevice_UART_platformEnable(PikaObj* self) {}
void TemplateDevice_UART_platformRead(PikaObj* self) {}
void TemplateDevice_UART_platformReadBytes(PikaObj* self) {
int length = obj_getInt(self, "length");
uint8_t bytes_buff[] = {0x00, 0x01, 0x02, 0x03, 0x04,
0x05, 0x06, 0x07, 0x08};
obj_setBytes(self, "readData", bytes_buff, length);
}
void TemplateDevice_UART_platformWrite(PikaObj* self) {}
void TemplateDevice_UART_platformWriteBytes(PikaObj* self) {
uint8_t* bytes = obj_getBytes(self, "writeData");
int length = obj_getBytesSize(self, "writeData");
printf("[debug]: write to uart: [ ");
for (int i = 0; i < length; i++) {
printf("0x%02X ", bytes[i]);
}
printf("]\n");
}
void TemplateDevice_UART_platformGetEventId(PikaObj *self){
}