[英]Pointer to Data Buffer in C STM32
I'm fairly new to C and have following question.我对 C 相当陌生,并且有以下问题。
I want to transmit data through I2C on STM 32 and the command is我想通过 STM 32 上的 I2C 传输数据,命令是
HAL_StatusTypeDef HAL_I2C_Master_Transmit(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint8_t *pData, uint16_t Size, uint32_t Timeout);
EDIT1: on each array element there is 8 bit count EDIT1:在每个数组元素上都有 8 位计数
This means that the data is of 8bits or 1byte.这意味着数据是 8 位或 1 字节。 But in code I've found that an array of 8bytes has been sent using the above command.
但在代码中,我发现使用上述命令发送了一个 8 字节数组。 Can anyone help and explain how byte data is sent on 8 bit size.
任何人都可以帮助并解释如何以 8 位大小发送字节数据。
TxFrame[0]=0_AnalogCntIn8[HI];
TxFrame[1]=0_AnalogCntIn8[LO];
TxFrame[2]=1_AnalogCntIn8[HI];
TxFrame[3]=1_AnalogCntIn8[LO];
TxFrame[4]=2_AnalogCntIn8[HI];
TxFrame[5]=2_AnalogCntIn8[LO];
TxFrame[6]=3_AnalogCntIn8[HI];
TxFrame[7]=3_AnalogCntIn8[LO];
HAL_I2C_Master_Transmit(&hi2c2,DAC_ID,TxFrame,8,100);
I got the answer.我得到了答案。 Its the HAL handler of I2C which keeps on incrementing according to array and size we enter in the I2C command.
它是 I2C 的 HAL 处理程序,它根据我们在 I2C 命令中输入的数组和大小不断增加。
hi2c->pBuffPtr++;
hi2c->XferCount--;
hi2c->XferSize--;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.