2022-01-18 00:58:54 +08:00

105 lines
3.7 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*********************************************************************************************************************
* COPYRIGHT NOTICE
* Copyright (c) 2020,<2C><><EFBFBD>ɿƼ<C9BF>
* All rights reserved.
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>QQȺ<51><C8BA><EFBFBD><EFBFBD>Ⱥ<EFBFBD><C8BA>824575535
*
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݰ<EFBFBD>Ȩ<EFBFBD><C8A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɿƼ<C9BF><C6BC><EFBFBD><EFBFBD>У<EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5>;<EFBFBD><CDBE>
* <20><>ӭ<EFBFBD><D3AD>λʹ<CEBB>ò<EFBFBD><C3B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EBB1A3><EFBFBD><EFBFBD><EFBFBD>ɿƼ<C9BF><C6BC>İ<EFBFBD>Ȩ<EFBFBD><C8A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*
* @file <09><><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
* @company <09>ɶ<EFBFBD><C9B6><EFBFBD><EFBFBD>ɿƼ<C9BF><C6BC><EFBFBD><EFBFBD>޹<EFBFBD>˾
* @author <09><><EFBFBD>ɿƼ<C9BF>(QQ3184284598)
* @version <09>鿴doc<6F><63>version<6F>ļ<EFBFBD> <20>汾˵<E6B1BE><CBB5>
* @Software ADS v1.2.2
* @Target core TC264D
* @Taobao https://seekfree.taobao.com/
* @date 2020-3-23
* @note
<09><><EFBFBD>߶<EFBFBD><DFB6>
------------------------------------
<20><><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD> <20><>Ƭ<EFBFBD><C6AC>
RX <20>鿴SEEKFREE_WIRELESS.h<>ļ<EFBFBD><C4BC>е<EFBFBD>WIRELESS_UART_TX<54><EFBFBD><EAB6A8>
TX <20>鿴SEEKFREE_WIRELESS.h<>ļ<EFBFBD><C4BC>е<EFBFBD>WIRELESS_UART_RX<52><EFBFBD><EAB6A8>
RTS <20>鿴SEEKFREE_WIRELESS.h<>ļ<EFBFBD><C4BC>е<EFBFBD>RTS_PIN<49><EFBFBD><EAB6A8>
CMD <20><><EFBFBD>ջ<EFBFBD><D5BB><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;
}