mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-15 17:02:53 +08:00
fix readData, writeData return
fix readData for stm32F1
This commit is contained in:
parent
462087997e
commit
72f9853bb8
@ -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:
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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));
|
||||
}
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user