[FL-580] Prepare BLE for certification (#376)

* api-hal-bt: separate bt init to core init and app start

* bt: add continuous TX and RX tests

* bt: finish rx test on Back button click

* api-hal-bt: check core 2 started, same f4 and f5 implementation

* bt: refactoring, move hopping test logic to main thread

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
gornekich
2021-03-11 12:31:07 +03:00
committed by GitHub
parent b920248693
commit 0af6c9882e
13 changed files with 601 additions and 9 deletions

View File

@@ -4,6 +4,7 @@
#include <stm32wbxx.h>
#include <shci.h>
#include <cmsis_os2.h>
#include <app_ble.h>
void api_hal_bt_init() {
// Explicitly tell that we are in charge of CLK48 domain
@@ -12,6 +13,10 @@ void api_hal_bt_init() {
APPE_Init();
}
bool api_hal_bt_start_app() {
return APP_BLE_Start();
}
void api_hal_bt_dump_state(string_t buffer) {
BleGlueStatus status = APPE_Status();
if (status == BleGlueStatusStarted) {
@@ -76,3 +81,29 @@ void api_hal_bt_unlock_flash() {
HAL_HSEM_Release(CFG_HW_FLASH_SEMID, HSEM_CPU1_COREID);
}
}
void api_hal_bt_start_tone_tx(uint8_t tx_channel, uint8_t power) {
aci_hal_set_tx_power_level(0, power);
aci_hal_tone_start(tx_channel, 0);
}
void api_hal_bt_stop_tone_tx() {
aci_hal_tone_stop();
}
void api_hal_bt_start_packet_tx(uint8_t frequency, uint8_t datarate) {
hci_le_enhanced_transmitter_test(frequency, 0x25, 2, datarate);
}
void api_hal_bt_stop_packet_tx() {
uint16_t num_of_packets;
hci_le_test_end(&num_of_packets);
}
void api_hal_bt_start_rx(uint8_t frequency) {
aci_hal_rx_start(frequency);
}
void api_hal_bt_stop_rx() {
aci_hal_rx_stop();
}