1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/openLuat-luatos-soc-air101

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Клонировать/Скачать
luat_nimble_air101.c 2 КБ
Копировать Редактировать Исходные данные Просмотреть построчно История
Wendal Chen Отправлено 2 лет назад 0f3a789
#include "luat_base.h"
#include "luat_msgbus.h"
#include "luat_nimble.h"
#include "wm_bt_config.h"
#include "wm_regs.h"
#include "wm_bt.h"
#include "wm_bt_util.h"
#include "host/ble_hs.h"
#include "host/util/util.h"
#include "nimble/nimble_port.h"
#include "transport/uart/ble_hci_uart.h"
#include "nimble/tls_nimble.h"
#include "wm_ble_gap.h"
#include "wm_ble_uart_if.h"
#include "syscfg/syscfg.h"
#define LUAT_LOG_TAG "nimble"
#include "luat_log.h"
int luat_nimble_deinit() {
LLOGE("deinit not support yet");
return -1;
}
int luat_nimble_trace_level(int level) {
return 0;
}
int luat_nimble_init_peripheral(uint8_t uart_idx, char* name, int mode);
int luat_nimble_init_central(uint8_t uart_idx, char* name, int mode);
int luat_nimble_init_ibeacon(uint8_t uart_idx, char* name, int mode);
int luat_nimble_init(uint8_t uart_idx, char* name, int mode) {
int ret = 0;
tls_reg_write32(HR_CLK_BBP_CLT_CTRL, 0x7F);
ble_hs_cfg.sm_io_cap = MYNEWT_VAL(BLE_SM_IO_CAP),
ble_hs_cfg.sm_oob_data_flag = MYNEWT_VAL(BLE_SM_OOB_DATA_FLAG),
ble_hs_cfg.sm_bonding = MYNEWT_VAL(BLE_SM_BONDING),
ble_hs_cfg.sm_mitm = MYNEWT_VAL(BLE_SM_MITM),
ble_hs_cfg.sm_sc = MYNEWT_VAL(BLE_SM_SC),
ble_hs_cfg.sm_keypress = MYNEWT_VAL(BLE_SM_KEYPRESS),
ble_hs_cfg.sm_our_key_dist = MYNEWT_VAL(BLE_SM_OUR_KEY_DIST),
ble_hs_cfg.sm_their_key_dist = MYNEWT_VAL(BLE_SM_THEIR_KEY_DIST);
if (mode == 0) {
LLOGD("CALL luat_nimble_init_peripheral");
ret = luat_nimble_init_peripheral(uart_idx, name, mode);
}
else if (mode == 1) {
LLOGD("CALL luat_nimble_init_central");
ret = luat_nimble_init_central(uart_idx, name, mode);
}
else if (mode == 2) {
ret = luat_nimble_init_ibeacon(uart_idx, name, mode);
}
else {
return -1;
}
if (ret == 0) {
/*Initialize the vuart interface and enable controller*/
ble_hci_vuart_init(0xFF);
/* As the last thing, process events from default event queue. */
tls_nimble_start();
}
return 0;
}

Опубликовать ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://gitlife.ru/oschina-mirror/openLuat-luatos-soc-air101.git
git@gitlife.ru:oschina-mirror/openLuat-luatos-soc-air101.git
oschina-mirror
openLuat-luatos-soc-air101
openLuat-luatos-soc-air101
v1022.air601