123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191 |
- #include "usr.h"
- #include "system.h"
- #include "bsp_time.h"
- #include "nrf_delay.h"
- //Add your code here...
- #include "twi_master.h"
- #include "hal_ble_client.h"
- #include "hal_ble_host.h"
- #include "hal_mt.h"
- #include "hal_battery.h"
- #include "hal_led.h"
- #include "app_overturn.h"
- #include "app_charge.h"
- #include "app_power.h"
- #include "app_client.h"
- #include "app_host.h"
- #include "app_game.h"
- #include "hal_ble_uart0.h"
- #include "app_config.h"
- #include "app_ota.h"
- #include "app_connect_manage.h"
- #include "app_organ.h"
- #include "ble_comm.h"
- #include "ble_gap.h"
- #include "exception.h"
- #include "bsp_pwm.h"
- #include "bsp_wdt.h"
- #include "bsp_adc.h"
- #include "tool.h"
- #include "app_ImuCalibration.h"
- #include "hal_wearshoes.h"
- #include "app_math.h"
- #include "app_losspack.h"
- #include "app_pair.h"
- #include "app_switchimu.h"
- #include "app_self_checking.h"
- #include "exception.h"
- #include "tool.h"
- #include "app_data_transfer.h"
- #include "hal_scan_manage.h"
- #include "app_safe.h"
- #include "bll_imu.h"
- #include "app_flash.h"
- #include "app_step.h"
- #include "hal_qma.h"
- #include "app_detectIsHost.h"
- #include "bll_single_line_half_duplex.h"
- __weak void usr1_Init(void)
- {
- slave_init(BLE_Client_Push);
- host_init(BLE_Host_Push);
- }
- void host(char byte)
- {
- static char value = 0;
-
- int ret;
-
- ret = bll_single_line_half_duplex_is_ready_to_transfer();
-
- SEGGER_RTT_printf(0,"h receive byte:%d ret:%d\n",byte,ret);
-
- if(ret == 0)
- {
- bll_single_line_half_duplex_transfer_onebyte(value);
- SEGGER_RTT_printf(0,"h value:%d\n",value);
- value++;
- }
- }
- void slave(char byte)
- {
- static char value = 0;
-
- int ret;
-
- ret = bll_single_line_half_duplex_is_ready_to_transfer();
-
- SEGGER_RTT_printf(0,"s receive byte:%d ret:%d\n",byte,ret);
-
- if(ret == 0)
- {
- SEGGER_RTT_printf(0,"bll_single_line_half_duplex_transfer_onebyte(value)%d\n",bll_single_line_half_duplex_transfer_onebyte(value));
- SEGGER_RTT_printf(0,"s value:%d\n",value);
- value++;
- }
- }
- static void test_Process(void)
- {
- static int time = 1;
-
- if(time <= 0)return;
-
- static char value = 0;
-
- int ret;
-
- ret = bll_single_line_half_duplex_is_ready_to_transfer();
-
- if(ret == 0)
- {
- SEGGER_RTT_printf(0,"bll_single_line_half_duplex_transfer_onebyte(value)%d\n",bll_single_line_half_duplex_transfer_onebyte(value));
- SEGGER_RTT_printf(0,"value:%d\n",value);
- value++;
- }
- else
- {
- SEGGER_RTT_printf(0,"ret:%d\n",ret);
- }
-
- time--;
- }
- void PRE_Init(void)
- {
- // watchdog_init();
- // feed_watchdog();
- // PWR_Init();
- // LED_Init();
- // MT_Init();
- // Flash_Initialize();
- // Exception_Init();
- usr1_Init();
-
-
-
-
-
-
- SEGGER_RTT_printf(0,"bll_single_line_half_duplex_Init(BLL_SINGLE_LINE_HALF_DUPLEX_ROLE_HOST):%d\n",bll_single_line_half_duplex_Init(BLL_SINGLE_LINE_HALF_DUPLEX_ROLE_HOST));
-
- bll_single_line_half_duplex_receive_register(host);
- Process_Start(1000,"test_Process",test_Process);
-
- // bll_single_line_half_duplex_Init(BLL_SINGLE_LINE_HALF_DUPLEX_ROLE_SLAVE);
- //
- // bll_single_line_half_duplex_receive_register(slave);
-
-
-
- }
- void USR_Init(void)
- {
- //Add your code here...
- TIME_Init();
- // bll_imu_Init();
- // ADC_Initialize();
- //
- // hal_battery_init();
- // BLE_Client_Initialize();
- // BLE_Host_Initialize();
- // hal_wearshoes_Init();
- // hal_ble_scan_Init();
- // hal_qma_Init();
- // //APP
- // app_detect_Init();
- //
- // app_client_Initialize();
- // app_host_Initialize();
- // app_overturn_Init();
- // app_charge_Init();
- // app_step_Init();
- // app_game_Init();
- // app_math_Init();
- //
- // app_ota_Init();
- // app_connect_manage_Init();
- // app_switchimu_Init();
- // app_data_transfer_Init();
- // app_safe_Init();
- //
- // #if LOSSPACK_ENANBLE
- // app_losspack_Init();
- // #endif
- //
- // #if !BleNameHoldOn_ENANBLE
- // app_pair_Init();
- // #endif
- //
- //// app_self_checking_Init();
- //
- // Tool_Init();
- }
|