• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ HAL_UART_Transmit函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中HAL_UART_Transmit函数的典型用法代码示例。如果您正苦于以下问题:C++ HAL_UART_Transmit函数的具体用法?C++ HAL_UART_Transmit怎么用?C++ HAL_UART_Transmit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了HAL_UART_Transmit函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: UART_Transmit

int UART_Transmit(uint8_t* data, uint16_t size){
	  HAL_StatusTypeDef status = HAL_UART_Transmit(&UartHandle, data, size, 0xffff);

    if (status != HAL_OK) {
        //while (1);
        return 0;
    }
    return 1;
}
开发者ID:sylvanYZY,项目名称:CANNON_STM32F401RE_9-axis,代码行数:9,代码来源:stm32f4xx_hal_msp.c


示例2: EXTI2_IRQHandler

/**
* @brief This function handles EXTI line2 interrupt.
*/
void EXTI2_IRQHandler(void)
{
  /* USER CODE BEGIN EXTI2_IRQn 0 */
	HAL_UART_Transmit(&huart2,"IRQexti2\n",9,100);
  /* USER CODE END EXTI2_IRQn 0 */
  HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_2);
  /* USER CODE BEGIN EXTI2_IRQn 1 */
  /* USER CODE END EXTI2_IRQn 1 */
}
开发者ID:dddaamien,项目名称:WS2812_clock,代码行数:12,代码来源:stm32f1xx_it.c


示例3: NMI_Handler

/**
* @brief This function handles Non maskable interrupt.
*/
void NMI_Handler(void)
{
  /* USER CODE BEGIN NonMaskableInt_IRQn 0 */
	HAL_UART_Transmit(&huart2,"IRQnmi\n",7,100);
  /* USER CODE END NonMaskableInt_IRQn 0 */
  HAL_RCC_NMI_IRQHandler();
  /* USER CODE BEGIN NonMaskableInt_IRQn 1 */
  /* USER CODE END NonMaskableInt_IRQn 1 */
}
开发者ID:dddaamien,项目名称:WS2812_clock,代码行数:12,代码来源:stm32f1xx_it.c


示例4: Serial_PutByte

/**
  * @brief  Transmit a byte to the HyperTerminal
  * @param  param The byte to be sent
  * @retval HAL_StatusTypeDef HAL_OK if OK
  */
HAL_StatusTypeDef Serial_PutByte( uint8_t param )
{
  /* May be timeouted... */
  if ( UartHandle.State == HAL_UART_STATE_TIMEOUT )
  {
    UartHandle.State = HAL_UART_STATE_READY;
  }
  return HAL_UART_Transmit(&UartHandle, &param, 1, TX_TIMEOUT);
}
开发者ID:Lembed,项目名称:STM32CubeF1-mirrors,代码行数:14,代码来源:common.c


示例5: hal_uart_send

int32_t hal_uart_send(uart_dev_t *uart, const void *data, uint32_t size, uint32_t timeout)
{
    uint32_t i;
    for(i = 0; i < size; i++)
    {
        HAL_UART_Transmit(&huart4, (uint8_t *)(&data[i]), 1, 0xFFFF); 
    }
    return 0;
}
开发者ID:cyysu,项目名称:AliOS-Things,代码行数:9,代码来源:main.c


示例6: armPortWrite

int armPortWrite(void* port, const void* buf, size_t nbyte)
{	
	UART_HandleTypeDef* huart = (UART_HandleTypeDef*)port;
	
	if(HAL_UART_Transmit(huart, (uint8_t*)buf, nbyte, 100) == HAL_OK)
		return nbyte;
	
	return -1;
}
开发者ID:RomualdoGobbo,项目名称:armapi,代码行数:9,代码来源:armport_stm32.c


示例7: HELPER_UART_Transmit

/**
 * @brief	Funzione di trasmissione BLOCCANTE per UART.
 * @param	numUart: numero della periferica UART da cui trasmettere.
 * 			numUart deve essere precedentemente abilitata per la trasmissione previa inizializzazione
 * 			e può assumere uno dei seguenti valori:
 * 			@arg HELPER_UART1: periferica UART 1;
 * 			@arg HELPER_UART2: periferica UART 2.
 * 			@arg HELPER_UART3: periferica UART 3;
 * 			@arg HELPER_UART4: periferica UART 4.
 * 			@arg HELPER_UART5: periferica UART 5;
 * 			@arg HELPER_UART6: periferica UART 6.
 *
 * @param	pData:	puntatore all'area di memoria da cui leggere il valore da trasferire.
 *
 * @param	Size: dimensione del trasferimento.
 * @retval	Stato, che può assumere uno dei seguenti valori:
 * 			@arg	HELPER_UART_OK:	trasmissione avvenuta con successo;
 * 			@arg	HELPER_UART_ERROR:	Errore qualsiasi avvenuto durante la trasmissione.
 */
HELPER_UART_Status_TypeDef HELPER_UART_Transmit(HELPER_UART_TypeDef numUart,uint8_t *pData,uint16_t Size){
	UART_HandleTypeDef  *UartHandle_x=HELPER_UART_GetHandle(numUart);

	while(HAL_UART_Transmit(UartHandle_x, pData, Size, 10000)!=HAL_OK){
	if (HAL_UART_GetError(UartHandle_x) != HAL_UART_ERROR_NONE)
		return  HELPER_UART_ERROR;
	}
	return HELPER_UART_OK;
}
开发者ID:ntonjeta,项目名称:Nodo-Sensore,代码行数:28,代码来源:stm32f4xx_uart_helper.c


示例8: xHardwareUartTx

BaseType_t xHardwareUartTx(char* data, uint8_t data_length)
{
    if(HAL_UART_Transmit(&UartHandle, (uint8_t*)data, data_length, USARTx_TIMEOUT) != HAL_OK)
    {
        vErrorWarning("UART: transmit failed");
        return pdFAIL;
    }
    return pdPASS;
}
开发者ID:otwieracz,项目名称:stm32-freertos,代码行数:9,代码来源:uart.c


示例9: SendChar

/* SendChar */
void SendChar (char letter){

	aTxBuffer[0]=letter;

	if(	HAL_UART_Transmit(&huart2,(uint8_t*)aTxBuffer, 1, 500)!= HAL_OK){
		while(1){
		}
	}
}
开发者ID:cgroupsupport,项目名称:grrv,代码行数:10,代码来源:uart_cgroup.c


示例10: MainTask

void MainTask()
{	
	for(;;)
	{
		// Wait for adc result and write it to the UART connected to the PC.
		osEvent result = osMessageGet(mainTaskMessageQId, osWaitForever);
		HAL_UART_Transmit(&huart2, (uint8_t*)&result.value.v, 4, 100);
	}
}
开发者ID:wolfsberger,项目名称:STMCube-TempSensor,代码行数:9,代码来源:mainTask.cpp


示例11: Serial_PutString

/**
  * @brief  Print a string on the HyperTerminal
  * @param  p_string: The string to be printed
  * @retval None
  */
void Serial_PutString(uint8_t *p_string)
{
  uint16_t length = 0;

  while (p_string[length] != '\0')
  {
    length++;
  }
  HAL_UART_Transmit(&UartHandle, p_string, length, TX_TIMEOUT);
}
开发者ID:Lembed,项目名称:STM32CubeF1-mirrors,代码行数:15,代码来源:common.c


示例12: Uart_Tx_String

int Uart_Tx_String(char *string, uint16_t len)
{
    HAL_StatusTypeDef status = HAL_UART_Transmit(&UartHandle, (uint8_t *)string, len, 0xFFFF);

    if (status != HAL_OK) {
        //while (1);
        return HAL_MSP_FAIL;
    }
    return HAL_MSP_SUCCESS;
}
开发者ID:gilbertjuly,项目名称:STM32_Platform,代码行数:10,代码来源:stm32f4xx_hal_msp.c


示例13: SendInt

void SendInt(int num)
{
	uint8_t array[5];
	array[0]=num>>24;
	array[1]=num>>16;
	array[2]=num>>8;
	array[3]=num;
	array[4]='\n';
	HAL_UART_Transmit(&UartResultHandle,array,5,5);
}
开发者ID:ndhuan,项目名称:GPSRTK,代码行数:10,代码来源:main.c


示例14: main

int main(void) {
  char msg[20];

  HAL_Init();
  Nucleo_BSP_Init();

  /* Before we can access to every register of the PWR peripheral we must enable it */
  __HAL_RCC_PWR_CLK_ENABLE();

  while (1) {
    if(__HAL_PWR_GET_FLAG(PWR_FLAG_SB)) {
      /* If standby flag set in PWR->CSR, then the reset is generated from
       * the exit of the standby mode */
      sprintf(msg, "RESET after STANDBY mode\r\n");
      HAL_UART_Transmit(&huart2, (uint8_t*)msg, strlen(msg), HAL_MAX_DELAY);
      /* We have to explicitly clear the flag */
      __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU|PWR_FLAG_SB);
    }

    sprintf(msg, "MCU in run mode\r\n");
    HAL_UART_Transmit(&huart2, (uint8_t*)msg, strlen(msg), HAL_MAX_DELAY);
    while(HAL_GPIO_ReadPin(GPIOC, GPIO_PIN_13) == GPIO_PIN_SET) {
      HAL_GPIO_TogglePin(LD2_GPIO_Port, LD2_Pin);
      HAL_Delay(100);
    }

    HAL_Delay(200);

    sprintf(msg, "Entering in SLEEP mode\r\n");
    HAL_UART_Transmit(&huart2, (uint8_t*)msg, strlen(msg), HAL_MAX_DELAY);

    SleepMode();

    sprintf(msg, "Exiting from SLEEP mode\r\n");
    HAL_UART_Transmit(&huart2, (uint8_t*)msg, strlen(msg), HAL_MAX_DELAY);

    while(HAL_GPIO_ReadPin(GPIOC, GPIO_PIN_13) == GPIO_PIN_SET);
    HAL_Delay(200);

    sprintf(msg, "Entering in STOP mode\r\n");
    HAL_UART_Transmit(&huart2, (uint8_t*)msg, strlen(msg), HAL_MAX_DELAY);

    StopMode();

    sprintf(msg, "Exiting from STOP mode\r\n");
    HAL_UART_Transmit(&huart2, (uint8_t*)msg, strlen(msg), HAL_MAX_DELAY);

    while(HAL_GPIO_ReadPin(GPIOC, GPIO_PIN_13) == GPIO_PIN_SET);
    HAL_Delay(200);

    sprintf(msg, "Entering in STANDBY mode\r\n");
    HAL_UART_Transmit(&huart2, (uint8_t*)msg, strlen(msg), HAL_MAX_DELAY);

    StandbyMode();

    while(1); //Never arrives here, since MCU is reset when exiting from STANDBY
  }
}
开发者ID:Shreeyak,项目名称:mastering-stm32,代码行数:58,代码来源:main-ex1.c


示例15: UART_SendMsg

/**
  * @brief  Send a message via UART
  * @param  Msg the pointer to the message to be sent
  * @retval None
  */
void UART_SendMsg(TMsg *Msg)
{
  uint16_t CountOut;
  
  CHK_ComputeAndAdd(Msg);
  
  CountOut = ByteStuffCopy((uint8_t*) UART_TxBuffer, Msg);
  
  HAL_UART_Transmit(&UartHandle, (uint8_t*)UART_TxBuffer, CountOut, 5000);
}
开发者ID:heidiao,项目名称:stm32_nucleo,代码行数:15,代码来源:com.c


示例16: uartsent

void uartsent(int mode)
{
uint32_t c;
if (mode!=CMD_INTERACTIVE) return;
fetch_uint32_arg(&c);
USARTTxBuffer[0]=c;
printf("sending a character\n");
HAL_UART_Transmit(&UartHandle,USARTTxBuffer,1,1000);

}
开发者ID:arunkuttiyara,项目名称:stm32f303,代码行数:10,代码来源:serial.c


示例17: SendStr

/* SendStr */
void SendStr (char* stringToSend){

	int i = strlen(stringToSend);

	strcpy((char *)aTxBuffer,stringToSend);
	if(	HAL_UART_Transmit(&huart2, (uint8_t*)aTxBuffer, i,500)!= HAL_OK){
    while(1){
    }
  }
}
开发者ID:cgroupsupport,项目名称:grrv,代码行数:11,代码来源:uart_cgroup.c


示例18: uart_stm32_poll_out

static unsigned char uart_stm32_poll_out(struct device *dev,
					unsigned char c)
{
	struct uart_stm32_data *data = DEV_DATA(dev);
	UART_HandleTypeDef *UartHandle = &data->huart;

	HAL_UART_Transmit(UartHandle, (uint8_t *)&c, 1, TIMEOUT);

	return c;
}
开发者ID:sunkaizhu,项目名称:zephyr,代码行数:10,代码来源:uart_stm32.c


示例19: uart1Init

void uart1Init(){
	Uart1Handle.Instance = USART1;
	
	Uart1Handle.Init.BaudRate     = 57600;
  Uart1Handle.Init.WordLength   = UART_WORDLENGTH_8B;
  Uart1Handle.Init.StopBits     = UART_STOPBITS_1;
  Uart1Handle.Init.Parity       = UART_PARITY_NONE;
  Uart1Handle.Init.HwFlowCtl    = UART_HWCONTROL_NONE;
  Uart1Handle.Init.Mode         = UART_MODE_TX_RX;
  Uart1Handle.Init.OverSampling = UART_OVERSAMPLING_16;

  if(HAL_UART_Init(&Uart1Handle) != HAL_OK)
  {
    while(1);
  }
	HAL_UART_Transmit(&Uart1Handle, change_rate, sizeof(change_rate), 0xff);
	HAL_Delay(10);
	HAL_UART_Transmit(&Uart1Handle, change_rate, sizeof(change_rate), 0xff);
}
开发者ID:ydwzj,项目名称:STM32F4,代码行数:19,代码来源:mavlink.c


示例20: DoubleUart_transmit

void DoubleUart_transmit(uint32_t buffer[],uint32_t buffer2[])
{
	int i = 0;
	int count = 0;
	char tempbuffer[50] = {"Empty.."};
	uint32_t twaalfbit = 4095;
	//int acht = 8;
	for(i=0; i<ADC_BUFFER_LENGTH;i++)
	{
		  buffer[i] &= twaalfbit;
		  sprintf(tempbuffer,"pin a1: %05d   ",(int) buffer[i]);
		  HAL_UART_Transmit(&huart6,(uint8_t*) tempbuffer,strlen(tempbuffer),HAL_MAX_DELAY);
		  HAL_UART_Transmit(&huart6,(uint8_t*)"       ",strlen("       "),HAL_MAX_DELAY);
		  buffer2[i] &= twaalfbit;
		  sprintf(tempbuffer,"pin a2: %05d   ",(int) buffer2[i]);
		  HAL_UART_Transmit(&huart6,(uint8_t*) tempbuffer,strlen(tempbuffer),HAL_MAX_DELAY);
		  HAL_UART_Transmit(&huart6,(uint8_t*)"\r\n",strlen("\r\n"),HAL_MAX_DELAY);
	}
	HAL_UART_Transmit(&huart6,(uint8_t*)"\r\n",strlen("\r\n"),HAL_MAX_DELAY);
}
开发者ID:NickVermeylen,项目名称:3D-Sound-Impulse-Marker,代码行数:20,代码来源:main.c



注:本文中的HAL_UART_Transmit函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ HAL_WRITE_UINT32函数代码示例发布时间:2022-05-30
下一篇:
C++ HAL_UART_Receive_IT函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap