/*!
 * @file        main.c
 *
 * @brief       Main program body
 *
 * @version     V2.5
 *
 * @date        2024-08-08
 *
 * @attention
 *
 *  Copyright (C) 2020-2022 Geehy Semiconductor
 *
 *  You may not use this file except in compliance with the
 *  GEEHY COPYRIGHT NOTICE (GEEHY SOFTWARE PACKAGE LICENSE).
 *
 *  The program is only for reference, which is distributed in the hope
 *  that it will be useful and instructional for customers to develop
 *  their software. Unless required by applicable law or agreed to in
 *  writing, the program is distributed on an "AS IS" BASIS, WITHOUT
 *  ANY WARRANTY OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the GEEHY SOFTWARE PACKAGE LICENSE for the governing permissions
 *  and limitations under the License.
 */
#include "include.h"
#include "gpio_input_key.h"
#include "hsuart_transfer.h"
/*!
 * @brief       Main program,BlueTooth to huart
 *  ble_rev:    gatt_callback_app()
 *  ble_send:   ble_send_packet()
 *
 *  spp_rev:    spp_rx_callback()
 *  spp_send:   bt_spp_tx()

 *  fot_data:    fot_data[]
 *  fot_flag:    fot_var.fot_recv_ok = 1;fot_var.data_pos = 0;
 *
 * @param       None
 *
 * @retval      None
 *
 */
int main(void)
{
    u8 test[]="BT test2!";

    printf("Hello GW3323 BlueTooth To Huart!\n");
    bsp_sys_init();     /*System initialization*/
    bt_init();          /*Open Bluetooth module*/
    bsp_bt_init();      /*Bluetooth system configuration*/
    ble_enter_transmit();//提升主频，如不需要可注释掉

    my_hsuart_init(1500000); //串口初始化
    gpio_input_init();      //spp流控引脚初始化


    while (1)
    {
        hsuart_transfer_example();  //串口接收到数据后，发送给蓝牙
        BtFlowControl();    //spp流控解除
        ble_read_value();   //ble流控，需上位机实现流控
        #if FOT_EN
            bsp_fot_process();
        #endif // FOT_EN
    }
    return 0;
}
