flipperzero-firmware/firmware/targets/f7/furi_hal/furi_hal_bt_serial.c
hedger 224d0aefe4
[FL-2733] multitarget support for fbt (#2209)
* First part of multitarget porting
* Delete firmware/targets/f7/Inc directory
* Delete firmware/targets/f7/Src directory
* gpio: cli fixes; about: using version from HAL
* sdk: path fixes
* gui: include fixes
* applications: more include fixes
* gpio: ported to new apis
* hal: introduced furi_hal_target_hw.h; libs: added one_wire
* hal: f18 target
* github: also build f18 by default
* typo fix
* fbt: removed extra checks on app list
* api: explicitly bundling select mlib headers with sdk
* hal: f18: changed INPUT_DEBOUNCE_TICKS to match f7
* cleaned up commented out code
* docs: added info on hw targets
* docs: targets: formatting fixes
* f18: fixed link error
* f18: fixed API version to match f7
* docs: hardware: minor wording fixes
* faploader: added fw target check
* docs: typo fixes
* github: not building komi target by default
* fbt: support for `targets` field for built-in apps
* github: reworked build flow to exclude app_set; fbt: removed komi-specific appset; added additional target buildset check
* github: fixed build; nfc: fixed pvs warnings
* attempt to fix target id
* f7, f18: removed certain HAL function from public API
* apps: debug: enabled bt_debug_app for f18
* Targets: backport input pins configuration routine from F7 to F18

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2023-02-08 01:33:05 +09:00

65 lines
1.5 KiB
C

#include <furi_hal_bt_serial.h>
#include "dev_info_service.h"
#include "battery_service.h"
#include "serial_service.h"
#include <furi.h>
void furi_hal_bt_serial_start() {
// Start device info
if(!dev_info_svc_is_started()) {
dev_info_svc_start();
}
// Start battery service
if(!battery_svc_is_started()) {
battery_svc_start();
}
// Start Serial service
if(!serial_svc_is_started()) {
serial_svc_start();
}
}
void furi_hal_bt_serial_set_event_callback(
uint16_t buff_size,
FuriHalBtSerialCallback callback,
void* context) {
serial_svc_set_callbacks(buff_size, callback, context);
}
void furi_hal_bt_serial_notify_buffer_is_empty() {
serial_svc_notify_buffer_is_empty();
}
void furi_hal_bt_serial_set_rpc_status(FuriHalBtSerialRpcStatus status) {
SerialServiceRpcStatus st;
if(status == FuriHalBtSerialRpcStatusActive) {
st = SerialServiceRpcStatusActive;
} else {
st = SerialServiceRpcStatusNotActive;
}
serial_svc_set_rpc_status(st);
}
bool furi_hal_bt_serial_tx(uint8_t* data, uint16_t size) {
if(size > FURI_HAL_BT_SERIAL_PACKET_SIZE_MAX) {
return false;
}
return serial_svc_update_tx(data, size);
}
void furi_hal_bt_serial_stop() {
// Stop all services
if(dev_info_svc_is_started()) {
dev_info_svc_stop();
}
// Start battery service
if(battery_svc_is_started()) {
battery_svc_stop();
}
// Start Serial service
if(serial_svc_is_started()) {
serial_svc_stop();
}
}