fix readData, writeData return

fix readData for stm32F1
This commit is contained in:
lyon 2022-10-24 19:00:24 +08:00
parent 462087997e
commit 72f9853bb8
8 changed files with 10 additions and 10 deletions

View File

@ -114,7 +114,7 @@ void CH582_UART_platformWrite(PikaObj *self)
{
int id = obj_getInt(self, "id");
char *data = NULL;
size_t len = obj_loadBytes(self, "data", data);
size_t len = obj_loadBytes(self, "writeData", data);
switch (id)
{
case 0:

View File

@ -249,7 +249,7 @@ void STM32F1_IIC_platformRead(PikaObj* self) {
void STM32F1_IIC_platformWrite(PikaObj* self) {
int addr = obj_getInt(self, "addr");
char* data = obj_getStr(self, "data");
char* data = obj_getStr(self, "writeData");
pika_IIC_info* iic = obj_getPtr(self, "iic");
MPU_Write_Len(iic, iic->deviceAddr, addr, strGetSize(data), (uint8_t*)data);

View File

@ -302,12 +302,12 @@ void STM32F1_UART_platformRead(PikaObj* self) {
UART_Start_Receive_IT(
&pika_uart->huart,
(uint8_t*)(pika_uart->rxBuff + pika_uart->rxBuffOffset), 1);
args_deinit(buffs);
obj_setStr(self,"readData", readBuff);
args_deinit(buffs);
}
void STM32F1_UART_platformWrite(PikaObj* self) {
char *data = obj_getStr(self, "data");
char *data = obj_getStr(self, "writeData");
int id = obj_getInt(self, "id");
HAL_UART_Transmit(getUartHandle(id), (uint8_t*)data, strGetSize(data), 100);
}

View File

@ -249,7 +249,7 @@ void STM32F4_IIC_platformRead(PikaObj* self) {
void STM32F4_IIC_platformWrite(PikaObj* self) {
int addr = obj_getInt(self, "addr");
char* data = obj_getStr(self, "data");
char* data = obj_getStr(self, "writeData");
pika_IIC_info* iic = obj_getPtr(self, "iic");
MPU_Write_Len(iic, iic->deviceAddr, addr, strGetSize(data), (uint8_t*)data);

View File

@ -297,7 +297,7 @@ void STM32F4_UART_platformRead(PikaObj* self) {
}
void STM32F4_UART_platformWrite(PikaObj* self) {
char *data = obj_getStr(self, "data");
char *data = obj_getStr(self, "writeData");
int id = obj_getInt(self, "id");
HAL_UART_Transmit(getUartHandle(id), (uint8_t*)data, strGetSize(data), 100);
}

View File

@ -244,7 +244,7 @@ void STM32G0_IIC_platformRead(PikaObj* self) {
void STM32G0_IIC_platformWrite(PikaObj* self) {
int addr = obj_getInt(self, "addr");
char* data = obj_getStr(self, "data");
char* data = obj_getStr(self, "writeData");
pika_IIC_info* iic = obj_getPtr(self, "iic");
MPU_Write_Len(iic, iic->deviceAddr, addr, strGetSize(data), (uint8_t*)data);

View File

@ -38,7 +38,7 @@ void W801Device_IIC_platformRead(PikaObj* self)
void W801Device_IIC_platformWrite(PikaObj* self)
{
int addr = obj_getInt(self, "addr");
char* data = obj_getStr(self, "data");
char* data = obj_getStr(self, "writeData");
I2C_HandleTypeDef* iic = obj_getPtr(self, "iic");
HAL_I2C_Write(iic, iic->deviceAddr, addr, (uint8_t*)data,strGetSize(data));
}

View File

@ -343,13 +343,13 @@ void W801Device_UART_platformRead(PikaObj *self)
}
FifoRead(id-1,readBuff,length);
obj_setStr(self, "readBuff", readBuff);
obj_setStr(self, "readData", readBuff);
args_deinit(buffs);
}
void W801Device_UART_platformWrite(PikaObj *self)
{
char* data = obj_getStr(self, "data");
char* data = obj_getStr(self, "writeData");
int id = obj_getInt(self, "id");
switch(id)