stm32 linux 超级终端,stm32的usart操纵超级终端(usart 操纵串口)

payload_array[i] += 1;

}

}

NRF905SE_SendPacket(payload_array, payloadSize);

//NRF905SE_SetTxPayload(payload_array, payloadSize);

//NRF905SE_SendData();

/*

for(u32 i=0; i<1000; i++) {

for(u32 j = 0; j<1000; j++)

for(u32 k=0; k<5; k++);

}

*/

}

#endif

//receive data

#if 0

NRF905SE_SetRxAddress("1234", 4);

NRF905SE_SetTxAddress("0123", 4);

u8 tx_array[4];

u8 rx_array[4];

NRF905SE_GetRxAddress(rx_array, 4);

NRF905SE_GetTxAddress(tx_array, 4);

usart_cls();

usart_puts("this is the NRF905SE transfer for receive data, its info are as follows: ");

usart_println();

usart_puts("我的接收地址: ");

usart_printArray(rx_array, 4);

usart_println();

usart_puts("我的目标发送地址:");

usart_printArray(tx_array, 4);

usart_println();

usart_puts("我开始接受来自发射器:");

usart_printArray(tx_array, 4);

usart_puts("发送来的数据:");

usart_println();

u8 payloadSize = NRF905SE_GetRxPayloadSize();

u8 n = 48;

while(1) {

/*****发送32字节的数据包*****/

if(n== 58 )  {

n -= 10;

usart_println();

}

if(NRF905SE_ReceivePacket(NRF905SE_RxBuffer, payloadSize) ) {

usart_puts("收包(");

usart_putc(n++);

usart_puts("): ");

usart_printArray(NRF905SE_RxBuffer, payloadSize);

usart_println();

}

}

#endif

while(1);

}

#ifdef  DEBUG

/*******************************************************************************

* Function Name  : assert_failed

* Description    : Reports the name of the source file and the source line number

*                  where the assert_param error has occurred.

* Input          : - file: pointer to the source file name

*                  - line: assert_param error line source number

* Output         : None

* Return         : None

*******************************************************************************/

void assert_failed(u8* file, u32 line)

{

volatile bool Flag = TRUE;

/* User can add his own implementation to report the file name and line number,

ex: printf("Wrong parameters value: file %s on line %drn", file, line) */

/* Infinite loop */

while (Flag )

{

}

}

#endif

4.备注:以上代码是基于stm32固件库的,具体的端口配置,具体的板子相关。代码是基于IAR开发的。

c2c9ed493cd281aa86d8a6f5178c4c01.gif [1] [2] [3] [4] 610626052e95c7fbe3d254abc769d9ad.gif

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值