mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-15 17:02:53 +08:00
105 lines
3.7 KiB
C
105 lines
3.7 KiB
C
|
/*********************************************************************************************************************
|
|||
|
* COPYRIGHT NOTICE
|
|||
|
* Copyright (c) 2020,<EFBFBD><EFBFBD><EFBFBD>ɿƼ<EFBFBD>
|
|||
|
* All rights reserved.
|
|||
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>QQȺ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ⱥ<EFBFBD><EFBFBD>824575535
|
|||
|
*
|
|||
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݰ<EFBFBD>Ȩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɿƼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD>δ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD>;<EFBFBD><EFBFBD>
|
|||
|
* <EFBFBD><EFBFBD>ӭ<EFBFBD><EFBFBD>λʹ<EFBFBD>ò<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD>뱣<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɿƼ<EFBFBD><EFBFBD>İ<EFBFBD>Ȩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*
|
|||
|
* @file <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD>
|
|||
|
* @company <EFBFBD>ɶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɿƼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˾
|
|||
|
* @author <EFBFBD><EFBFBD><EFBFBD>ɿƼ<EFBFBD>(QQ3184284598)
|
|||
|
* @version <EFBFBD>鿴doc<EFBFBD><EFBFBD>version<EFBFBD>ļ<EFBFBD> <EFBFBD>汾˵<EFBFBD><EFBFBD>
|
|||
|
* @Software ADS v1.2.2
|
|||
|
* @Target core TC264D
|
|||
|
* @Taobao https://seekfree.taobao.com/
|
|||
|
* @date 2020-3-23
|
|||
|
* @note
|
|||
|
<EFBFBD><EFBFBD><EFBFBD>߶<EFBFBD><EFBFBD>壺
|
|||
|
------------------------------------
|
|||
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>Ƭ<EFBFBD><EFBFBD>
|
|||
|
RX <EFBFBD>鿴SEEKFREE_WIRELESS.h<EFBFBD>ļ<EFBFBD><EFBFBD>е<EFBFBD>WIRELESS_UART_TX<EFBFBD>궨<EFBFBD><EFBFBD>
|
|||
|
TX <EFBFBD>鿴SEEKFREE_WIRELESS.h<EFBFBD>ļ<EFBFBD><EFBFBD>е<EFBFBD>WIRELESS_UART_RX<EFBFBD>궨<EFBFBD><EFBFBD>
|
|||
|
RTS <EFBFBD>鿴SEEKFREE_WIRELESS.h<EFBFBD>ļ<EFBFBD><EFBFBD>е<EFBFBD>RTS_PIN<EFBFBD>궨<EFBFBD><EFBFBD>
|
|||
|
CMD <EFBFBD><EFBFBD><EFBFBD>ջ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
------------------------------------
|
|||
|
********************************************************************************************************************/
|
|||
|
|
|||
|
|
|||
|
#include "zf_stm_systick.h"
|
|||
|
#include "zf_gpio.h"
|
|||
|
#include "zf_uart.h"
|
|||
|
#include "SEEKFREE_WIRELESS.h"
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
uint8 wireless_rx_buffer;
|
|||
|
//-------------------------------------------------------------------------------------------------------------------
|
|||
|
// @brief <20><><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3> <20><><EFBFBD><EFBFBD><EFBFBD>жϺ<D0B6><CFBA><EFBFBD>
|
|||
|
// @param void
|
|||
|
// @return void
|
|||
|
// @since v1.0
|
|||
|
// Sample usage:
|
|||
|
// @note <20>ú<EFBFBD><C3BA><EFBFBD><EFBFBD><EFBFBD>ISR<53>ļ<EFBFBD> <20><><EFBFBD><EFBFBD>2<EFBFBD>жϳ<D0B6><CFB3><EFBFBD><F2B1BBB5><EFBFBD>
|
|||
|
//-------------------------------------------------------------------------------------------------------------------
|
|||
|
void wireless_uart_callback(void)
|
|||
|
{
|
|||
|
while(uart_query(WIRELESS_UART, &wireless_rx_buffer));
|
|||
|
//<2F><>ȡ<EFBFBD>յ<EFBFBD><D5B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
//-------------------------------------------------------------------------------------------------------------------
|
|||
|
// @brief <20><><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>
|
|||
|
// @param NULL
|
|||
|
// @return void
|
|||
|
// @since v1.0
|
|||
|
// Sample usage:
|
|||
|
// @note
|
|||
|
//-------------------------------------------------------------------------------------------------------------------
|
|||
|
void seekfree_wireless_init(void)
|
|||
|
{
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>õIJ<C3B5><C4B2><EFBFBD><EFBFBD><EFBFBD>Ϊ115200<30><30>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD>Ĭ<EFBFBD>ϲ<EFBFBD><CFB2><EFBFBD><EFBFBD>ʣ<EFBFBD><CAA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD>鲢<EFBFBD>Ĵ<DEB8><C4B4>ڵIJ<DAB5><C4B2><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
gpio_init(RTS_PIN, GPI, 0, PULLDOWN);//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
uart_init (WIRELESS_UART, WIRELESS_UART_BAUD, WIRELESS_UART_TX, WIRELESS_UART_RX); //<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
//-------------------------------------------------------------------------------------------------------------------
|
|||
|
// @brief <20><><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3> <20><><EFBFBD>ͺ<EFBFBD><CDBA><EFBFBD>
|
|||
|
// @param buff <20><>Ҫ<EFBFBD><D2AA><EFBFBD>͵<EFBFBD><CDB5><EFBFBD><EFBFBD>ݵ<EFBFBD>ַ
|
|||
|
// @param len <20><><EFBFBD>ͳ<EFBFBD><CDB3><EFBFBD>
|
|||
|
// @return uint32 ʣ<><CAA3>δ<EFBFBD><CEB4><EFBFBD>͵<EFBFBD><CDB5>ֽ<EFBFBD><D6BD><EFBFBD>
|
|||
|
// @since v1.0
|
|||
|
// Sample usage:
|
|||
|
// @note
|
|||
|
//-------------------------------------------------------------------------------------------------------------------
|
|||
|
uint32 seekfree_wireless_send_buff(uint8 *buff, uint32 len)
|
|||
|
{
|
|||
|
while(len>30)
|
|||
|
{
|
|||
|
if(gpio_get(RTS_PIN))
|
|||
|
{
|
|||
|
return len;//ģ<><C4A3>æ,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9>while<6C>ȴ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>ú<EFBFBD><C3BA><EFBFBD>ע<EFBFBD>͵<EFBFBD>while<6C>ȴ<EFBFBD><C8B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>滻<EFBFBD><E6BBBB>if<69><66><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
//while(gpio_get(RTS_PIN)); //<2F><><EFBFBD><EFBFBD>RTSΪ<53>͵<EFBFBD>ƽ<EFBFBD><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
uart_putbuff(WIRELESS_UART,buff,30);
|
|||
|
|
|||
|
buff += 30; //<2F><>ַƫ<D6B7><C6AB>
|
|||
|
len -= 30;//<2F><><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
if(gpio_get(RTS_PIN))
|
|||
|
{
|
|||
|
return len;//ģ<><C4A3>æ,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9>while<6C>ȴ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>ú<EFBFBD><C3BA><EFBFBD>ע<EFBFBD>͵<EFBFBD>while<6C>ȴ<EFBFBD><C8B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>滻<EFBFBD><E6BBBB>if<69><66><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
//while(gpio_get(RTS_PIN)); //<2F><><EFBFBD><EFBFBD>RTSΪ<53>͵<EFBFBD>ƽ<EFBFBD><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
uart_putbuff(WIRELESS_UART,buff,len);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
return 0;
|
|||
|
}
|