Lawson_Li
在下李大聪明
2019-01-07 11:52

STM32F105主板HAL库函数HAL_UART_Receive_IT()中第二个参数uint8_t *pData必须为无符号整型??

  • c语言

stm32f1xx_hal_uart.c文件中对HAL_UART_Receive_IT()函数的描述为

HAL_StatusTypeDef HAL_UART_Transmit_IT(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size)
{
  /* Check that a Tx process is not already ongoing */
  if(huart->gState == HAL_UART_STATE_READY)
  {
    if((pData == NULL) || (Size == 0U)) 
    {
      return HAL_ERROR;
    }
    /* Process Locked */
    __HAL_LOCK(huart);

    huart->pTxBuffPtr = pData;
    huart->TxXferSize = Size;
    huart->TxXferCount = Size;

    huart->ErrorCode = HAL_UART_ERROR_NONE;
    huart->gState = HAL_UART_STATE_BUSY_TX;

    /* Process Unlocked */
    __HAL_UNLOCK(huart);

    /* Enable the UART Transmit data register empty Interrupt */
    __HAL_UART_ENABLE_IT(huart, UART_IT_TXE);

    return HAL_OK;
  }
  else
  {
    return HAL_BUSY;
  }
}

其中第二个参数定义为uint8_t *pData
本人使用串口中断接收温度数据,而温度数据是有符号整型的,与上述函数定义矛盾,请问应该怎样更改呢??

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答