Rename api-hal to furi-hal (#629)
This commit is contained in:
parent
7907cb232b
commit
0a97d6913c
64
ReadMe.md
64
ReadMe.md
@ -66,3 +66,67 @@ One liner: `./flash_core1_main.sh`
|
||||
* Project website: [flipperzero.one](https://flipperzero.one)
|
||||
* Kickstarter page: [kickstarter.com](https://www.kickstarter.com/projects/flipper-devices/flipper-zero-tamagochi-for-hackers)
|
||||
* Forum: [forum.flipperzero.one](https://forum.flipperzero.one/)
|
||||
|
||||
# Folders structure
|
||||
|
||||
- applications - application and services
|
||||
* accessor - Wiegand server
|
||||
* archive - Archive and file manager
|
||||
* bt - BLE service and application
|
||||
* cli - Console service
|
||||
* debug_tools - different tools that we use on factory and for debug
|
||||
* dialogs - service for showing GUI dialogs
|
||||
* dolphin - dolphin service and supplientary apps
|
||||
* gpio-tester - GPIO control application
|
||||
* gui - GUI service
|
||||
* ibutton - ibutton application, onewire keys and more
|
||||
* input - input service
|
||||
* irda - irda application, controls your IR devices
|
||||
* irda_monitor - irda debug tool
|
||||
* lfrfid - LF RFID application
|
||||
* lfrfid-debug - LF RFID debug tool
|
||||
* loader - application loader service
|
||||
* menu - main menu service
|
||||
* music-player - music player app (demo)
|
||||
* nfc - NFC application, HF rfid, EMV and etc
|
||||
* notification - notification service
|
||||
* power - power service
|
||||
* power-observer - power debug tool
|
||||
* scened-app-example - c++ application example
|
||||
* storage - storage service, internal + sdcard
|
||||
* storage-settings - storage settings app
|
||||
* subghz - subghz application, 433 fobs and etc
|
||||
* tests - unit tests and etc
|
||||
- assets - assets used by applications and services
|
||||
* compiled - compilation results
|
||||
* icons - source icons images
|
||||
- bootloader - bootloader for flipper
|
||||
* src - bootloader sources
|
||||
* targets - targets' hal and implementation
|
||||
- core - core libraries: home for furi
|
||||
- debug - debug helpers, plugins and tools
|
||||
- docker - docker image sources (used for automated firmware build)
|
||||
- firmware - firmware for flipper
|
||||
* targets - targets' hal and implementation
|
||||
- lib - different libraries and drivers that apps and firmware uses
|
||||
* ST25RFAL002 - ST253916 driver and NFC hal
|
||||
* STM32CubeWB - STM32WB hal
|
||||
* app-scened-template - scened template app library
|
||||
* app-template - template app library
|
||||
* callback-connector - callback connector library
|
||||
* common-api - common api delaration library
|
||||
* cyfral - cyfral library
|
||||
* drivers - drivers that we wrote
|
||||
* fatfs - external storage file system
|
||||
* fnv1a-hash - fnv1a hash library
|
||||
* irda - irda library
|
||||
* littlefs - internal storage file system
|
||||
* mlib - algorithms and containers
|
||||
* nfc_protocols - nfc protocols library
|
||||
* onewire - one wire library
|
||||
* qrcode - qr code generator library
|
||||
* subghz - subghz library
|
||||
* toolbox - toolbox of things that we are using but don't place in core
|
||||
* u8g2 - graphics library that we use to draw GUI
|
||||
- make - make helpers
|
||||
- scripts - supplimentary scripts
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "accessor-app.h"
|
||||
#include <furi.h>
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
void AccessorApp::run(void) {
|
||||
@ -33,16 +33,16 @@ void AccessorApp::run(void) {
|
||||
|
||||
AccessorApp::AccessorApp()
|
||||
: onewire_master{&ibutton_gpio} {
|
||||
api_hal_power_insomnia_enter();
|
||||
furi_hal_power_insomnia_enter();
|
||||
notification = static_cast<NotificationApp*>(furi_record_open("notification"));
|
||||
notify_init();
|
||||
api_hal_power_enable_otg();
|
||||
furi_hal_power_enable_otg();
|
||||
}
|
||||
|
||||
AccessorApp::~AccessorApp() {
|
||||
api_hal_power_disable_otg();
|
||||
furi_hal_power_disable_otg();
|
||||
furi_record_close("notification");
|
||||
api_hal_power_insomnia_exit();
|
||||
furi_hal_power_insomnia_exit();
|
||||
}
|
||||
|
||||
AccessorAppViewManager* AccessorApp::get_view_manager() {
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "wiegand.h"
|
||||
#include <furi.h>
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal.h>
|
||||
|
||||
volatile unsigned long WIEGAND::_cardTempHigh = 0;
|
||||
volatile unsigned long WIEGAND::_cardTemp = 0;
|
||||
|
@ -153,24 +153,24 @@ int32_t bt_srv() {
|
||||
|
||||
furi_record_create("bt", bt);
|
||||
|
||||
api_hal_bt_init();
|
||||
furi_hal_bt_init();
|
||||
BtMessage message;
|
||||
while(1) {
|
||||
furi_check(osMessageQueueGet(bt->message_queue, &message, NULL, osWaitForever) == osOK);
|
||||
if(message.type == BtMessageTypeStartTestCarrier) {
|
||||
// Start carrier test
|
||||
api_hal_bt_stop_tone_tx();
|
||||
furi_hal_bt_stop_tone_tx();
|
||||
if(bt->state.type == BtStateCarrierTx) {
|
||||
api_hal_bt_start_tone_tx(message.param.channel, message.param.power);
|
||||
furi_hal_bt_start_tone_tx(message.param.channel, message.param.power);
|
||||
} else if(bt->state.type == BtStateHoppingTx) {
|
||||
bt->state.param.channel =
|
||||
bt_switch_channel(InputKeyRight, bt->state.param.channel);
|
||||
api_hal_bt_start_tone_tx(bt->state.param.channel, bt->state.param.power);
|
||||
furi_hal_bt_start_tone_tx(bt->state.param.channel, bt->state.param.power);
|
||||
} else if(bt->state.type == BtStateCarrierRxStart) {
|
||||
api_hal_bt_start_packet_rx(bt->state.param.channel, bt->state.param.datarate);
|
||||
furi_hal_bt_start_packet_rx(bt->state.param.channel, bt->state.param.datarate);
|
||||
bt->state.type = BtStateCarrierRxRunning;
|
||||
} else if(bt->state.type == BtStateCarrierRxRunning) {
|
||||
bt->state.param.rssi = api_hal_bt_get_rssi();
|
||||
bt->state.param.rssi = furi_hal_bt_get_rssi();
|
||||
}
|
||||
with_view_model(
|
||||
bt->view_test_carrier, (BtViewTestCarrierModel * model) {
|
||||
@ -183,14 +183,14 @@ int32_t bt_srv() {
|
||||
view_dispatcher_switch_to_view(bt->view_dispatcher, BtViewTestCarrier);
|
||||
} else if(message.type == BtMessageTypeStopTestCarrier) {
|
||||
if(bt->state.type == BtStateCarrierRxRunning) {
|
||||
api_hal_bt_stop_packet_test();
|
||||
furi_hal_bt_stop_packet_test();
|
||||
} else {
|
||||
api_hal_bt_stop_tone_tx();
|
||||
furi_hal_bt_stop_tone_tx();
|
||||
}
|
||||
bt->state.type = BtStateReady;
|
||||
} else if(message.type == BtMessageTypeSetupTestPacketTx) {
|
||||
// Update packet test setup
|
||||
api_hal_bt_stop_packet_test();
|
||||
furi_hal_bt_stop_packet_test();
|
||||
with_view_model(
|
||||
bt->view_test_packet_tx, (BtViewTestPacketTxModel * model) {
|
||||
model->type = bt->state.type;
|
||||
@ -202,10 +202,10 @@ int32_t bt_srv() {
|
||||
} else if(message.type == BtMessageTypeStartTestPacketTx) {
|
||||
// Start sending packets
|
||||
if(bt->state.type == BtStatePacketStart) {
|
||||
api_hal_bt_start_packet_tx(message.param.channel, 1, message.param.datarate);
|
||||
furi_hal_bt_start_packet_tx(message.param.channel, 1, message.param.datarate);
|
||||
} else if(bt->state.type == BtStatePacketSetup) {
|
||||
api_hal_bt_stop_packet_test();
|
||||
bt->state.param.packets_sent = api_hal_bt_get_transmitted_packets();
|
||||
furi_hal_bt_stop_packet_test();
|
||||
bt->state.param.packets_sent = furi_hal_bt_get_transmitted_packets();
|
||||
}
|
||||
with_view_model(
|
||||
bt->view_test_packet_tx, (BtViewTestPacketTxModel * model) {
|
||||
@ -218,7 +218,7 @@ int32_t bt_srv() {
|
||||
view_dispatcher_switch_to_view(bt->view_dispatcher, BtViewTestPacketTx);
|
||||
} else if(message.type == BtMessageTypeSetupTestPacketRx) {
|
||||
// Update packet test setup
|
||||
api_hal_bt_stop_packet_test();
|
||||
furi_hal_bt_stop_packet_test();
|
||||
with_view_model(
|
||||
bt->view_test_packet_rx, (BtViewTestPacketRxModel * model) {
|
||||
model->type = bt->state.type;
|
||||
@ -230,12 +230,12 @@ int32_t bt_srv() {
|
||||
} else if(message.type == BtMessageTypeStartTestPacketRx) {
|
||||
// Start test rx
|
||||
if(bt->state.type == BtStatePacketStart) {
|
||||
api_hal_bt_start_packet_rx(message.param.channel, message.param.datarate);
|
||||
furi_hal_bt_start_packet_rx(message.param.channel, message.param.datarate);
|
||||
bt->state.type = BtStatePacketRunning;
|
||||
} else if(bt->state.type == BtStatePacketRunning) {
|
||||
bt->state.param.rssi = api_hal_bt_get_rssi();
|
||||
bt->state.param.rssi = furi_hal_bt_get_rssi();
|
||||
} else if(bt->state.type == BtStatePacketSetup) {
|
||||
bt->state.param.packets_received = api_hal_bt_stop_packet_test();
|
||||
bt->state.param.packets_received = furi_hal_bt_stop_packet_test();
|
||||
}
|
||||
with_view_model(
|
||||
bt->view_test_packet_rx, (BtViewTestPacketRxModel * model) {
|
||||
@ -249,17 +249,17 @@ int32_t bt_srv() {
|
||||
view_dispatcher_switch_to_view(bt->view_dispatcher, BtViewTestPacketRx);
|
||||
} else if(message.type == BtMessageTypeStopTestPacket) {
|
||||
// Stop test packet tx
|
||||
api_hal_bt_stop_packet_test();
|
||||
furi_hal_bt_stop_packet_test();
|
||||
bt->state.type = BtStateReady;
|
||||
} else if(message.type == BtMessageTypeStartApp) {
|
||||
// Start app
|
||||
view_dispatcher_switch_to_view(bt->view_dispatcher, BtViewStartApp);
|
||||
if(api_hal_bt_start_app()) {
|
||||
if(furi_hal_bt_start_app()) {
|
||||
bt->state.type = BtStateStartedApp;
|
||||
}
|
||||
} else if(message.type == BtMessageTypeUpdateStatusbar) {
|
||||
// Update statusbar
|
||||
view_port_enabled_set(bt->statusbar_view_port, api_hal_bt_is_alive());
|
||||
view_port_enabled_set(bt->statusbar_view_port, furi_hal_bt_is_alive());
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "bt_cli.h"
|
||||
#include <furi.h>
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal.h>
|
||||
|
||||
void bt_cli_init() {
|
||||
Cli* cli = furi_record_open("cli");
|
||||
@ -17,7 +17,7 @@ void bt_cli_init() {
|
||||
void bt_cli_command_info(Cli* cli, string_t args, void* context) {
|
||||
string_t buffer;
|
||||
string_init(buffer);
|
||||
api_hal_bt_dump_state(buffer);
|
||||
furi_hal_bt_dump_state(buffer);
|
||||
printf(string_get_cstr(buffer));
|
||||
string_clear(buffer);
|
||||
}
|
||||
@ -41,12 +41,12 @@ void bt_cli_command_carrier_tx(Cli* cli, string_t args, void* context) {
|
||||
}
|
||||
printf("Transmitting carrier at %hu channel at %hu dB power\r\n", channel, power);
|
||||
printf("Press CTRL+C to stop\r\n");
|
||||
api_hal_bt_start_tone_tx(channel, 0x19 + power);
|
||||
furi_hal_bt_start_tone_tx(channel, 0x19 + power);
|
||||
|
||||
while(!cli_cmd_interrupt_received(cli)) {
|
||||
osDelay(250);
|
||||
}
|
||||
api_hal_bt_stop_tone_tx();
|
||||
furi_hal_bt_stop_tone_tx();
|
||||
}
|
||||
|
||||
void bt_cli_command_carrier_rx(Cli* cli, string_t args, void* context) {
|
||||
@ -64,15 +64,15 @@ void bt_cli_command_carrier_rx(Cli* cli, string_t args, void* context) {
|
||||
printf("Receiving carrier at %hu channel\r\n", channel);
|
||||
printf("Press CTRL+C to stop\r\n");
|
||||
|
||||
api_hal_bt_start_packet_rx(channel, 1);
|
||||
furi_hal_bt_start_packet_rx(channel, 1);
|
||||
|
||||
while(!cli_cmd_interrupt_received(cli)) {
|
||||
osDelay(1024 / 4);
|
||||
printf("RSSI: %6.1f dB\r", api_hal_bt_get_rssi());
|
||||
printf("RSSI: %6.1f dB\r", furi_hal_bt_get_rssi());
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
api_hal_bt_stop_packet_test();
|
||||
furi_hal_bt_stop_packet_test();
|
||||
}
|
||||
|
||||
void bt_cli_command_packet_tx(Cli* cli, string_t args, void* context) {
|
||||
@ -111,13 +111,13 @@ void bt_cli_command_packet_tx(Cli* cli, string_t args, void* context) {
|
||||
channel,
|
||||
datarate);
|
||||
printf("Press CTRL+C to stop\r\n");
|
||||
api_hal_bt_start_packet_tx(channel, pattern, datarate);
|
||||
furi_hal_bt_start_packet_tx(channel, pattern, datarate);
|
||||
|
||||
while(!cli_cmd_interrupt_received(cli)) {
|
||||
osDelay(250);
|
||||
}
|
||||
api_hal_bt_stop_packet_test();
|
||||
printf("Transmitted %lu packets", api_hal_bt_get_transmitted_packets());
|
||||
furi_hal_bt_stop_packet_test();
|
||||
printf("Transmitted %lu packets", furi_hal_bt_get_transmitted_packets());
|
||||
}
|
||||
|
||||
void bt_cli_command_packet_rx(Cli* cli, string_t args, void* context) {
|
||||
@ -139,15 +139,15 @@ void bt_cli_command_packet_rx(Cli* cli, string_t args, void* context) {
|
||||
}
|
||||
printf("Receiving packets at %hu channel at %hu M datarate\r\n", channel, datarate);
|
||||
printf("Press CTRL+C to stop\r\n");
|
||||
api_hal_bt_start_packet_rx(channel, datarate);
|
||||
furi_hal_bt_start_packet_rx(channel, datarate);
|
||||
|
||||
float rssi_raw = 0;
|
||||
while(!cli_cmd_interrupt_received(cli)) {
|
||||
osDelay(250);
|
||||
rssi_raw = api_hal_bt_get_rssi();
|
||||
rssi_raw = furi_hal_bt_get_rssi();
|
||||
printf("RSSI: %03.1f dB\r", rssi_raw);
|
||||
fflush(stdout);
|
||||
}
|
||||
uint16_t packets_received = api_hal_bt_stop_packet_test();
|
||||
uint16_t packets_received = furi_hal_bt_stop_packet_test();
|
||||
printf("Received %hu packets", packets_received);
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "bt_types.h"
|
||||
|
||||
#include <furi.h>
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal.h>
|
||||
|
||||
#include <cli/cli.h>
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "cli_i.h"
|
||||
#include "cli_commands.h"
|
||||
|
||||
#include <api-hal-version.h>
|
||||
#include <furi-hal-version.h>
|
||||
#include <loader/loader.h>
|
||||
|
||||
Cli* cli_alloc() {
|
||||
@ -30,33 +30,33 @@ void cli_free(Cli* cli) {
|
||||
}
|
||||
|
||||
void cli_putc(char c) {
|
||||
api_hal_vcp_tx((uint8_t*)&c, 1);
|
||||
furi_hal_vcp_tx((uint8_t*)&c, 1);
|
||||
}
|
||||
|
||||
char cli_getc(Cli* cli) {
|
||||
furi_assert(cli);
|
||||
char c;
|
||||
if(api_hal_vcp_rx((uint8_t*)&c, 1) == 0) {
|
||||
if(furi_hal_vcp_rx((uint8_t*)&c, 1) == 0) {
|
||||
cli_reset(cli);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
void cli_stdout_callback(void* _cookie, const char* data, size_t size) {
|
||||
api_hal_vcp_tx((const uint8_t*)data, size);
|
||||
furi_hal_vcp_tx((const uint8_t*)data, size);
|
||||
}
|
||||
|
||||
void cli_write(Cli* cli, uint8_t* buffer, size_t size) {
|
||||
return api_hal_vcp_tx(buffer, size);
|
||||
return furi_hal_vcp_tx(buffer, size);
|
||||
}
|
||||
|
||||
size_t cli_read(Cli* cli, uint8_t* buffer, size_t size) {
|
||||
return api_hal_vcp_rx(buffer, size);
|
||||
return furi_hal_vcp_rx(buffer, size);
|
||||
}
|
||||
|
||||
bool cli_cmd_interrupt_received(Cli* cli) {
|
||||
char c = '\0';
|
||||
if(api_hal_vcp_rx_with_timeout((uint8_t*)&c, 1, 0) == 1) {
|
||||
if(furi_hal_vcp_rx_with_timeout((uint8_t*)&c, 1, 0) == 1) {
|
||||
return c == CliSymbolAsciiETX;
|
||||
} else {
|
||||
return false;
|
||||
@ -92,7 +92,7 @@ void cli_motd() {
|
||||
"Read Manual https://docs.flipperzero.one\r\n"
|
||||
"\r\n");
|
||||
|
||||
const Version* firmware_version = api_hal_version_get_firmware_version();
|
||||
const Version* firmware_version = furi_hal_version_get_firmware_version();
|
||||
if(firmware_version) {
|
||||
printf(
|
||||
"Firmware version: %s %s (%s built on %s)\r\n",
|
||||
@ -143,7 +143,7 @@ static void cli_normalize_line(Cli* cli) {
|
||||
|
||||
static void cli_execute_command(Cli* cli, CliCommand* command, string_t args) {
|
||||
if(!(command->flags & CliCommandFlagInsomniaSafe)) {
|
||||
api_hal_power_insomnia_enter();
|
||||
furi_hal_power_insomnia_enter();
|
||||
}
|
||||
|
||||
// Ensure that we running alone
|
||||
@ -164,7 +164,7 @@ static void cli_execute_command(Cli* cli, CliCommand* command, string_t args) {
|
||||
}
|
||||
|
||||
if(!(command->flags & CliCommandFlagInsomniaSafe)) {
|
||||
api_hal_power_insomnia_exit();
|
||||
furi_hal_power_insomnia_exit();
|
||||
}
|
||||
}
|
||||
|
||||
@ -305,9 +305,9 @@ void cli_process_input(Cli* cli) {
|
||||
} else if(c == CliSymbolAsciiEOT) {
|
||||
cli_reset(cli);
|
||||
} else if(c == CliSymbolAsciiEsc) {
|
||||
r = api_hal_vcp_rx((uint8_t*)&c, 1);
|
||||
r = furi_hal_vcp_rx((uint8_t*)&c, 1);
|
||||
if(r && c == '[') {
|
||||
api_hal_vcp_rx((uint8_t*)&c, 1);
|
||||
furi_hal_vcp_rx((uint8_t*)&c, 1);
|
||||
cli_handle_escape(cli, c);
|
||||
} else {
|
||||
cli_putc(CliSymbolAsciiBell);
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "cli_commands.h"
|
||||
#include <api-hal.h>
|
||||
#include <api-hal-gpio.h>
|
||||
#include <furi-hal.h>
|
||||
#include <furi-hal-gpio.h>
|
||||
#include <rtc.h>
|
||||
#include <task-control-block.h>
|
||||
#include <time.h>
|
||||
@ -14,33 +14,33 @@
|
||||
*/
|
||||
void cli_command_device_info(Cli* cli, string_t args, void* context) {
|
||||
// Model name
|
||||
printf("hardware_model : %s\r\n", api_hal_version_get_model_name());
|
||||
const char* name = api_hal_version_get_name_ptr();
|
||||
printf("hardware_model : %s\r\n", furi_hal_version_get_model_name());
|
||||
const char* name = furi_hal_version_get_name_ptr();
|
||||
if(name) {
|
||||
printf("hardware_name : %s\r\n", name);
|
||||
}
|
||||
|
||||
// Unique ID
|
||||
printf("hardware_uid : ");
|
||||
const uint8_t* uid = api_hal_version_uid();
|
||||
for(size_t i = 0; i < api_hal_version_uid_size(); i++) {
|
||||
const uint8_t* uid = furi_hal_version_uid();
|
||||
for(size_t i = 0; i < furi_hal_version_uid_size(); i++) {
|
||||
printf("%02X", uid[i]);
|
||||
}
|
||||
printf("\r\n");
|
||||
|
||||
// Board Revision
|
||||
printf("hardware_ver : %d\r\n", api_hal_version_get_hw_version());
|
||||
printf("hardware_target : %d\r\n", api_hal_version_get_hw_target());
|
||||
printf("hardware_body : %d\r\n", api_hal_version_get_hw_body());
|
||||
printf("hardware_connect : %d\r\n", api_hal_version_get_hw_connect());
|
||||
printf("hardware_timestamp : %lu\r\n", api_hal_version_get_hw_timestamp());
|
||||
printf("hardware_ver : %d\r\n", furi_hal_version_get_hw_version());
|
||||
printf("hardware_target : %d\r\n", furi_hal_version_get_hw_target());
|
||||
printf("hardware_body : %d\r\n", furi_hal_version_get_hw_body());
|
||||
printf("hardware_connect : %d\r\n", furi_hal_version_get_hw_connect());
|
||||
printf("hardware_timestamp : %lu\r\n", furi_hal_version_get_hw_timestamp());
|
||||
|
||||
// Color and Region
|
||||
printf("hardware_color : %d\r\n", api_hal_version_get_hw_color());
|
||||
printf("hardware_region : %d\r\n", api_hal_version_get_hw_region());
|
||||
printf("hardware_color : %d\r\n", furi_hal_version_get_hw_color());
|
||||
printf("hardware_region : %d\r\n", furi_hal_version_get_hw_region());
|
||||
|
||||
// Bootloader Version
|
||||
const Version* boot_version = api_hal_version_get_boot_version();
|
||||
const Version* boot_version = furi_hal_version_get_boot_version();
|
||||
if(boot_version) {
|
||||
printf("boot_version : %s\r\n", version_get_version(boot_version));
|
||||
printf("boot_commit : %s\r\n", version_get_githash(boot_version));
|
||||
@ -49,7 +49,7 @@ void cli_command_device_info(Cli* cli, string_t args, void* context) {
|
||||
}
|
||||
|
||||
// Firmware version
|
||||
const Version* firmware_version = api_hal_version_get_firmware_version();
|
||||
const Version* firmware_version = furi_hal_version_get_firmware_version();
|
||||
if(firmware_version) {
|
||||
printf("firmware_version : %s\r\n", version_get_version(firmware_version));
|
||||
printf("firmware_commit : %s\r\n", version_get_githash(firmware_version));
|
||||
@ -58,7 +58,7 @@ void cli_command_device_info(Cli* cli, string_t args, void* context) {
|
||||
}
|
||||
|
||||
WirelessFwInfo_t pWirelessInfo;
|
||||
if(api_hal_bt_is_alive() && SHCI_GetWirelessFwInfo(&pWirelessInfo) == SHCI_Success) {
|
||||
if(furi_hal_bt_is_alive() && SHCI_GetWirelessFwInfo(&pWirelessInfo) == SHCI_Success) {
|
||||
printf("radio_alive : true\r\n");
|
||||
// FUS Info
|
||||
printf("radio_fus_major : %d\r\n", pWirelessInfo.FusVersionMajor);
|
||||
@ -80,7 +80,7 @@ void cli_command_device_info(Cli* cli, string_t args, void* context) {
|
||||
printf("radio_stack_flash : %dK\r\n", pWirelessInfo.MemorySizeFlash * 4);
|
||||
// Mac address
|
||||
printf("radio_ble_mac : ");
|
||||
const uint8_t* ble_mac = api_hal_version_get_ble_mac();
|
||||
const uint8_t* ble_mac = furi_hal_version_get_ble_mac();
|
||||
for(size_t i = 0; i < 6; i++) {
|
||||
printf("%02X", ble_mac[i]);
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include "cli.h"
|
||||
|
||||
#include <furi.h>
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal.h>
|
||||
|
||||
#include <m-dict.h>
|
||||
#include <m-bptree.h>
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include <furi.h>
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal.h>
|
||||
|
||||
#include <gui/gui.h>
|
||||
#include <input/input.h>
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include <furi.h>
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal.h>
|
||||
|
||||
#include <gui/gui.h>
|
||||
#include <input/input.h>
|
||||
|
@ -411,7 +411,7 @@ int32_t dolphin_srv() {
|
||||
|
||||
furi_record_create("dolphin", dolphin);
|
||||
|
||||
if(!api_hal_version_do_i_belong_here()) {
|
||||
if(!furi_hal_version_do_i_belong_here()) {
|
||||
view_dispatcher_switch_to_view(dolphin->idle_view_dispatcher, DolphinViewHwMismatch);
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "dolphin_views.h"
|
||||
|
||||
#include <furi.h>
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal.h>
|
||||
#include <gui/gui.h>
|
||||
#include <gui/view_dispatcher.h>
|
||||
#include <gui/canvas.h>
|
||||
|
@ -2,8 +2,8 @@
|
||||
#include <gui/view.h>
|
||||
#include <gui/gui.h>
|
||||
#include <gui/elements.h>
|
||||
#include <api-hal.h>
|
||||
#include <api-hal-version.h>
|
||||
#include <furi-hal.h>
|
||||
#include <furi-hal-version.h>
|
||||
|
||||
static char* Lockmenu_Items[3] = {"Lock", "Set PIN", "DUMB mode"};
|
||||
|
||||
@ -14,7 +14,7 @@ void dolphin_view_first_start_draw(Canvas* canvas, void* model) {
|
||||
canvas_set_font(canvas, FontSecondary);
|
||||
uint8_t width = canvas_width(canvas);
|
||||
uint8_t height = canvas_height(canvas);
|
||||
const char* my_name = api_hal_version_get_name_ptr();
|
||||
const char* my_name = furi_hal_version_get_name_ptr();
|
||||
if(m->page == 0) {
|
||||
canvas_draw_icon(canvas, 0, height - 48, &I_DolphinFirstStart0_70x53);
|
||||
elements_multiline_text_framed(canvas, 75, 20, "Hey m8,\npress > to\ncontinue");
|
||||
@ -119,20 +119,20 @@ void dolphin_view_idle_down_draw(Canvas* canvas, void* model) {
|
||||
|
||||
if(m->screen != DolphinViewStatsMeta) {
|
||||
// Hardware version
|
||||
const char* my_name = api_hal_version_get_name_ptr();
|
||||
const char* my_name = furi_hal_version_get_name_ptr();
|
||||
snprintf(
|
||||
buffer,
|
||||
sizeof(buffer),
|
||||
"HW: %d.F%dB%dC%d %s",
|
||||
api_hal_version_get_hw_version(),
|
||||
api_hal_version_get_hw_target(),
|
||||
api_hal_version_get_hw_body(),
|
||||
api_hal_version_get_hw_connect(),
|
||||
furi_hal_version_get_hw_version(),
|
||||
furi_hal_version_get_hw_target(),
|
||||
furi_hal_version_get_hw_body(),
|
||||
furi_hal_version_get_hw_connect(),
|
||||
my_name ? my_name : "Unknown");
|
||||
canvas_draw_str(canvas, 5, 23, buffer);
|
||||
|
||||
ver = m->screen == DolphinViewStatsBoot ? api_hal_version_get_boot_version() :
|
||||
api_hal_version_get_firmware_version();
|
||||
ver = m->screen == DolphinViewStatsBoot ? furi_hal_version_get_boot_version() :
|
||||
furi_hal_version_get_firmware_version();
|
||||
|
||||
if(!ver) {
|
||||
canvas_draw_str(canvas, 5, 33, "No info");
|
||||
@ -178,7 +178,7 @@ void dolphin_view_hw_mismatch_draw(Canvas* canvas, void* model) {
|
||||
|
||||
char buffer[64];
|
||||
canvas_set_font(canvas, FontSecondary);
|
||||
snprintf(buffer, 64, "HW target: F%d", api_hal_version_get_hw_target());
|
||||
snprintf(buffer, 64, "HW target: F%d", furi_hal_version_get_hw_target());
|
||||
canvas_draw_str(canvas, 5, 27, buffer);
|
||||
canvas_draw_str(canvas, 5, 38, "FW target: " TARGET);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include <furi.h>
|
||||
#include <gui/gui.h>
|
||||
#include <api-hal-version.h>
|
||||
#include <furi-hal-version.h>
|
||||
#include "dolphin/dolphin.h"
|
||||
#include "dolphin/dolphin_state.h"
|
||||
#include "math.h"
|
||||
@ -80,7 +80,7 @@ static void render_callback(Canvas* canvas, void* ctx) {
|
||||
canvas_draw_line(canvas, 59, 31, 124, 31);
|
||||
canvas_draw_line(canvas, 59, 44, 124, 44);
|
||||
|
||||
const char* my_name = api_hal_version_get_name_ptr();
|
||||
const char* my_name = furi_hal_version_get_name_ptr();
|
||||
canvas_draw_str(canvas, 59, 15, my_name ? my_name : "Unknown");
|
||||
|
||||
snprintf(level, 20, "Level: %ld", current_level);
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include <furi.h>
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal.h>
|
||||
#include "scene.h"
|
||||
|
||||
static SceneAppGui* scene_app_gui = NULL;
|
||||
@ -109,7 +109,7 @@ void scene_free() {
|
||||
}
|
||||
|
||||
int32_t scene_app(void* p) {
|
||||
api_hal_power_insomnia_enter();
|
||||
furi_hal_power_insomnia_enter();
|
||||
scene_alloc();
|
||||
|
||||
osTimerStart(scene_app_gui->timer, 40);
|
||||
@ -146,6 +146,6 @@ int32_t scene_app(void* p) {
|
||||
osDelay(15);
|
||||
|
||||
scene_free();
|
||||
api_hal_power_insomnia_exit();
|
||||
furi_hal_power_insomnia_exit();
|
||||
return 0;
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
#include <furi.h>
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal.h>
|
||||
|
||||
#include <gui/gui.h>
|
||||
#include <input/input.h>
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include "icon_animation_i.h"
|
||||
|
||||
#include <furi.h>
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal.h>
|
||||
|
||||
uint8_t u8g2_gpio_and_delay_stm32(u8x8_t* u8x8, uint8_t msg, uint8_t arg_int, void* arg_ptr);
|
||||
uint8_t u8x8_hw_spi_stm32(u8x8_t* u8x8, uint8_t msg, uint8_t arg_int, void* arg_ptr);
|
||||
@ -11,7 +11,7 @@ uint8_t u8x8_hw_spi_stm32(u8x8_t* u8x8, uint8_t msg, uint8_t arg_int, void* arg_
|
||||
Canvas* canvas_init() {
|
||||
Canvas* canvas = furi_alloc(sizeof(Canvas));
|
||||
|
||||
api_hal_power_insomnia_enter();
|
||||
furi_hal_power_insomnia_enter();
|
||||
|
||||
canvas->orientation = CanvasOrientationHorizontal;
|
||||
u8g2_Setup_st7565_erc12864_alt_f(
|
||||
@ -24,7 +24,7 @@ Canvas* canvas_init() {
|
||||
u8g2_SetPowerSave(&canvas->fb, 0);
|
||||
u8g2_SendBuffer(&canvas->fb);
|
||||
|
||||
api_hal_power_insomnia_exit();
|
||||
furi_hal_power_insomnia_exit();
|
||||
|
||||
return canvas;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "button_panel.h"
|
||||
#include "api-hal-resources.h"
|
||||
#include "furi-hal-resources.h"
|
||||
#include "gui/canvas.h"
|
||||
#include <m-array.h>
|
||||
#include <m-i-list.h>
|
||||
|
@ -1,8 +1,8 @@
|
||||
#include "u8g2/u8g2.h"
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal.h>
|
||||
#include <furi.h>
|
||||
|
||||
static ApiHalSpiDevice* u8g2_periphery_display = NULL;
|
||||
static FuriHalSpiDevice* u8g2_periphery_display = NULL;
|
||||
|
||||
uint8_t u8g2_gpio_and_delay_stm32(u8x8_t* u8x8, uint8_t msg, uint8_t arg_int, void* arg_ptr) {
|
||||
switch(msg) {
|
||||
@ -36,7 +36,7 @@ uint8_t u8g2_gpio_and_delay_stm32(u8x8_t* u8x8, uint8_t msg, uint8_t arg_int, vo
|
||||
uint8_t u8x8_hw_spi_stm32(u8x8_t* u8x8, uint8_t msg, uint8_t arg_int, void* arg_ptr) {
|
||||
switch(msg) {
|
||||
case U8X8_MSG_BYTE_SEND:
|
||||
api_hal_spi_bus_tx(u8g2_periphery_display->bus, (uint8_t*)arg_ptr, arg_int, 10000);
|
||||
furi_hal_spi_bus_tx(u8g2_periphery_display->bus, (uint8_t*)arg_ptr, arg_int, 10000);
|
||||
break;
|
||||
|
||||
case U8X8_MSG_BYTE_SET_DC:
|
||||
@ -49,14 +49,14 @@ uint8_t u8x8_hw_spi_stm32(u8x8_t* u8x8, uint8_t msg, uint8_t arg_int, void* arg_
|
||||
case U8X8_MSG_BYTE_START_TRANSFER:
|
||||
furi_assert(u8g2_periphery_display == NULL);
|
||||
u8g2_periphery_display =
|
||||
(ApiHalSpiDevice*)api_hal_spi_device_get(ApiHalSpiDeviceIdDisplay);
|
||||
(FuriHalSpiDevice*)furi_hal_spi_device_get(FuriHalSpiDeviceIdDisplay);
|
||||
hal_gpio_write(u8g2_periphery_display->chip_select, false);
|
||||
break;
|
||||
|
||||
case U8X8_MSG_BYTE_END_TRANSFER:
|
||||
furi_assert(u8g2_periphery_display);
|
||||
hal_gpio_write(u8g2_periphery_display->chip_select, true);
|
||||
api_hal_spi_device_return(u8g2_periphery_display);
|
||||
furi_hal_spi_device_return(u8g2_periphery_display);
|
||||
u8g2_periphery_display = NULL;
|
||||
break;
|
||||
|
||||
|
@ -183,12 +183,12 @@ void KeyReader::switch_mode_if_needed() {
|
||||
}
|
||||
|
||||
void KeyReader::start() {
|
||||
api_hal_power_enable_otg();
|
||||
furi_hal_power_enable_otg();
|
||||
switch_to(ReadMode::CYFRAL_METAKOM);
|
||||
}
|
||||
|
||||
void KeyReader::stop() {
|
||||
api_hal_power_disable_otg();
|
||||
furi_hal_power_disable_otg();
|
||||
onewire_master->stop();
|
||||
stop_comaparator();
|
||||
}
|
||||
|
@ -14,12 +14,12 @@ KeyWriter::Error KeyWriter::write(iButtonKey* key) {
|
||||
}
|
||||
|
||||
void KeyWriter::start() {
|
||||
api_hal_power_enable_otg();
|
||||
furi_hal_power_enable_otg();
|
||||
onewire_master->start();
|
||||
}
|
||||
|
||||
void KeyWriter::stop() {
|
||||
api_hal_power_disable_otg();
|
||||
furi_hal_power_disable_otg();
|
||||
onewire_master->stop();
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "pulse-sequencer.h"
|
||||
#include <furi.h>
|
||||
#include <callback-connector.h>
|
||||
#include <api-hal-resources.h>
|
||||
#include <furi-hal-resources.h>
|
||||
|
||||
void PulseSequencer::set_periods(
|
||||
uint32_t* _periods,
|
||||
|
@ -38,7 +38,7 @@ void iButtonApp::run(void* args) {
|
||||
|
||||
iButtonApp::iButtonApp()
|
||||
: notification{"notification"} {
|
||||
api_hal_power_insomnia_enter();
|
||||
furi_hal_power_insomnia_enter();
|
||||
key_worker = new KeyWorker(&ibutton_gpio);
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ iButtonApp::~iButtonApp() {
|
||||
}
|
||||
delete key_worker;
|
||||
|
||||
api_hal_power_insomnia_exit();
|
||||
furi_hal_power_insomnia_exit();
|
||||
}
|
||||
|
||||
iButtonAppViewManager* iButtonApp::get_view_manager() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include <furi.h>
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal.h>
|
||||
#include <stdarg.h>
|
||||
#include <cli/cli.h>
|
||||
#include <lib/toolbox/args.h>
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <api-hal-resources.h>
|
||||
#include <furi-hal-resources.h>
|
||||
|
||||
/* Input Types
|
||||
* Some of them are physical events and some logical
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include <furi.h>
|
||||
#include <cli/cli.h>
|
||||
#include <m-string.h>
|
||||
#include <api-hal-gpio.h>
|
||||
#include <furi-hal-gpio.h>
|
||||
|
||||
#define INPUT_DEBOUNCE_TICKS_HALF (INPUT_DEBOUNCE_TICKS / 2)
|
||||
#define INPUT_PRESS_TICKS 150
|
||||
|
@ -1,11 +1,11 @@
|
||||
#include <api-hal-delay.h>
|
||||
#include <furi-hal-delay.h>
|
||||
#include <irda.h>
|
||||
#include <app-template.h>
|
||||
#include <cli/cli.h>
|
||||
#include <cmsis_os2.h>
|
||||
#include <irda_worker.h>
|
||||
#include <furi.h>
|
||||
#include <api-hal-irda.h>
|
||||
#include <furi-hal-irda.h>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <m-string.h>
|
||||
@ -48,7 +48,7 @@ static void signal_received_callback(void* context, IrdaWorkerSignal* received_s
|
||||
}
|
||||
|
||||
static void irda_cli_start_ir_rx(Cli* cli, string_t args, void* context) {
|
||||
if(api_hal_irda_is_busy()) {
|
||||
if(furi_hal_irda_is_busy()) {
|
||||
printf("IRDA is busy. Exit.");
|
||||
return;
|
||||
}
|
||||
@ -142,7 +142,7 @@ static bool parse_signal_raw(
|
||||
}
|
||||
|
||||
static void irda_cli_start_ir_tx(Cli* cli, string_t args, void* context) {
|
||||
if(api_hal_irda_is_busy()) {
|
||||
if(furi_hal_irda_is_busy()) {
|
||||
printf("IRDA is busy. Exit.");
|
||||
return;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#include "../irda-app-event.hpp"
|
||||
#include <api-hal-irda.h>
|
||||
#include <furi-hal-irda.h>
|
||||
#include "irda.h"
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "api-hal-resources.h"
|
||||
#include "furi-hal-resources.h"
|
||||
#include "assets_icons.h"
|
||||
#include "gui/canvas.h"
|
||||
#include "gui/view.h"
|
||||
|
@ -4,8 +4,8 @@
|
||||
#include <irda_worker.h>
|
||||
#include <stdio.h>
|
||||
#include <furi.h>
|
||||
#include <api-hal-irda.h>
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal-irda.h>
|
||||
#include <furi-hal.h>
|
||||
#include <gui/view_port.h>
|
||||
#include <gui/gui.h>
|
||||
#include <gui/elements.h>
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#include <furi.h>
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal.h>
|
||||
|
||||
#include <generic-scene.hpp>
|
||||
#include <scene-controller.hpp>
|
||||
|
@ -3,9 +3,9 @@
|
||||
void LfRfidDebugAppSceneTune::on_enter(LfRfidDebugApp* app, bool need_restore) {
|
||||
app->view_controller.switch_to<LfRfidViewTuneVM>();
|
||||
|
||||
api_hal_rfid_pins_read();
|
||||
api_hal_rfid_tim_read(125000, 0.5);
|
||||
api_hal_rfid_tim_read_start();
|
||||
furi_hal_rfid_pins_read();
|
||||
furi_hal_rfid_tim_read(125000, 0.5);
|
||||
furi_hal_rfid_tim_read_start();
|
||||
}
|
||||
|
||||
bool LfRfidDebugAppSceneTune::on_event(LfRfidDebugApp* app, LfRfidDebugApp::Event* event) {
|
||||
@ -14,15 +14,15 @@ bool LfRfidDebugAppSceneTune::on_event(LfRfidDebugApp* app, LfRfidDebugApp::Even
|
||||
LfRfidViewTuneVM* tune = app->view_controller;
|
||||
|
||||
if(tune->is_dirty()) {
|
||||
api_hal_rfid_set_read_period(tune->get_ARR());
|
||||
api_hal_rfid_set_read_pulse(tune->get_CCR());
|
||||
furi_hal_rfid_set_read_period(tune->get_ARR());
|
||||
furi_hal_rfid_set_read_pulse(tune->get_CCR());
|
||||
}
|
||||
|
||||
return consumed;
|
||||
}
|
||||
|
||||
void LfRfidDebugAppSceneTune::on_exit(LfRfidDebugApp* app) {
|
||||
api_hal_rfid_tim_read_stop();
|
||||
api_hal_rfid_tim_reset();
|
||||
api_hal_rfid_pins_reset();
|
||||
furi_hal_rfid_tim_read_stop();
|
||||
furi_hal_rfid_tim_reset();
|
||||
furi_hal_rfid_pins_reset();
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
#include "decoder-analyzer.h"
|
||||
#include <furi.h>
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal.h>
|
||||
|
||||
bool DecoderAnalyzer::read(uint8_t* _data, uint8_t _data_size) {
|
||||
bool result = false;
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "emmarine.h"
|
||||
#include "decoder-emmarine.h"
|
||||
#include <furi.h>
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal.h>
|
||||
|
||||
constexpr uint32_t clocks_in_us = 64;
|
||||
constexpr uint32_t short_time = 255 * clocks_in_us;
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "decoder-gpio-out.h"
|
||||
#include <furi.h>
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal.h>
|
||||
|
||||
void DecoderGpioOut::process_front(bool polarity, uint32_t time) {
|
||||
hal_gpio_write(&gpio_ext_pa7, polarity);
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "decoder-hid26.h"
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal.h>
|
||||
|
||||
constexpr uint32_t clocks_in_us = 64;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "decoder-indala.h"
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal.h>
|
||||
|
||||
constexpr uint32_t clocks_in_us = 64;
|
||||
constexpr uint32_t us_per_bit = 255;
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "rfid-reader.h"
|
||||
#include <furi.h>
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal.h>
|
||||
#include <stm32wbxx_ll_cortex.h>
|
||||
#include <tim.h>
|
||||
|
||||
@ -49,11 +49,11 @@ void RfidReader::switch_mode() {
|
||||
switch(type) {
|
||||
case Type::Normal:
|
||||
type = Type::Indala;
|
||||
api_hal_rfid_change_read_config(62500.0f, 0.25f);
|
||||
furi_hal_rfid_change_read_config(62500.0f, 0.25f);
|
||||
break;
|
||||
case Type::Indala:
|
||||
type = Type::Normal;
|
||||
api_hal_rfid_change_read_config(125000.0f, 0.5f);
|
||||
furi_hal_rfid_change_read_config(125000.0f, 0.5f);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -76,9 +76,9 @@ RfidReader::RfidReader() {
|
||||
void RfidReader::start() {
|
||||
type = Type::Normal;
|
||||
|
||||
api_hal_rfid_pins_read();
|
||||
api_hal_rfid_tim_read(125000, 0.5);
|
||||
api_hal_rfid_tim_read_start();
|
||||
furi_hal_rfid_pins_read();
|
||||
furi_hal_rfid_tim_read(125000, 0.5);
|
||||
furi_hal_rfid_tim_read_start();
|
||||
start_comparator();
|
||||
|
||||
switch_timer_reset();
|
||||
@ -92,9 +92,9 @@ void RfidReader::start_forced(RfidReader::Type _type) {
|
||||
start();
|
||||
break;
|
||||
case Type::Indala:
|
||||
api_hal_rfid_pins_read();
|
||||
api_hal_rfid_tim_read(62500.0f, 0.25f);
|
||||
api_hal_rfid_tim_read_start();
|
||||
furi_hal_rfid_pins_read();
|
||||
furi_hal_rfid_tim_read(62500.0f, 0.25f);
|
||||
furi_hal_rfid_tim_read_start();
|
||||
start_comparator();
|
||||
|
||||
switch_timer_reset();
|
||||
@ -104,9 +104,9 @@ void RfidReader::start_forced(RfidReader::Type _type) {
|
||||
}
|
||||
|
||||
void RfidReader::stop() {
|
||||
api_hal_rfid_pins_reset();
|
||||
api_hal_rfid_tim_read_stop();
|
||||
api_hal_rfid_tim_reset();
|
||||
furi_hal_rfid_pins_reset();
|
||||
furi_hal_rfid_tim_read_stop();
|
||||
furi_hal_rfid_tim_reset();
|
||||
stop_comparator();
|
||||
}
|
||||
|
||||
|
@ -21,12 +21,12 @@ void RfidTimerEmulator::start(LfrfidKeyType type, const uint8_t* data, uint8_t d
|
||||
if(data_size >= lfrfid_key_get_type_data_count(type)) {
|
||||
current_encoder->init(data, data_size);
|
||||
|
||||
api_hal_rfid_tim_emulate(125000);
|
||||
api_hal_rfid_pins_emulate();
|
||||
furi_hal_rfid_tim_emulate(125000);
|
||||
furi_hal_rfid_pins_emulate();
|
||||
|
||||
api_interrupt_add(timer_update_callback, InterruptTypeTimerUpdate, this);
|
||||
|
||||
api_hal_rfid_tim_emulate_start();
|
||||
furi_hal_rfid_tim_emulate_start();
|
||||
}
|
||||
} else {
|
||||
// not found
|
||||
@ -34,18 +34,18 @@ void RfidTimerEmulator::start(LfrfidKeyType type, const uint8_t* data, uint8_t d
|
||||
}
|
||||
|
||||
void RfidTimerEmulator::stop() {
|
||||
api_hal_rfid_tim_emulate_stop();
|
||||
furi_hal_rfid_tim_emulate_stop();
|
||||
api_interrupt_remove(timer_update_callback, InterruptTypeTimerUpdate);
|
||||
|
||||
api_hal_rfid_tim_reset();
|
||||
api_hal_rfid_pins_reset();
|
||||
furi_hal_rfid_tim_reset();
|
||||
furi_hal_rfid_pins_reset();
|
||||
}
|
||||
|
||||
void RfidTimerEmulator::timer_update_callback(void* _hw, void* ctx) {
|
||||
RfidTimerEmulator* _this = static_cast<RfidTimerEmulator*>(ctx);
|
||||
TIM_HandleTypeDef* hw = static_cast<TIM_HandleTypeDef*>(_hw);
|
||||
|
||||
if(api_hal_rfid_is_tim_emulate(hw)) {
|
||||
if(furi_hal_rfid_is_tim_emulate(hw)) {
|
||||
bool result;
|
||||
bool polarity;
|
||||
uint16_t period;
|
||||
@ -58,7 +58,7 @@ void RfidTimerEmulator::timer_update_callback(void* _hw, void* ctx) {
|
||||
|
||||
_this->pulse_joiner.pop_pulse(&period, &pulse);
|
||||
|
||||
api_hal_rfid_set_emulate_period(period - 1);
|
||||
api_hal_rfid_set_emulate_pulse(pulse);
|
||||
furi_hal_rfid_set_emulate_period(period - 1);
|
||||
furi_hal_rfid_set_emulate_pulse(pulse);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
#pragma once
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal.h>
|
||||
#include "key-info.h"
|
||||
#include "encoder-generic.h"
|
||||
#include "encoder-emmarine.h"
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "rfid-writer.h"
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal.h>
|
||||
#include "protocols/protocol-emmarin.h"
|
||||
#include "protocols/protocol-hid-h10301.h"
|
||||
#include "protocols/protocol-indala-40134.h"
|
||||
@ -34,21 +34,21 @@ RfidWriter::~RfidWriter() {
|
||||
}
|
||||
|
||||
void RfidWriter::start() {
|
||||
api_hal_rfid_tim_read(125000, 0.5);
|
||||
api_hal_rfid_pins_read();
|
||||
api_hal_rfid_tim_read_start();
|
||||
furi_hal_rfid_tim_read(125000, 0.5);
|
||||
furi_hal_rfid_pins_read();
|
||||
furi_hal_rfid_tim_read_start();
|
||||
}
|
||||
|
||||
void RfidWriter::stop() {
|
||||
api_hal_rfid_tim_read_stop();
|
||||
api_hal_rfid_tim_reset();
|
||||
api_hal_rfid_pins_reset();
|
||||
furi_hal_rfid_tim_read_stop();
|
||||
furi_hal_rfid_tim_reset();
|
||||
furi_hal_rfid_pins_reset();
|
||||
}
|
||||
|
||||
void RfidWriter::write_gap(uint32_t gap_time) {
|
||||
api_hal_rfid_tim_read_stop();
|
||||
furi_hal_rfid_tim_read_stop();
|
||||
delay_us(gap_time * 8);
|
||||
api_hal_rfid_tim_read_start();
|
||||
furi_hal_rfid_tim_read_start();
|
||||
}
|
||||
|
||||
void RfidWriter::write_bit(bool value) {
|
||||
|
@ -26,11 +26,11 @@ LfRfidApp::LfRfidApp()
|
||||
: scene_controller{this}
|
||||
, notification{"notification"}
|
||||
, text_store(40) {
|
||||
api_hal_power_insomnia_enter();
|
||||
furi_hal_power_insomnia_enter();
|
||||
}
|
||||
|
||||
LfRfidApp::~LfRfidApp() {
|
||||
api_hal_power_insomnia_exit();
|
||||
furi_hal_power_insomnia_exit();
|
||||
}
|
||||
|
||||
void LfRfidApp::run(void* _args) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#include <furi.h>
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal.h>
|
||||
|
||||
#include <generic-scene.hpp>
|
||||
#include <scene-controller.hpp>
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include <furi.h>
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal.h>
|
||||
#include <stdarg.h>
|
||||
#include <cli/cli.h>
|
||||
#include <lib/toolbox/args.h>
|
||||
|
@ -15,7 +15,7 @@ static void loader_menu_callback(void* _ctx) {
|
||||
LOADER_LOG_TAG, "Can't start app. %s is running", loader_instance->current_app->name);
|
||||
return;
|
||||
}
|
||||
api_hal_power_insomnia_enter();
|
||||
furi_hal_power_insomnia_enter();
|
||||
loader_instance->current_app = flipper_app;
|
||||
|
||||
FURI_LOG_I(
|
||||
@ -39,7 +39,7 @@ static void loader_cli_callback(Cli* cli, string_t args, void* _ctx) {
|
||||
}
|
||||
|
||||
loader_instance->lock_semaphore++;
|
||||
api_hal_power_insomnia_enter();
|
||||
furi_hal_power_insomnia_enter();
|
||||
loader_instance->current_app = flipper_app;
|
||||
printf("Starting furi application %s", loader_instance->current_app->name);
|
||||
furi_thread_set_name(loader_instance->thread, flipper_app->name);
|
||||
@ -133,7 +133,7 @@ static void loader_thread_state_callback(FuriThreadState thread_state, void* con
|
||||
"Application thread stopped. Heap allocation balance: %d. Thread allocation balance: %d.",
|
||||
heap_diff,
|
||||
furi_thread_get_heap_size(instance->thread));
|
||||
api_hal_power_insomnia_exit();
|
||||
furi_hal_power_insomnia_exit();
|
||||
loader_unlock(instance);
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "loader.h"
|
||||
|
||||
#include <furi.h>
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal.h>
|
||||
#include <cli/cli.h>
|
||||
#include <menu/menu.h>
|
||||
#include <menu/menu_item.h>
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include <furi.h>
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal.h>
|
||||
|
||||
#include <gui/gui.h>
|
||||
#include <input/input.h>
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "nfc_i.h"
|
||||
#include "api-hal-nfc.h"
|
||||
#include "furi-hal-nfc.h"
|
||||
|
||||
bool nfc_custom_event_callback(void* context, uint32_t event) {
|
||||
furi_assert(context);
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "nfc_cli.h"
|
||||
#include "nfc_types.h"
|
||||
#include <furi.h>
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal.h>
|
||||
|
||||
void nfc_cli_init() {
|
||||
Cli* cli = furi_record_open("cli");
|
||||
@ -12,18 +12,18 @@ void nfc_cli_init() {
|
||||
|
||||
void nfc_cli_detect(Cli* cli, string_t args, void* context) {
|
||||
// Check if nfc worker is not busy
|
||||
if(api_hal_nfc_is_busy()) {
|
||||
if(furi_hal_nfc_is_busy()) {
|
||||
printf("Nfc is busy");
|
||||
return;
|
||||
}
|
||||
rfalNfcDevice* dev_list;
|
||||
uint8_t dev_cnt = 0;
|
||||
bool cmd_exit = false;
|
||||
api_hal_nfc_exit_sleep();
|
||||
furi_hal_nfc_exit_sleep();
|
||||
printf("Detecting nfc...\r\nPress Ctrl+C to abort\r\n");
|
||||
while(!cmd_exit) {
|
||||
cmd_exit |= cli_cmd_interrupt_received(cli);
|
||||
cmd_exit |= api_hal_nfc_detect(&dev_list, &dev_cnt, 400, true);
|
||||
cmd_exit |= furi_hal_nfc_detect(&dev_list, &dev_cnt, 400, true);
|
||||
if(dev_cnt > 0) {
|
||||
printf("Found %d devices\r\n", dev_cnt);
|
||||
for(uint8_t i = 0; i < dev_cnt; i++) {
|
||||
@ -40,17 +40,17 @@ void nfc_cli_detect(Cli* cli, string_t args, void* context) {
|
||||
}
|
||||
osDelay(50);
|
||||
}
|
||||
api_hal_nfc_deactivate();
|
||||
furi_hal_nfc_deactivate();
|
||||
}
|
||||
|
||||
void nfc_cli_emulate(Cli* cli, string_t args, void* context) {
|
||||
// Check if nfc worker is not busy
|
||||
if(api_hal_nfc_is_busy()) {
|
||||
if(furi_hal_nfc_is_busy()) {
|
||||
printf("Nfc is busy");
|
||||
return;
|
||||
}
|
||||
|
||||
api_hal_nfc_exit_sleep();
|
||||
furi_hal_nfc_exit_sleep();
|
||||
printf("Emulating NFC-A Type: T2T UID: CF72D440 SAK: 20 ATQA: 00/04\r\n");
|
||||
printf("Press Ctrl+C to abort\r\n");
|
||||
|
||||
@ -64,11 +64,11 @@ void nfc_cli_emulate(Cli* cli, string_t args, void* context) {
|
||||
};
|
||||
|
||||
while(!cli_cmd_interrupt_received(cli)) {
|
||||
if(api_hal_nfc_listen(params.uid, params.uid_len, params.atqa, params.sak, 100)) {
|
||||
if(furi_hal_nfc_listen(params.uid, params.uid_len, params.atqa, params.sak, 100)) {
|
||||
printf("Reader detected\r\n");
|
||||
api_hal_nfc_deactivate();
|
||||
furi_hal_nfc_deactivate();
|
||||
}
|
||||
osDelay(50);
|
||||
}
|
||||
api_hal_nfc_deactivate();
|
||||
furi_hal_nfc_deactivate();
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "nfc_worker_i.h"
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal.h>
|
||||
#include "nfc_protocols/emv_decoder.h"
|
||||
#include "nfc_protocols/mifare_ultralight.h"
|
||||
|
||||
@ -15,7 +15,7 @@ NfcWorker* nfc_worker_alloc() {
|
||||
nfc_worker->callback = NULL;
|
||||
nfc_worker->context = NULL;
|
||||
// Initialize rfal
|
||||
if(!api_hal_nfc_is_busy()) {
|
||||
if(!furi_hal_nfc_is_busy()) {
|
||||
nfc_worker_change_state(nfc_worker, NfcWorkerStateReady);
|
||||
} else {
|
||||
nfc_worker_change_state(nfc_worker, NfcWorkerStateBroken);
|
||||
@ -70,8 +70,8 @@ void nfc_worker_change_state(NfcWorker* nfc_worker, NfcWorkerState state) {
|
||||
void nfc_worker_task(void* context) {
|
||||
NfcWorker* nfc_worker = context;
|
||||
|
||||
api_hal_power_insomnia_enter();
|
||||
api_hal_nfc_exit_sleep();
|
||||
furi_hal_power_insomnia_enter();
|
||||
furi_hal_nfc_exit_sleep();
|
||||
|
||||
if(nfc_worker->state == NfcWorkerStateDetect) {
|
||||
nfc_worker_detect(nfc_worker);
|
||||
@ -90,9 +90,9 @@ void nfc_worker_task(void* context) {
|
||||
} else if(nfc_worker->state == NfcWorkerStateField) {
|
||||
nfc_worker_field(nfc_worker);
|
||||
}
|
||||
api_hal_nfc_deactivate();
|
||||
furi_hal_nfc_deactivate();
|
||||
nfc_worker_change_state(nfc_worker, NfcWorkerStateReady);
|
||||
api_hal_power_insomnia_exit();
|
||||
furi_hal_power_insomnia_exit();
|
||||
osThreadExit();
|
||||
}
|
||||
|
||||
@ -103,7 +103,7 @@ void nfc_worker_detect(NfcWorker* nfc_worker) {
|
||||
NfcDeviceCommomData* result = &nfc_worker->dev_data->nfc_data;
|
||||
|
||||
while(nfc_worker->state == NfcWorkerStateDetect) {
|
||||
if(api_hal_nfc_detect(&dev_list, &dev_cnt, 1000, true)) {
|
||||
if(furi_hal_nfc_detect(&dev_list, &dev_cnt, 1000, true)) {
|
||||
// Process first found device
|
||||
dev = &dev_list[0];
|
||||
result->uid_len = dev->nfcidLen;
|
||||
@ -143,7 +143,7 @@ void nfc_worker_detect(NfcWorker* nfc_worker) {
|
||||
void nfc_worker_emulate(NfcWorker* nfc_worker) {
|
||||
NfcDeviceCommomData* data = &nfc_worker->dev_data->nfc_data;
|
||||
while(nfc_worker->state == NfcWorkerStateEmulate) {
|
||||
if(api_hal_nfc_listen(data->uid, data->uid_len, data->atqa, data->sak, 100)) {
|
||||
if(furi_hal_nfc_listen(data->uid, data->uid_len, data->atqa, data->sak, 100)) {
|
||||
FURI_LOG_I(NFC_WORKER_TAG, "Reader detected");
|
||||
}
|
||||
osDelay(10);
|
||||
@ -163,7 +163,7 @@ void nfc_worker_read_emv_app(NfcWorker* nfc_worker) {
|
||||
|
||||
while(nfc_worker->state == NfcWorkerStateReadEMVApp) {
|
||||
memset(&emv_app, 0, sizeof(emv_app));
|
||||
if(api_hal_nfc_detect(&dev_list, &dev_cnt, 1000, false)) {
|
||||
if(furi_hal_nfc_detect(&dev_list, &dev_cnt, 1000, false)) {
|
||||
// Card was found. Check that it supports EMV
|
||||
if(dev_list[0].rfInterface == RFAL_NFC_INTERFACE_ISODEP) {
|
||||
result->nfc_data.uid_len = dev_list[0].dev.nfca.nfcId1Len;
|
||||
@ -176,10 +176,10 @@ void nfc_worker_read_emv_app(NfcWorker* nfc_worker) {
|
||||
|
||||
FURI_LOG_I(NFC_WORKER_TAG, "Send select PPSE command");
|
||||
tx_len = emv_prepare_select_ppse(tx_buff);
|
||||
err = api_hal_nfc_data_exchange(tx_buff, tx_len, &rx_buff, &rx_len, false);
|
||||
err = furi_hal_nfc_data_exchange(tx_buff, tx_len, &rx_buff, &rx_len, false);
|
||||
if(err != ERR_NONE) {
|
||||
FURI_LOG_E(NFC_WORKER_TAG, "Error during selection PPSE request: %d", err);
|
||||
api_hal_nfc_deactivate();
|
||||
furi_hal_nfc_deactivate();
|
||||
continue;
|
||||
}
|
||||
FURI_LOG_I(
|
||||
@ -195,18 +195,18 @@ void nfc_worker_read_emv_app(NfcWorker* nfc_worker) {
|
||||
break;
|
||||
} else {
|
||||
FURI_LOG_E(NFC_WORKER_TAG, "Can't find pay application");
|
||||
api_hal_nfc_deactivate();
|
||||
furi_hal_nfc_deactivate();
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
// Can't find EMV card
|
||||
FURI_LOG_W(NFC_WORKER_TAG, "Card doesn't support EMV");
|
||||
api_hal_nfc_deactivate();
|
||||
furi_hal_nfc_deactivate();
|
||||
}
|
||||
} else {
|
||||
// Can't find EMV card
|
||||
FURI_LOG_W(NFC_WORKER_TAG, "Can't find any cards");
|
||||
api_hal_nfc_deactivate();
|
||||
furi_hal_nfc_deactivate();
|
||||
}
|
||||
osDelay(20);
|
||||
}
|
||||
@ -225,7 +225,7 @@ void nfc_worker_read_emv(NfcWorker* nfc_worker) {
|
||||
|
||||
while(nfc_worker->state == NfcWorkerStateReadEMV) {
|
||||
memset(&emv_app, 0, sizeof(emv_app));
|
||||
if(api_hal_nfc_detect(&dev_list, &dev_cnt, 1000, false)) {
|
||||
if(furi_hal_nfc_detect(&dev_list, &dev_cnt, 1000, false)) {
|
||||
// Card was found. Check that it supports EMV
|
||||
if(dev_list[0].rfInterface == RFAL_NFC_INTERFACE_ISODEP) {
|
||||
result->nfc_data.uid_len = dev_list[0].dev.nfca.nfcId1Len;
|
||||
@ -238,10 +238,10 @@ void nfc_worker_read_emv(NfcWorker* nfc_worker) {
|
||||
|
||||
FURI_LOG_I(NFC_WORKER_TAG, "Send select PPSE command");
|
||||
tx_len = emv_prepare_select_ppse(tx_buff);
|
||||
err = api_hal_nfc_data_exchange(tx_buff, tx_len, &rx_buff, &rx_len, false);
|
||||
err = furi_hal_nfc_data_exchange(tx_buff, tx_len, &rx_buff, &rx_len, false);
|
||||
if(err != ERR_NONE) {
|
||||
FURI_LOG_E(NFC_WORKER_TAG, "Error during selection PPSE request: %d", err);
|
||||
api_hal_nfc_deactivate();
|
||||
furi_hal_nfc_deactivate();
|
||||
continue;
|
||||
}
|
||||
FURI_LOG_I(
|
||||
@ -250,16 +250,16 @@ void nfc_worker_read_emv(NfcWorker* nfc_worker) {
|
||||
FURI_LOG_I(NFC_WORKER_TAG, "Select PPSE responce parced");
|
||||
} else {
|
||||
FURI_LOG_E(NFC_WORKER_TAG, "Can't find pay application");
|
||||
api_hal_nfc_deactivate();
|
||||
furi_hal_nfc_deactivate();
|
||||
continue;
|
||||
}
|
||||
FURI_LOG_I(NFC_WORKER_TAG, "Starting application ...");
|
||||
tx_len = emv_prepare_select_app(tx_buff, &emv_app);
|
||||
err = api_hal_nfc_data_exchange(tx_buff, tx_len, &rx_buff, &rx_len, false);
|
||||
err = furi_hal_nfc_data_exchange(tx_buff, tx_len, &rx_buff, &rx_len, false);
|
||||
if(err != ERR_NONE) {
|
||||
FURI_LOG_E(
|
||||
NFC_WORKER_TAG, "Error during application selection request: %d", err);
|
||||
api_hal_nfc_deactivate();
|
||||
furi_hal_nfc_deactivate();
|
||||
continue;
|
||||
}
|
||||
FURI_LOG_I(
|
||||
@ -270,16 +270,16 @@ void nfc_worker_read_emv(NfcWorker* nfc_worker) {
|
||||
memcpy(result->emv_data.name, emv_app.name, sizeof(emv_app.name));
|
||||
} else {
|
||||
FURI_LOG_E(NFC_WORKER_TAG, "Can't read card name");
|
||||
api_hal_nfc_deactivate();
|
||||
furi_hal_nfc_deactivate();
|
||||
continue;
|
||||
}
|
||||
FURI_LOG_I(NFC_WORKER_TAG, "Starting Get Processing Options command ...");
|
||||
tx_len = emv_prepare_get_proc_opt(tx_buff, &emv_app);
|
||||
err = api_hal_nfc_data_exchange(tx_buff, tx_len, &rx_buff, &rx_len, false);
|
||||
err = furi_hal_nfc_data_exchange(tx_buff, tx_len, &rx_buff, &rx_len, false);
|
||||
if(err != ERR_NONE) {
|
||||
FURI_LOG_E(
|
||||
NFC_WORKER_TAG, "Error during Get Processing Options command: %d", err);
|
||||
api_hal_nfc_deactivate();
|
||||
furi_hal_nfc_deactivate();
|
||||
continue;
|
||||
}
|
||||
if(emv_decode_get_proc_opt(rx_buff, *rx_len, &emv_app)) {
|
||||
@ -303,7 +303,7 @@ void nfc_worker_read_emv(NfcWorker* nfc_worker) {
|
||||
// Iterate over all records in file
|
||||
for(uint8_t record = record_start; record <= record_end; ++record) {
|
||||
tx_len = emv_prepare_read_sfi_record(tx_buff, sfi, record);
|
||||
err = api_hal_nfc_data_exchange(
|
||||
err = furi_hal_nfc_data_exchange(
|
||||
tx_buff, tx_len, &rx_buff, &rx_len, false);
|
||||
if(err != ERR_NONE) {
|
||||
FURI_LOG_E(
|
||||
@ -336,17 +336,17 @@ void nfc_worker_read_emv(NfcWorker* nfc_worker) {
|
||||
} else {
|
||||
FURI_LOG_E(NFC_WORKER_TAG, "Can't read card number");
|
||||
}
|
||||
api_hal_nfc_deactivate();
|
||||
furi_hal_nfc_deactivate();
|
||||
}
|
||||
} else {
|
||||
// Can't find EMV card
|
||||
FURI_LOG_W(NFC_WORKER_TAG, "Card doesn't support EMV");
|
||||
api_hal_nfc_deactivate();
|
||||
furi_hal_nfc_deactivate();
|
||||
}
|
||||
} else {
|
||||
// Can't find EMV card
|
||||
FURI_LOG_W(NFC_WORKER_TAG, "Can't find any cards");
|
||||
api_hal_nfc_deactivate();
|
||||
furi_hal_nfc_deactivate();
|
||||
}
|
||||
osDelay(20);
|
||||
}
|
||||
@ -406,47 +406,47 @@ void nfc_worker_emulate_apdu(NfcWorker* nfc_worker) {
|
||||
0x00, 0x00};
|
||||
|
||||
while(nfc_worker->state == NfcWorkerStateEmulateApdu) {
|
||||
if(api_hal_nfc_listen(params.uid, params.uid_len, params.atqa, params.sak, 300)) {
|
||||
if(furi_hal_nfc_listen(params.uid, params.uid_len, params.atqa, params.sak, 300)) {
|
||||
FURI_LOG_I(NFC_WORKER_TAG, "POS terminal detected");
|
||||
// Read data from POS terminal
|
||||
err = api_hal_nfc_data_exchange(NULL, 0, &rx_buff, &rx_len, false);
|
||||
err = furi_hal_nfc_data_exchange(NULL, 0, &rx_buff, &rx_len, false);
|
||||
if(err == ERR_NONE) {
|
||||
FURI_LOG_I(NFC_WORKER_TAG, "Received Select PPSE");
|
||||
} else {
|
||||
FURI_LOG_E(NFC_WORKER_TAG, "Error in 1st data exchange: select PPSE");
|
||||
api_hal_nfc_deactivate();
|
||||
furi_hal_nfc_deactivate();
|
||||
continue;
|
||||
}
|
||||
FURI_LOG_I(NFC_WORKER_TAG, "Transive SELECT PPSE ANS");
|
||||
tx_len = emv_select_ppse_ans(tx_buff);
|
||||
err = api_hal_nfc_data_exchange(tx_buff, tx_len, &rx_buff, &rx_len, false);
|
||||
err = furi_hal_nfc_data_exchange(tx_buff, tx_len, &rx_buff, &rx_len, false);
|
||||
if(err == ERR_NONE) {
|
||||
FURI_LOG_I(NFC_WORKER_TAG, "Received Select APP");
|
||||
} else {
|
||||
FURI_LOG_E(NFC_WORKER_TAG, "Error in 2nd data exchange: select APP");
|
||||
api_hal_nfc_deactivate();
|
||||
furi_hal_nfc_deactivate();
|
||||
continue;
|
||||
}
|
||||
|
||||
FURI_LOG_I(NFC_WORKER_TAG, "Transive SELECT APP ANS");
|
||||
tx_len = emv_select_app_ans(tx_buff);
|
||||
err = api_hal_nfc_data_exchange(tx_buff, tx_len, &rx_buff, &rx_len, false);
|
||||
err = furi_hal_nfc_data_exchange(tx_buff, tx_len, &rx_buff, &rx_len, false);
|
||||
if(err == ERR_NONE) {
|
||||
FURI_LOG_I(NFC_WORKER_TAG, "Received PDOL");
|
||||
} else {
|
||||
FURI_LOG_E(NFC_WORKER_TAG, "Error in 3rd data exchange: receive PDOL");
|
||||
api_hal_nfc_deactivate();
|
||||
furi_hal_nfc_deactivate();
|
||||
continue;
|
||||
}
|
||||
|
||||
FURI_LOG_I(NFC_WORKER_TAG, "Transive PDOL ANS");
|
||||
tx_len = emv_get_proc_opt_ans(tx_buff);
|
||||
err = api_hal_nfc_data_exchange(tx_buff, tx_len, &rx_buff, &rx_len, false);
|
||||
err = furi_hal_nfc_data_exchange(tx_buff, tx_len, &rx_buff, &rx_len, false);
|
||||
if(err == ERR_NONE) {
|
||||
FURI_LOG_I(NFC_WORKER_TAG, "Transive PDOL ANS");
|
||||
} else {
|
||||
FURI_LOG_E(NFC_WORKER_TAG, "Error in 4rd data exchange: Transive PDOL ANS");
|
||||
api_hal_nfc_deactivate();
|
||||
furi_hal_nfc_deactivate();
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -455,13 +455,13 @@ void nfc_worker_emulate_apdu(NfcWorker* nfc_worker) {
|
||||
} else {
|
||||
FURI_LOG_I(NFC_WORKER_TAG, "Correct debug message received");
|
||||
tx_len = sizeof(debug_tx);
|
||||
err = api_hal_nfc_data_exchange(
|
||||
err = furi_hal_nfc_data_exchange(
|
||||
(uint8_t*)debug_tx, tx_len, &rx_buff, &rx_len, false);
|
||||
if(err == ERR_NONE) {
|
||||
FURI_LOG_I(NFC_WORKER_TAG, "Transive Debug message");
|
||||
}
|
||||
}
|
||||
api_hal_nfc_deactivate();
|
||||
furi_hal_nfc_deactivate();
|
||||
} else {
|
||||
FURI_LOG_W(NFC_WORKER_TAG, "Can't find reader");
|
||||
}
|
||||
@ -481,9 +481,9 @@ void nfc_worker_read_mifare_ul(NfcWorker* nfc_worker) {
|
||||
NfcDeviceData* result = nfc_worker->dev_data;
|
||||
|
||||
while(nfc_worker->state == NfcWorkerStateReadMifareUl) {
|
||||
api_hal_nfc_deactivate();
|
||||
furi_hal_nfc_deactivate();
|
||||
memset(&mf_ul_read, 0, sizeof(mf_ul_read));
|
||||
if(api_hal_nfc_detect(&dev_list, &dev_cnt, 300, false)) {
|
||||
if(furi_hal_nfc_detect(&dev_list, &dev_cnt, 300, false)) {
|
||||
if(dev_list[0].type == RFAL_NFC_LISTEN_TYPE_NFCA &&
|
||||
mf_ul_check_card_type(
|
||||
dev_list[0].dev.nfca.sensRes.anticollisionInfo,
|
||||
@ -492,7 +492,7 @@ void nfc_worker_read_mifare_ul(NfcWorker* nfc_worker) {
|
||||
// Get Mifare Ultralight version
|
||||
FURI_LOG_I(NFC_WORKER_TAG, "Found Mifare Ultralight tag. Reading tag version");
|
||||
tx_len = mf_ul_prepare_get_version(tx_buff);
|
||||
err = api_hal_nfc_data_exchange(tx_buff, tx_len, &rx_buff, &rx_len, false);
|
||||
err = furi_hal_nfc_data_exchange(tx_buff, tx_len, &rx_buff, &rx_len, false);
|
||||
if(err == ERR_NONE) {
|
||||
mf_ul_parse_get_version_response(rx_buff, &mf_ul_read);
|
||||
FURI_LOG_I(
|
||||
@ -507,8 +507,8 @@ void nfc_worker_read_mifare_ul(NfcWorker* nfc_worker) {
|
||||
err = ERR_NONE;
|
||||
mf_ul_set_default_version(&mf_ul_read);
|
||||
// Reinit device
|
||||
api_hal_nfc_deactivate();
|
||||
if(!api_hal_nfc_detect(&dev_list, &dev_cnt, 300, false)) {
|
||||
furi_hal_nfc_deactivate();
|
||||
if(!furi_hal_nfc_detect(&dev_list, &dev_cnt, 300, false)) {
|
||||
FURI_LOG_E(NFC_WORKER_TAG, "Lost connection. Restarting search");
|
||||
continue;
|
||||
}
|
||||
@ -523,7 +523,7 @@ void nfc_worker_read_mifare_ul(NfcWorker* nfc_worker) {
|
||||
if(mf_ul_read.support_fast_read) {
|
||||
FURI_LOG_I(NFC_WORKER_TAG, "Reading pages ...");
|
||||
tx_len = mf_ul_prepare_fast_read(tx_buff, 0x00, mf_ul_read.pages_to_read - 1);
|
||||
if(api_hal_nfc_data_exchange(tx_buff, tx_len, &rx_buff, &rx_len, false)) {
|
||||
if(furi_hal_nfc_data_exchange(tx_buff, tx_len, &rx_buff, &rx_len, false)) {
|
||||
FURI_LOG_E(NFC_WORKER_TAG, "Failed reading pages");
|
||||
continue;
|
||||
} else {
|
||||
@ -533,7 +533,7 @@ void nfc_worker_read_mifare_ul(NfcWorker* nfc_worker) {
|
||||
|
||||
FURI_LOG_I(NFC_WORKER_TAG, "Reading signature ...");
|
||||
tx_len = mf_ul_prepare_read_signature(tx_buff);
|
||||
if(api_hal_nfc_data_exchange(tx_buff, tx_len, &rx_buff, &rx_len, false)) {
|
||||
if(furi_hal_nfc_data_exchange(tx_buff, tx_len, &rx_buff, &rx_len, false)) {
|
||||
FURI_LOG_W(NFC_WORKER_TAG, "Failed reading signature");
|
||||
memset(mf_ul_read.data.signature, 0, sizeof(mf_ul_read.data.signature));
|
||||
} else {
|
||||
@ -543,7 +543,7 @@ void nfc_worker_read_mifare_ul(NfcWorker* nfc_worker) {
|
||||
FURI_LOG_I(NFC_WORKER_TAG, "Reading 3 counters ...");
|
||||
for(uint8_t i = 0; i < 3; i++) {
|
||||
tx_len = mf_ul_prepare_read_cnt(tx_buff, i);
|
||||
if(api_hal_nfc_data_exchange(tx_buff, tx_len, &rx_buff, &rx_len, false)) {
|
||||
if(furi_hal_nfc_data_exchange(tx_buff, tx_len, &rx_buff, &rx_len, false)) {
|
||||
FURI_LOG_W(NFC_WORKER_TAG, "Failed reading Counter %d", i);
|
||||
mf_ul_read.data.counter[i] = 0;
|
||||
} else {
|
||||
@ -554,7 +554,7 @@ void nfc_worker_read_mifare_ul(NfcWorker* nfc_worker) {
|
||||
FURI_LOG_I(NFC_WORKER_TAG, "Checking tearing flags ...");
|
||||
for(uint8_t i = 0; i < 3; i++) {
|
||||
tx_len = mf_ul_prepare_check_tearing(tx_buff, i);
|
||||
if(api_hal_nfc_data_exchange(tx_buff, tx_len, &rx_buff, &rx_len, false)) {
|
||||
if(furi_hal_nfc_data_exchange(tx_buff, tx_len, &rx_buff, &rx_len, false)) {
|
||||
FURI_LOG_E(NFC_WORKER_TAG, "Error checking tearing flag %d", i);
|
||||
mf_ul_read.data.tearing[i] = MF_UL_TEARING_FLAG_DEFAULT;
|
||||
} else {
|
||||
@ -566,7 +566,7 @@ void nfc_worker_read_mifare_ul(NfcWorker* nfc_worker) {
|
||||
for(uint8_t page = 0; page < mf_ul_read.pages_to_read; page += 4) {
|
||||
FURI_LOG_I(NFC_WORKER_TAG, "Reading pages %d - %d ...", page, page + 3);
|
||||
tx_len = mf_ul_prepare_read(tx_buff, page);
|
||||
if(api_hal_nfc_data_exchange(tx_buff, tx_len, &rx_buff, &rx_len, false)) {
|
||||
if(furi_hal_nfc_data_exchange(tx_buff, tx_len, &rx_buff, &rx_len, false)) {
|
||||
FURI_LOG_E(
|
||||
NFC_WORKER_TAG, "Read pages %d - %d failed", page, page + 3);
|
||||
continue;
|
||||
@ -610,7 +610,7 @@ void nfc_worker_emulate_mifare_ul(NfcWorker* nfc_worker) {
|
||||
NfcDeviceData* data = nfc_worker->dev_data;
|
||||
|
||||
while(nfc_worker->state == NfcWorkerStateEmulateMifareUl) {
|
||||
if(api_hal_nfc_listen(
|
||||
if(furi_hal_nfc_listen(
|
||||
data->nfc_data.uid,
|
||||
data->nfc_data.uid_len,
|
||||
data->nfc_data.atqa,
|
||||
@ -620,7 +620,7 @@ void nfc_worker_emulate_mifare_ul(NfcWorker* nfc_worker) {
|
||||
// Prepare version answer
|
||||
tx_len = sizeof(data->mf_ul_data.version);
|
||||
memcpy(tx_buff, &data->mf_ul_data.version, tx_len);
|
||||
err = api_hal_nfc_data_exchange(tx_buff, tx_len, &rx_buff, &rx_len, false);
|
||||
err = furi_hal_nfc_data_exchange(tx_buff, tx_len, &rx_buff, &rx_len, false);
|
||||
if(err == ERR_NONE) {
|
||||
FURI_LOG_I(NFC_WORKER_TAG, "Received 1st message:");
|
||||
for(uint16_t i = 0; i < *rx_len; i++) {
|
||||
@ -629,7 +629,7 @@ void nfc_worker_emulate_mifare_ul(NfcWorker* nfc_worker) {
|
||||
printf("\r\n");
|
||||
} else {
|
||||
FURI_LOG_E(NFC_WORKER_TAG, "Error in 1st data exchange: select PPSE");
|
||||
api_hal_nfc_deactivate();
|
||||
furi_hal_nfc_deactivate();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -639,9 +639,9 @@ void nfc_worker_emulate_mifare_ul(NfcWorker* nfc_worker) {
|
||||
}
|
||||
|
||||
void nfc_worker_field(NfcWorker* nfc_worker) {
|
||||
api_hal_nfc_field_on();
|
||||
furi_hal_nfc_field_on();
|
||||
while(nfc_worker->state == NfcWorkerStateField) {
|
||||
osDelay(50);
|
||||
}
|
||||
api_hal_nfc_field_off();
|
||||
furi_hal_nfc_field_off();
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include <furi.h>
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal.h>
|
||||
#include "notification.h"
|
||||
#include "notification-messages.h"
|
||||
#include "notification-app.h"
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include <furi.h>
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal.h>
|
||||
#include <storage/storage.h>
|
||||
#include "notification.h"
|
||||
#include "notification-messages.h"
|
||||
@ -41,7 +41,7 @@ void notification_apply_internal_led_layer(NotificationLedLayer* layer, uint8_t
|
||||
|
||||
// apply if current layer is internal
|
||||
if(layer->index == LayerInternal) {
|
||||
api_hal_light_set(layer->light, layer->value[LayerInternal]);
|
||||
furi_hal_light_set(layer->light, layer->value[LayerInternal]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ void notification_apply_notification_led_layer(
|
||||
// set layer
|
||||
layer->value[LayerNotification] = layer_value;
|
||||
// apply
|
||||
api_hal_light_set(layer->light, layer->value[LayerNotification]);
|
||||
furi_hal_light_set(layer->light, layer->value[LayerNotification]);
|
||||
}
|
||||
|
||||
void notification_reset_notification_led_layer(NotificationLedLayer* layer) {
|
||||
@ -84,7 +84,7 @@ void notification_reset_notification_led_layer(NotificationLedLayer* layer) {
|
||||
layer->index = LayerInternal;
|
||||
|
||||
// apply
|
||||
api_hal_light_set(layer->light, layer->value[LayerInternal]);
|
||||
furi_hal_light_set(layer->light, layer->value[LayerInternal]);
|
||||
}
|
||||
|
||||
void notification_reset_notification_layer(NotificationApp* app, uint8_t reset_mask) {
|
||||
@ -130,11 +130,11 @@ uint32_t notification_settings_display_off_delay_ticks(NotificationApp* app) {
|
||||
|
||||
// generics
|
||||
void notification_vibro_on() {
|
||||
api_hal_vibro_on(true);
|
||||
furi_hal_vibro_on(true);
|
||||
}
|
||||
|
||||
void notification_vibro_off() {
|
||||
api_hal_vibro_on(false);
|
||||
furi_hal_vibro_on(false);
|
||||
}
|
||||
|
||||
void notification_sound_on(float pwm, float freq) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include <furi.h>
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal.h>
|
||||
#include "notification.h"
|
||||
#include "notification-messages.h"
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include <furi.h>
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal.h>
|
||||
#include <notification/notification-messages.h>
|
||||
|
||||
const NotificationMessage message_green_110 = {
|
||||
@ -20,7 +20,7 @@ int32_t power_observer_srv(void* p) {
|
||||
const float overconsumption_limit = 0.03f;
|
||||
|
||||
while(true) {
|
||||
float current = -api_hal_power_get_battery_current(ApiHalPowerICFuelGauge);
|
||||
float current = -furi_hal_power_get_battery_current(FuriHalPowerICFuelGauge);
|
||||
|
||||
if(current >= overconsumption_limit) {
|
||||
notification_message_block(notifications, &sequence_overconsumption);
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include "power_views.h"
|
||||
|
||||
#include <furi.h>
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal.h>
|
||||
|
||||
#include <menu/menu.h>
|
||||
#include <menu/menu_item.h>
|
||||
@ -86,11 +86,11 @@ void power_menu_reset_callback(void* context) {
|
||||
}
|
||||
|
||||
void power_menu_enable_otg_callback(void* context) {
|
||||
api_hal_power_enable_otg();
|
||||
furi_hal_power_enable_otg();
|
||||
}
|
||||
|
||||
void power_menu_disable_otg_callback(void* context) {
|
||||
api_hal_power_disable_otg();
|
||||
furi_hal_power_disable_otg();
|
||||
}
|
||||
|
||||
void power_menu_info_callback(void* context) {
|
||||
@ -157,22 +157,22 @@ void power_free(Power* power) {
|
||||
|
||||
void power_off(Power* power) {
|
||||
furi_assert(power);
|
||||
api_hal_power_off();
|
||||
furi_hal_power_off();
|
||||
view_dispatcher_switch_to_view(power->view_dispatcher, PowerViewDisconnect);
|
||||
}
|
||||
|
||||
void power_reboot(Power* power, PowerBootMode mode) {
|
||||
if(mode == PowerBootModeNormal) {
|
||||
api_hal_boot_set_mode(ApiHalBootModeNormal);
|
||||
furi_hal_boot_set_mode(FuriHalBootModeNormal);
|
||||
} else if(mode == PowerBootModeDfu) {
|
||||
api_hal_boot_set_mode(ApiHalBootModeDFU);
|
||||
furi_hal_boot_set_mode(FuriHalBootModeDFU);
|
||||
}
|
||||
api_hal_power_reset();
|
||||
furi_hal_power_reset();
|
||||
}
|
||||
|
||||
static void power_charging_indication_handler(Power* power, NotificationApp* notifications) {
|
||||
if(api_hal_power_is_charging()) {
|
||||
if(api_hal_power_get_pct() == 100) {
|
||||
if(furi_hal_power_is_charging()) {
|
||||
if(furi_hal_power_get_pct() == 100) {
|
||||
if(power->state != PowerStateCharged) {
|
||||
notification_internal_message(notifications, &sequence_charged);
|
||||
power->state = PowerStateCharged;
|
||||
@ -185,7 +185,7 @@ static void power_charging_indication_handler(Power* power, NotificationApp* not
|
||||
}
|
||||
}
|
||||
|
||||
if(!api_hal_power_is_charging()) {
|
||||
if(!furi_hal_power_is_charging()) {
|
||||
if(power->state != PowerStateNotCharging) {
|
||||
notification_internal_message(notifications, &sequence_not_charging);
|
||||
power->state = PowerStateNotCharging;
|
||||
@ -212,19 +212,19 @@ int32_t power_srv(void* p) {
|
||||
|
||||
with_view_model(
|
||||
power->info_view, (PowerInfoModel * model) {
|
||||
model->charge = api_hal_power_get_pct();
|
||||
model->health = api_hal_power_get_bat_health_pct();
|
||||
model->capacity_remaining = api_hal_power_get_battery_remaining_capacity();
|
||||
model->capacity_full = api_hal_power_get_battery_full_capacity();
|
||||
model->current_charger = api_hal_power_get_battery_current(ApiHalPowerICCharger);
|
||||
model->current_gauge = api_hal_power_get_battery_current(ApiHalPowerICFuelGauge);
|
||||
model->voltage_charger = api_hal_power_get_battery_voltage(ApiHalPowerICCharger);
|
||||
model->voltage_gauge = api_hal_power_get_battery_voltage(ApiHalPowerICFuelGauge);
|
||||
model->voltage_vbus = api_hal_power_get_usb_voltage();
|
||||
model->charge = furi_hal_power_get_pct();
|
||||
model->health = furi_hal_power_get_bat_health_pct();
|
||||
model->capacity_remaining = furi_hal_power_get_battery_remaining_capacity();
|
||||
model->capacity_full = furi_hal_power_get_battery_full_capacity();
|
||||
model->current_charger = furi_hal_power_get_battery_current(FuriHalPowerICCharger);
|
||||
model->current_gauge = furi_hal_power_get_battery_current(FuriHalPowerICFuelGauge);
|
||||
model->voltage_charger = furi_hal_power_get_battery_voltage(FuriHalPowerICCharger);
|
||||
model->voltage_gauge = furi_hal_power_get_battery_voltage(FuriHalPowerICFuelGauge);
|
||||
model->voltage_vbus = furi_hal_power_get_usb_voltage();
|
||||
model->temperature_charger =
|
||||
api_hal_power_get_battery_temperature(ApiHalPowerICCharger);
|
||||
furi_hal_power_get_battery_temperature(FuriHalPowerICCharger);
|
||||
model->temperature_gauge =
|
||||
api_hal_power_get_battery_temperature(ApiHalPowerICFuelGauge);
|
||||
furi_hal_power_get_battery_temperature(FuriHalPowerICFuelGauge);
|
||||
|
||||
if(model->charge == 0 && model->voltage_vbus < 4.0f) {
|
||||
battery_low = true;
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "power_cli.h"
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal.h>
|
||||
|
||||
void power_cli_poweroff(Cli* cli, string_t args, void* context) {
|
||||
Power* power = context;
|
||||
@ -22,7 +22,7 @@ void power_cli_factory_reset(Cli* cli, string_t args, void* context) {
|
||||
char c = cli_getc(cli);
|
||||
if(c == 'y' || c == 'Y') {
|
||||
printf("Data will be wiped after reboot.\r\n");
|
||||
api_hal_boot_set_flags(ApiHalBootFlagFactoryReset);
|
||||
furi_hal_boot_set_flags(FuriHalBootFlagFactoryReset);
|
||||
power_reboot(power, PowerBootModeNormal);
|
||||
} else {
|
||||
printf("Safe choice.\r\n");
|
||||
@ -30,14 +30,14 @@ void power_cli_factory_reset(Cli* cli, string_t args, void* context) {
|
||||
}
|
||||
|
||||
void power_cli_info(Cli* cli, string_t args, void* context) {
|
||||
api_hal_power_dump_state();
|
||||
furi_hal_power_dump_state();
|
||||
}
|
||||
|
||||
void power_cli_otg(Cli* cli, string_t args, void* context) {
|
||||
if(!string_cmp(args, "0")) {
|
||||
api_hal_power_disable_otg();
|
||||
furi_hal_power_disable_otg();
|
||||
} else if(!string_cmp(args, "1")) {
|
||||
api_hal_power_enable_otg();
|
||||
furi_hal_power_enable_otg();
|
||||
} else {
|
||||
cli_print_usage("power_otg", "<1|0>", string_get_cstr(args));
|
||||
}
|
||||
@ -45,9 +45,9 @@ void power_cli_otg(Cli* cli, string_t args, void* context) {
|
||||
|
||||
void power_cli_ext(Cli* cli, string_t args, void* context) {
|
||||
if(!string_cmp(args, "0")) {
|
||||
api_hal_power_disable_external_3_3v();
|
||||
furi_hal_power_disable_external_3_3v();
|
||||
} else if(!string_cmp(args, "1")) {
|
||||
api_hal_power_enable_external_3_3v();
|
||||
furi_hal_power_enable_external_3_3v();
|
||||
} else {
|
||||
cli_print_usage("power_ext", "<1|0>", string_get_cstr(args));
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#include <furi.h>
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal.h>
|
||||
|
||||
#include <generic-scene.hpp>
|
||||
#include <scene-controller.hpp>
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "../storage-settings.h"
|
||||
#include <api-hal-version.h>
|
||||
#include <furi-hal-version.h>
|
||||
|
||||
static void
|
||||
storage_settings_scene_internal_info_dialog_callback(DialogExResult result, void* context) {
|
||||
@ -28,7 +28,7 @@ void storage_settings_scene_internal_info_on_enter(void* context) {
|
||||
string_printf(
|
||||
app->text_string,
|
||||
"Label: %s\nType: LittleFS\n%lu KB total\n%lu KB free",
|
||||
api_hal_version_get_name_ptr(),
|
||||
furi_hal_version_get_name_ptr(),
|
||||
(uint32_t)(total_space / 1024),
|
||||
(uint32_t)(free_space / 1024));
|
||||
dialog_ex_set_text(
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <lib/toolbox/args.h>
|
||||
#include <storage/storage.h>
|
||||
#include <storage/storage-sd-api.h>
|
||||
#include <api-hal-version.h>
|
||||
#include <furi-hal-version.h>
|
||||
|
||||
#define MAX_NAME_LENGTH 255
|
||||
|
||||
@ -64,7 +64,7 @@ void storage_cli_info(Cli* cli, string_t path) {
|
||||
} else {
|
||||
printf(
|
||||
"Label: %s\r\nType: LittleFS\r\n%lu KB total\r\n%lu KB free\r\n",
|
||||
api_hal_version_get_name_ptr(),
|
||||
furi_hal_version_get_name_ptr(),
|
||||
(uint32_t)(total_space / 1024),
|
||||
(uint32_t)(free_space / 1024));
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "storage-glue.h"
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal.h>
|
||||
|
||||
/****************** storage file ******************/
|
||||
|
||||
@ -39,12 +39,12 @@ void storage_data_init(StorageData* storage) {
|
||||
}
|
||||
|
||||
bool storage_data_lock(StorageData* storage) {
|
||||
api_hal_power_insomnia_enter();
|
||||
furi_hal_power_insomnia_enter();
|
||||
return (osMutexAcquire(storage->mutex, osWaitForever) == osOK);
|
||||
}
|
||||
|
||||
bool storage_data_unlock(StorageData* storage) {
|
||||
api_hal_power_insomnia_exit();
|
||||
furi_hal_power_insomnia_exit();
|
||||
return (osMutexRelease(storage->mutex) == osOK);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include <furi.h>
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal.h>
|
||||
#include <storage/storage.h>
|
||||
|
||||
#define TAG "storage-test"
|
||||
|
@ -1,9 +1,9 @@
|
||||
#include "fatfs.h"
|
||||
#include "../filesystem-api-internal.h"
|
||||
#include "storage-ext.h"
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal.h>
|
||||
#include "sd-notify.h"
|
||||
#include <api-hal-sd.h>
|
||||
#include <furi-hal-sd.h>
|
||||
|
||||
typedef FIL SDFile;
|
||||
typedef DIR SDDir;
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "storage-int.h"
|
||||
#include <lfs.h>
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal.h>
|
||||
|
||||
#define TAG "storage-int"
|
||||
#define STORAGE_PATH "/int"
|
||||
@ -103,7 +103,7 @@ static int storage_int_device_prog(
|
||||
|
||||
int ret = 0;
|
||||
while(size > 0) {
|
||||
if(!api_hal_flash_write_dword(address, *(uint64_t*)buffer)) {
|
||||
if(!furi_hal_flash_write_dword(address, *(uint64_t*)buffer)) {
|
||||
ret = -1;
|
||||
break;
|
||||
}
|
||||
@ -121,7 +121,7 @@ static int storage_int_device_erase(const struct lfs_config* c, lfs_block_t bloc
|
||||
|
||||
FURI_LOG_D(TAG, "Device erase: page %d, translated page: %d", block, page);
|
||||
|
||||
if(api_hal_flash_erase(page, 1)) {
|
||||
if(furi_hal_flash_erase(page, 1)) {
|
||||
return 0;
|
||||
} else {
|
||||
return -1;
|
||||
@ -137,9 +137,9 @@ static LFSData* storage_int_lfs_data_alloc() {
|
||||
LFSData* lfs_data = furi_alloc(sizeof(LFSData));
|
||||
|
||||
// Internal storage start address
|
||||
*(size_t*)(&lfs_data->start_address) = api_hal_flash_get_free_page_start_address();
|
||||
*(size_t*)(&lfs_data->start_address) = furi_hal_flash_get_free_page_start_address();
|
||||
*(size_t*)(&lfs_data->start_page) =
|
||||
(lfs_data->start_address - api_hal_flash_get_base()) / api_hal_flash_get_page_size();
|
||||
(lfs_data->start_address - furi_hal_flash_get_base()) / furi_hal_flash_get_page_size();
|
||||
|
||||
// LFS configuration
|
||||
// Glue and context
|
||||
@ -150,11 +150,11 @@ static LFSData* storage_int_lfs_data_alloc() {
|
||||
lfs_data->config.sync = storage_int_device_sync;
|
||||
|
||||
// Block device description
|
||||
lfs_data->config.read_size = api_hal_flash_get_read_block_size();
|
||||
lfs_data->config.prog_size = api_hal_flash_get_write_block_size();
|
||||
lfs_data->config.block_size = api_hal_flash_get_page_size();
|
||||
lfs_data->config.block_count = api_hal_flash_get_free_page_count();
|
||||
lfs_data->config.block_cycles = api_hal_flash_get_cycles_count();
|
||||
lfs_data->config.read_size = furi_hal_flash_get_read_block_size();
|
||||
lfs_data->config.prog_size = furi_hal_flash_get_write_block_size();
|
||||
lfs_data->config.block_size = furi_hal_flash_get_page_size();
|
||||
lfs_data->config.block_count = furi_hal_flash_get_free_page_count();
|
||||
lfs_data->config.block_cycles = furi_hal_flash_get_cycles_count();
|
||||
lfs_data->config.cache_size = 16;
|
||||
lfs_data->config.lookahead_size = 16;
|
||||
|
||||
@ -163,15 +163,15 @@ static LFSData* storage_int_lfs_data_alloc() {
|
||||
|
||||
static void storage_int_lfs_mount(LFSData* lfs_data, StorageData* storage) {
|
||||
int err;
|
||||
ApiHalBootFlag boot_flags = api_hal_boot_get_flags();
|
||||
FuriHalBootFlag boot_flags = furi_hal_boot_get_flags();
|
||||
lfs_t* lfs = &lfs_data->lfs;
|
||||
|
||||
if(boot_flags & ApiHalBootFlagFactoryReset) {
|
||||
if(boot_flags & FuriHalBootFlagFactoryReset) {
|
||||
// Factory reset
|
||||
err = lfs_format(lfs, &lfs_data->config);
|
||||
if(err == 0) {
|
||||
FURI_LOG_I(TAG, "Factory reset: Format successful, trying to mount");
|
||||
api_hal_boot_set_flags(boot_flags & ~ApiHalBootFlagFactoryReset);
|
||||
furi_hal_boot_set_flags(boot_flags & ~FuriHalBootFlagFactoryReset);
|
||||
err = lfs_mount(lfs, &lfs_data->config);
|
||||
if(err == 0) {
|
||||
FURI_LOG_I(TAG, "Factory reset: Mounted");
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "subghz_cli.h"
|
||||
|
||||
#include <furi.h>
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal.h>
|
||||
#include <stream_buffer.h>
|
||||
#include <lib/subghz/protocols/subghz_protocol.h>
|
||||
|
||||
@ -31,7 +31,7 @@ void subghz_cli_command_tx_carrier(Cli* cli, string_t args, void* context) {
|
||||
cli_print_usage("subghz_tx_carrier", "<Frequency in HZ>", string_get_cstr(args));
|
||||
return;
|
||||
}
|
||||
if(!api_hal_subghz_is_frequency_valid(frequency)) {
|
||||
if(!furi_hal_subghz_is_frequency_valid(frequency)) {
|
||||
printf(
|
||||
"Frequency must be in " SUBGHZ_FREQUENCY_RANGE_STR " range, not %lu\r\n",
|
||||
frequency);
|
||||
@ -39,14 +39,14 @@ void subghz_cli_command_tx_carrier(Cli* cli, string_t args, void* context) {
|
||||
}
|
||||
}
|
||||
|
||||
api_hal_subghz_reset();
|
||||
api_hal_subghz_load_preset(ApiHalSubGhzPresetOokAsync);
|
||||
frequency = api_hal_subghz_set_frequency_and_path(frequency);
|
||||
furi_hal_subghz_reset();
|
||||
furi_hal_subghz_load_preset(FuriHalSubGhzPresetOokAsync);
|
||||
frequency = furi_hal_subghz_set_frequency_and_path(frequency);
|
||||
|
||||
hal_gpio_init(&gpio_cc1101_g0, GpioModeOutputPushPull, GpioPullNo, GpioSpeedLow);
|
||||
hal_gpio_write(&gpio_cc1101_g0, true);
|
||||
|
||||
api_hal_subghz_tx();
|
||||
furi_hal_subghz_tx();
|
||||
|
||||
printf("Transmitting at frequency %lu Hz\r\n", frequency);
|
||||
printf("Press CTRL+C to stop\r\n");
|
||||
@ -54,8 +54,8 @@ void subghz_cli_command_tx_carrier(Cli* cli, string_t args, void* context) {
|
||||
osDelay(250);
|
||||
}
|
||||
|
||||
api_hal_subghz_set_path(ApiHalSubGhzPathIsolate);
|
||||
api_hal_subghz_sleep();
|
||||
furi_hal_subghz_set_path(FuriHalSubGhzPathIsolate);
|
||||
furi_hal_subghz_sleep();
|
||||
}
|
||||
|
||||
void subghz_cli_command_rx_carrier(Cli* cli, string_t args, void* context) {
|
||||
@ -68,7 +68,7 @@ void subghz_cli_command_rx_carrier(Cli* cli, string_t args, void* context) {
|
||||
cli_print_usage("subghz_tx_carrier", "<Frequency in HZ>", string_get_cstr(args));
|
||||
return;
|
||||
}
|
||||
if(!api_hal_subghz_is_frequency_valid(frequency)) {
|
||||
if(!furi_hal_subghz_is_frequency_valid(frequency)) {
|
||||
printf(
|
||||
"Frequency must be in " SUBGHZ_FREQUENCY_RANGE_STR " range, not %lu\r\n",
|
||||
frequency);
|
||||
@ -76,22 +76,22 @@ void subghz_cli_command_rx_carrier(Cli* cli, string_t args, void* context) {
|
||||
}
|
||||
}
|
||||
|
||||
api_hal_subghz_reset();
|
||||
api_hal_subghz_load_preset(ApiHalSubGhzPresetOokAsync);
|
||||
frequency = api_hal_subghz_set_frequency_and_path(frequency);
|
||||
furi_hal_subghz_reset();
|
||||
furi_hal_subghz_load_preset(FuriHalSubGhzPresetOokAsync);
|
||||
frequency = furi_hal_subghz_set_frequency_and_path(frequency);
|
||||
printf("Receiving at frequency %lu Hz\r\n", frequency);
|
||||
printf("Press CTRL+C to stop\r\n");
|
||||
|
||||
api_hal_subghz_rx();
|
||||
furi_hal_subghz_rx();
|
||||
|
||||
while(!cli_cmd_interrupt_received(cli)) {
|
||||
osDelay(250);
|
||||
printf("RSSI: %03.1fdbm\r", api_hal_subghz_get_rssi());
|
||||
printf("RSSI: %03.1fdbm\r", furi_hal_subghz_get_rssi());
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
api_hal_subghz_set_path(ApiHalSubGhzPathIsolate);
|
||||
api_hal_subghz_sleep();
|
||||
furi_hal_subghz_set_path(FuriHalSubGhzPathIsolate);
|
||||
furi_hal_subghz_sleep();
|
||||
}
|
||||
|
||||
#define SUBGHZ_PT_SHORT 376
|
||||
@ -118,7 +118,7 @@ void subghz_cli_command_tx(Cli* cli, string_t args, void* context) {
|
||||
string_get_cstr(args));
|
||||
return;
|
||||
}
|
||||
if(!api_hal_subghz_is_frequency_valid(frequency)) {
|
||||
if(!furi_hal_subghz_is_frequency_valid(frequency)) {
|
||||
printf(
|
||||
"Frequency must be in " SUBGHZ_FREQUENCY_RANGE_STR " range, not %lu\r\n",
|
||||
frequency);
|
||||
@ -151,16 +151,16 @@ void subghz_cli_command_tx(Cli* cli, string_t args, void* context) {
|
||||
key,
|
||||
repeat);
|
||||
|
||||
api_hal_subghz_reset();
|
||||
api_hal_subghz_load_preset(ApiHalSubGhzPresetOokAsync);
|
||||
frequency = api_hal_subghz_set_frequency_and_path(frequency);
|
||||
furi_hal_subghz_reset();
|
||||
furi_hal_subghz_load_preset(FuriHalSubGhzPresetOokAsync);
|
||||
frequency = furi_hal_subghz_set_frequency_and_path(frequency);
|
||||
|
||||
api_hal_subghz_start_async_tx(subghz_test_data, subghz_test_data_size, repeat);
|
||||
api_hal_subghz_wait_async_tx();
|
||||
api_hal_subghz_stop_async_tx();
|
||||
furi_hal_subghz_start_async_tx(subghz_test_data, subghz_test_data_size, repeat);
|
||||
furi_hal_subghz_wait_async_tx();
|
||||
furi_hal_subghz_stop_async_tx();
|
||||
|
||||
free(subghz_test_data);
|
||||
api_hal_subghz_sleep();
|
||||
furi_hal_subghz_sleep();
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
@ -200,7 +200,7 @@ void subghz_cli_command_rx(Cli* cli, string_t args, void* context) {
|
||||
cli_print_usage("subghz_rx", "<Frequency in HZ>", string_get_cstr(args));
|
||||
return;
|
||||
}
|
||||
if(!api_hal_subghz_is_frequency_valid(frequency)) {
|
||||
if(!furi_hal_subghz_is_frequency_valid(frequency)) {
|
||||
printf(
|
||||
"Frequency must be in " SUBGHZ_FREQUENCY_RANGE_STR " range, not %lu\r\n",
|
||||
frequency);
|
||||
@ -219,14 +219,14 @@ void subghz_cli_command_rx(Cli* cli, string_t args, void* context) {
|
||||
subghz_protocol_enable_dump_text(protocol, subghz_cli_command_rx_text_callback, instance);
|
||||
|
||||
// Configure radio
|
||||
api_hal_subghz_reset();
|
||||
api_hal_subghz_load_preset(ApiHalSubGhzPresetOokAsync);
|
||||
frequency = api_hal_subghz_set_frequency_and_path(frequency);
|
||||
furi_hal_subghz_reset();
|
||||
furi_hal_subghz_load_preset(FuriHalSubGhzPresetOokAsync);
|
||||
frequency = furi_hal_subghz_set_frequency_and_path(frequency);
|
||||
hal_gpio_init(&gpio_cc1101_g0, GpioModeInput, GpioPullNo, GpioSpeedLow);
|
||||
|
||||
// Prepare and start RX
|
||||
api_hal_subghz_set_async_rx_callback(subghz_cli_command_rx_callback, instance);
|
||||
api_hal_subghz_start_async_rx();
|
||||
furi_hal_subghz_set_async_rx_callback(subghz_cli_command_rx_callback, instance);
|
||||
furi_hal_subghz_start_async_rx();
|
||||
|
||||
// Wait for packets to arrive
|
||||
printf("Listening at %lu. Press CTRL+C to stop\r\n", frequency);
|
||||
@ -247,8 +247,8 @@ void subghz_cli_command_rx(Cli* cli, string_t args, void* context) {
|
||||
}
|
||||
|
||||
// Shutdown radio
|
||||
api_hal_subghz_stop_async_rx();
|
||||
api_hal_subghz_sleep();
|
||||
furi_hal_subghz_stop_async_rx();
|
||||
furi_hal_subghz_sleep();
|
||||
|
||||
printf("\r\nPackets recieved %u\r\n", instance->packet_count);
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "views/subghz_static.h"
|
||||
|
||||
#include <furi.h>
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal.h>
|
||||
#include <gui/gui.h>
|
||||
#include <gui/view_dispatcher.h>
|
||||
#include <gui/modules/submenu.h>
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include <math.h>
|
||||
#include <furi.h>
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal.h>
|
||||
#include <input/input.h>
|
||||
#include <gui/elements.h>
|
||||
#include <notification/notification-messages.h>
|
||||
@ -85,10 +85,10 @@ bool subghz_capture_input(InputEvent* event, void* context) {
|
||||
}
|
||||
|
||||
if(reconfigure) {
|
||||
api_hal_subghz_idle();
|
||||
furi_hal_subghz_idle();
|
||||
model->real_frequency =
|
||||
api_hal_subghz_set_frequency_and_path(subghz_frequencies[model->frequency]);
|
||||
api_hal_subghz_rx();
|
||||
furi_hal_subghz_set_frequency_and_path(subghz_frequencies[model->frequency]);
|
||||
furi_hal_subghz_rx();
|
||||
}
|
||||
|
||||
return reconfigure;
|
||||
@ -141,28 +141,28 @@ void subghz_capture_enter(void* context) {
|
||||
furi_assert(context);
|
||||
SubghzCapture* subghz_capture = context;
|
||||
|
||||
api_hal_subghz_reset();
|
||||
api_hal_subghz_idle();
|
||||
api_hal_subghz_load_preset(ApiHalSubGhzPresetOokAsync);
|
||||
furi_hal_subghz_reset();
|
||||
furi_hal_subghz_idle();
|
||||
furi_hal_subghz_load_preset(FuriHalSubGhzPresetOokAsync);
|
||||
|
||||
with_view_model(
|
||||
subghz_capture->view, (SubghzCaptureModel * model) {
|
||||
model->frequency = subghz_frequencies_433_92;
|
||||
model->real_frequency =
|
||||
api_hal_subghz_set_frequency_and_path(subghz_frequencies[model->frequency]);
|
||||
furi_hal_subghz_set_frequency_and_path(subghz_frequencies[model->frequency]);
|
||||
model->scene = 1;
|
||||
return true;
|
||||
});
|
||||
|
||||
hal_gpio_init(&gpio_cc1101_g0, GpioModeInput, GpioPullNo, GpioSpeedLow);
|
||||
|
||||
api_hal_subghz_set_async_rx_callback(subghz_worker_rx_callback, subghz_capture->worker);
|
||||
api_hal_subghz_start_async_rx();
|
||||
furi_hal_subghz_set_async_rx_callback(subghz_worker_rx_callback, subghz_capture->worker);
|
||||
furi_hal_subghz_start_async_rx();
|
||||
|
||||
subghz_worker_start(subghz_capture->worker);
|
||||
|
||||
api_hal_subghz_flush_rx();
|
||||
api_hal_subghz_rx();
|
||||
furi_hal_subghz_flush_rx();
|
||||
furi_hal_subghz_rx();
|
||||
}
|
||||
|
||||
void subghz_capture_exit(void* context) {
|
||||
@ -171,8 +171,8 @@ void subghz_capture_exit(void* context) {
|
||||
|
||||
subghz_worker_stop(subghz_capture->worker);
|
||||
|
||||
api_hal_subghz_stop_async_rx();
|
||||
api_hal_subghz_sleep();
|
||||
furi_hal_subghz_stop_async_rx();
|
||||
furi_hal_subghz_sleep();
|
||||
}
|
||||
|
||||
uint32_t subghz_capture_back(void* context) {
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include <math.h>
|
||||
#include <furi.h>
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal.h>
|
||||
#include <input/input.h>
|
||||
#include <notification/notification-messages.h>
|
||||
|
||||
@ -80,10 +80,10 @@ bool subghz_static_input(InputEvent* event, void* context) {
|
||||
}
|
||||
|
||||
if(reconfigure) {
|
||||
api_hal_subghz_idle();
|
||||
furi_hal_subghz_idle();
|
||||
model->real_frequency =
|
||||
api_hal_subghz_set_frequency_and_path(subghz_frequencies[model->frequency]);
|
||||
api_hal_subghz_tx();
|
||||
furi_hal_subghz_set_frequency_and_path(subghz_frequencies[model->frequency]);
|
||||
furi_hal_subghz_tx();
|
||||
}
|
||||
|
||||
if(event->key == InputKeyOk) {
|
||||
@ -128,8 +128,8 @@ void subghz_static_enter(void* context) {
|
||||
furi_assert(context);
|
||||
SubghzStatic* subghz_static = context;
|
||||
|
||||
api_hal_subghz_reset();
|
||||
api_hal_subghz_load_preset(ApiHalSubGhzPresetOokAsync);
|
||||
furi_hal_subghz_reset();
|
||||
furi_hal_subghz_load_preset(FuriHalSubGhzPresetOokAsync);
|
||||
|
||||
hal_gpio_init(&gpio_cc1101_g0, GpioModeOutputPushPull, GpioPullNo, GpioSpeedLow);
|
||||
hal_gpio_write(&gpio_cc1101_g0, false);
|
||||
@ -138,12 +138,12 @@ void subghz_static_enter(void* context) {
|
||||
subghz_static->view, (SubghzStaticModel * model) {
|
||||
model->frequency = subghz_frequencies_433_92;
|
||||
model->real_frequency =
|
||||
api_hal_subghz_set_frequency_and_path(subghz_frequencies[model->frequency]);
|
||||
furi_hal_subghz_set_frequency_and_path(subghz_frequencies[model->frequency]);
|
||||
model->button = 0;
|
||||
return true;
|
||||
});
|
||||
|
||||
api_hal_subghz_tx();
|
||||
furi_hal_subghz_tx();
|
||||
}
|
||||
|
||||
void subghz_static_exit(void* context) {
|
||||
@ -151,7 +151,7 @@ void subghz_static_exit(void* context) {
|
||||
// SubghzStatic* subghz_static = context;
|
||||
|
||||
// Reinitialize IC to default state
|
||||
api_hal_subghz_sleep();
|
||||
furi_hal_subghz_sleep();
|
||||
}
|
||||
|
||||
uint32_t subghz_static_back(void* context) {
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include <math.h>
|
||||
#include <furi.h>
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal.h>
|
||||
#include <input/input.h>
|
||||
|
||||
struct SubghzTestBasic {
|
||||
@ -19,7 +19,7 @@ typedef enum {
|
||||
typedef struct {
|
||||
uint8_t frequency;
|
||||
uint32_t real_frequency;
|
||||
ApiHalSubGhzPath path;
|
||||
FuriHalSubGhzPath path;
|
||||
float rssi;
|
||||
SubghzTestBasicModelStatus status;
|
||||
} SubghzTestBasicModel;
|
||||
@ -43,13 +43,13 @@ void subghz_test_basic_draw(Canvas* canvas, SubghzTestBasicModel* model) {
|
||||
canvas_draw_str(canvas, 0, 20, buffer);
|
||||
// Path
|
||||
char* path_name = "Unknown";
|
||||
if(model->path == ApiHalSubGhzPathIsolate) {
|
||||
if(model->path == FuriHalSubGhzPathIsolate) {
|
||||
path_name = "isolate";
|
||||
} else if(model->path == ApiHalSubGhzPath433) {
|
||||
} else if(model->path == FuriHalSubGhzPath433) {
|
||||
path_name = "433MHz";
|
||||
} else if(model->path == ApiHalSubGhzPath315) {
|
||||
} else if(model->path == FuriHalSubGhzPath315) {
|
||||
path_name = "315MHz";
|
||||
} else if(model->path == ApiHalSubGhzPath868) {
|
||||
} else if(model->path == FuriHalSubGhzPath868) {
|
||||
path_name = "868MHz";
|
||||
}
|
||||
snprintf(buffer, sizeof(buffer), "Path: %d - %s", model->path, path_name);
|
||||
@ -78,7 +78,7 @@ bool subghz_test_basic_input(InputEvent* event, void* context) {
|
||||
with_view_model(
|
||||
subghz_test_basic->view, (SubghzTestBasicModel * model) {
|
||||
osTimerStop(subghz_test_basic->timer);
|
||||
api_hal_subghz_idle();
|
||||
furi_hal_subghz_idle();
|
||||
|
||||
if(event->type == InputTypeShort) {
|
||||
if(event->key == InputKeyLeft) {
|
||||
@ -88,7 +88,7 @@ bool subghz_test_basic_input(InputEvent* event, void* context) {
|
||||
} else if(event->key == InputKeyDown) {
|
||||
if(model->path > 0) model->path--;
|
||||
} else if(event->key == InputKeyUp) {
|
||||
if(model->path < ApiHalSubGhzPath868) model->path++;
|
||||
if(model->path < FuriHalSubGhzPath868) model->path++;
|
||||
} else if(event->key == InputKeyOk) {
|
||||
if(model->status == SubghzTestBasicModelStatusTx) {
|
||||
model->status = SubghzTestBasicModelStatusRx;
|
||||
@ -98,18 +98,18 @@ bool subghz_test_basic_input(InputEvent* event, void* context) {
|
||||
}
|
||||
|
||||
model->real_frequency =
|
||||
api_hal_subghz_set_frequency(subghz_frequencies[model->frequency]);
|
||||
api_hal_subghz_set_path(model->path);
|
||||
furi_hal_subghz_set_frequency(subghz_frequencies[model->frequency]);
|
||||
furi_hal_subghz_set_path(model->path);
|
||||
}
|
||||
|
||||
if(model->status == SubghzTestBasicModelStatusRx) {
|
||||
hal_gpio_init(&gpio_cc1101_g0, GpioModeInput, GpioPullNo, GpioSpeedLow);
|
||||
api_hal_subghz_rx();
|
||||
furi_hal_subghz_rx();
|
||||
osTimerStart(subghz_test_basic->timer, 1024 / 4);
|
||||
} else {
|
||||
hal_gpio_init(&gpio_cc1101_g0, GpioModeOutputPushPull, GpioPullNo, GpioSpeedLow);
|
||||
hal_gpio_write(&gpio_cc1101_g0, true);
|
||||
api_hal_subghz_tx();
|
||||
furi_hal_subghz_tx();
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -122,8 +122,8 @@ void subghz_test_basic_enter(void* context) {
|
||||
furi_assert(context);
|
||||
SubghzTestBasic* subghz_test_basic = context;
|
||||
|
||||
api_hal_subghz_reset();
|
||||
api_hal_subghz_load_preset(ApiHalSubGhzPresetOokAsync);
|
||||
furi_hal_subghz_reset();
|
||||
furi_hal_subghz_load_preset(FuriHalSubGhzPresetOokAsync);
|
||||
|
||||
hal_gpio_init(&gpio_cc1101_g0, GpioModeInput, GpioPullNo, GpioSpeedLow);
|
||||
|
||||
@ -131,14 +131,14 @@ void subghz_test_basic_enter(void* context) {
|
||||
subghz_test_basic->view, (SubghzTestBasicModel * model) {
|
||||
model->frequency = subghz_frequencies_433_92; // 433
|
||||
model->real_frequency =
|
||||
api_hal_subghz_set_frequency(subghz_frequencies[model->frequency]);
|
||||
model->path = ApiHalSubGhzPathIsolate; // isolate
|
||||
furi_hal_subghz_set_frequency(subghz_frequencies[model->frequency]);
|
||||
model->path = FuriHalSubGhzPathIsolate; // isolate
|
||||
model->rssi = 0.0f;
|
||||
model->status = SubghzTestBasicModelStatusRx;
|
||||
return true;
|
||||
});
|
||||
|
||||
api_hal_subghz_rx();
|
||||
furi_hal_subghz_rx();
|
||||
|
||||
osTimerStart(subghz_test_basic->timer, 1024 / 4);
|
||||
}
|
||||
@ -150,7 +150,7 @@ void subghz_test_basic_exit(void* context) {
|
||||
osTimerStop(subghz_test_basic->timer);
|
||||
|
||||
// Reinitialize IC to default state
|
||||
api_hal_subghz_sleep();
|
||||
furi_hal_subghz_sleep();
|
||||
}
|
||||
|
||||
void subghz_test_basic_rssi_timer_callback(void* context) {
|
||||
@ -159,7 +159,7 @@ void subghz_test_basic_rssi_timer_callback(void* context) {
|
||||
|
||||
with_view_model(
|
||||
subghz_test_basic->view, (SubghzTestBasicModel * model) {
|
||||
model->rssi = api_hal_subghz_get_rssi();
|
||||
model->rssi = furi_hal_subghz_get_rssi();
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include <math.h>
|
||||
#include <furi.h>
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal.h>
|
||||
#include <input/input.h>
|
||||
#include <toolbox/level_duration.h>
|
||||
#include <lib/subghz/protocols/subghz_protocol_princeton.h>
|
||||
@ -32,7 +32,7 @@ typedef enum {
|
||||
typedef struct {
|
||||
uint8_t frequency;
|
||||
uint32_t real_frequency;
|
||||
ApiHalSubGhzPath path;
|
||||
FuriHalSubGhzPath path;
|
||||
float rssi;
|
||||
size_t packets;
|
||||
SubghzTestPacketModelStatus status;
|
||||
@ -59,11 +59,11 @@ static void subghz_test_packet_rssi_timer_callback(void* context) {
|
||||
with_view_model(
|
||||
instance->view, (SubghzTestPacketModel * model) {
|
||||
if(model->status == SubghzTestPacketModelStatusRx) {
|
||||
model->rssi = api_hal_subghz_get_rssi();
|
||||
model->rssi = furi_hal_subghz_get_rssi();
|
||||
model->packets = instance->packet_rx;
|
||||
} else {
|
||||
model->packets =
|
||||
SUBGHZ_TEST_PACKET_COUNT - api_hal_subghz_get_async_tx_repeat_left();
|
||||
SUBGHZ_TEST_PACKET_COUNT - furi_hal_subghz_get_async_tx_repeat_left();
|
||||
}
|
||||
return true;
|
||||
});
|
||||
@ -88,13 +88,13 @@ static void subghz_test_packet_draw(Canvas* canvas, SubghzTestPacketModel* model
|
||||
canvas_draw_str(canvas, 0, 20, buffer);
|
||||
// Path
|
||||
char* path_name = "Unknown";
|
||||
if(model->path == ApiHalSubGhzPathIsolate) {
|
||||
if(model->path == FuriHalSubGhzPathIsolate) {
|
||||
path_name = "isolate";
|
||||
} else if(model->path == ApiHalSubGhzPath433) {
|
||||
} else if(model->path == FuriHalSubGhzPath433) {
|
||||
path_name = "433MHz";
|
||||
} else if(model->path == ApiHalSubGhzPath315) {
|
||||
} else if(model->path == FuriHalSubGhzPath315) {
|
||||
path_name = "315MHz";
|
||||
} else if(model->path == ApiHalSubGhzPath868) {
|
||||
} else if(model->path == FuriHalSubGhzPath868) {
|
||||
path_name = "868MHz";
|
||||
}
|
||||
snprintf(buffer, sizeof(buffer), "Path: %d - %s", model->path, path_name);
|
||||
@ -127,9 +127,9 @@ static bool subghz_test_packet_input(InputEvent* event, void* context) {
|
||||
with_view_model(
|
||||
instance->view, (SubghzTestPacketModel * model) {
|
||||
if(model->status == SubghzTestPacketModelStatusRx) {
|
||||
api_hal_subghz_stop_async_rx();
|
||||
furi_hal_subghz_stop_async_rx();
|
||||
} else {
|
||||
api_hal_subghz_stop_async_tx();
|
||||
furi_hal_subghz_stop_async_tx();
|
||||
}
|
||||
|
||||
if(event->type == InputTypeShort) {
|
||||
@ -140,7 +140,7 @@ static bool subghz_test_packet_input(InputEvent* event, void* context) {
|
||||
} else if(event->key == InputKeyDown) {
|
||||
if(model->path > 0) model->path--;
|
||||
} else if(event->key == InputKeyUp) {
|
||||
if(model->path < ApiHalSubGhzPath868) model->path++;
|
||||
if(model->path < FuriHalSubGhzPath868) model->path++;
|
||||
} else if(event->key == InputKeyOk) {
|
||||
if(model->status == SubghzTestPacketModelStatusTx) {
|
||||
model->status = SubghzTestPacketModelStatusRx;
|
||||
@ -150,14 +150,14 @@ static bool subghz_test_packet_input(InputEvent* event, void* context) {
|
||||
}
|
||||
|
||||
model->real_frequency =
|
||||
api_hal_subghz_set_frequency(subghz_frequencies[model->frequency]);
|
||||
api_hal_subghz_set_path(model->path);
|
||||
furi_hal_subghz_set_frequency(subghz_frequencies[model->frequency]);
|
||||
furi_hal_subghz_set_path(model->path);
|
||||
}
|
||||
|
||||
if(model->status == SubghzTestPacketModelStatusRx) {
|
||||
api_hal_subghz_start_async_rx();
|
||||
furi_hal_subghz_start_async_rx();
|
||||
} else {
|
||||
api_hal_subghz_start_async_tx(
|
||||
furi_hal_subghz_start_async_tx(
|
||||
instance->tx_buffer, instance->tx_buffer_size, SUBGHZ_TEST_PACKET_COUNT);
|
||||
}
|
||||
|
||||
@ -192,22 +192,22 @@ void subghz_test_packet_enter(void* context) {
|
||||
instance->tx_buffer[pos++] = SUBGHZ_PT_SHORT;
|
||||
instance->tx_buffer[pos++] = SUBGHZ_PT_SHORT + SUBGHZ_PT_GUARD;
|
||||
|
||||
api_hal_subghz_reset();
|
||||
api_hal_subghz_load_preset(ApiHalSubGhzPresetOokAsync);
|
||||
api_hal_subghz_set_async_rx_callback(subghz_test_packet_rx_callback, instance);
|
||||
furi_hal_subghz_reset();
|
||||
furi_hal_subghz_load_preset(FuriHalSubGhzPresetOokAsync);
|
||||
furi_hal_subghz_set_async_rx_callback(subghz_test_packet_rx_callback, instance);
|
||||
|
||||
with_view_model(
|
||||
instance->view, (SubghzTestPacketModel * model) {
|
||||
model->frequency = subghz_frequencies_433_92;
|
||||
model->real_frequency =
|
||||
api_hal_subghz_set_frequency(subghz_frequencies[model->frequency]);
|
||||
model->path = ApiHalSubGhzPathIsolate; // isolate
|
||||
furi_hal_subghz_set_frequency(subghz_frequencies[model->frequency]);
|
||||
model->path = FuriHalSubGhzPathIsolate; // isolate
|
||||
model->rssi = 0.0f;
|
||||
model->status = SubghzTestPacketModelStatusRx;
|
||||
return true;
|
||||
});
|
||||
|
||||
api_hal_subghz_start_async_rx();
|
||||
furi_hal_subghz_start_async_rx();
|
||||
|
||||
osTimerStart(instance->timer, 1024 / 4);
|
||||
}
|
||||
@ -222,14 +222,14 @@ void subghz_test_packet_exit(void* context) {
|
||||
with_view_model(
|
||||
instance->view, (SubghzTestPacketModel * model) {
|
||||
if(model->status == SubghzTestPacketModelStatusRx) {
|
||||
api_hal_subghz_stop_async_rx();
|
||||
furi_hal_subghz_stop_async_rx();
|
||||
} else {
|
||||
api_hal_subghz_stop_async_tx();
|
||||
furi_hal_subghz_stop_async_tx();
|
||||
}
|
||||
return true;
|
||||
});
|
||||
api_hal_subghz_set_async_rx_callback(NULL, NULL);
|
||||
api_hal_subghz_sleep();
|
||||
furi_hal_subghz_set_async_rx_callback(NULL, NULL);
|
||||
furi_hal_subghz_sleep();
|
||||
}
|
||||
|
||||
uint32_t subghz_test_packet_back(void* context) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <furi.h>
|
||||
#include "api-hal-delay.h"
|
||||
#include "furi-hal-delay.h"
|
||||
|
||||
#include "minunit.h"
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include <stdio.h>
|
||||
#include <furi.h>
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal.h>
|
||||
#include "minunit_vars.h"
|
||||
#include <notification/notification-messages.h>
|
||||
|
||||
|
@ -3,7 +3,7 @@ PROJECT = bootloader
|
||||
|
||||
include $(PROJECT_ROOT)/make/base.mk
|
||||
|
||||
CFLAGS += -I$(PROJECT_ROOT) -Itargets/api-hal-include
|
||||
CFLAGS += -I$(PROJECT_ROOT) -Itargets/furi-hal-include
|
||||
ASM_SOURCES += $(wildcard src/*.s)
|
||||
C_SOURCES += $(wildcard src/*.c)
|
||||
CPP_SOURCES += $(wildcard src/*.cpp)
|
||||
|
@ -1,6 +0,0 @@
|
||||
#include <api-hal.h>
|
||||
|
||||
void api_hal_init() {
|
||||
api_hal_i2c_init();
|
||||
api_hal_light_init();
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <api-hal-i2c.h>
|
||||
#include <api-hal-light.h>
|
||||
|
||||
void api_hal_init();
|
@ -1,4 +1,4 @@
|
||||
#include <api-hal-i2c.h>
|
||||
#include <furi-hal-i2c.h>
|
||||
|
||||
#include <stm32wbxx_ll_bus.h>
|
||||
#include <stm32wbxx_ll_i2c.h>
|
||||
@ -6,7 +6,7 @@
|
||||
#include <stm32wbxx_ll_gpio.h>
|
||||
#include <stm32wbxx_ll_cortex.h>
|
||||
|
||||
void api_hal_i2c_init() {
|
||||
void furi_hal_i2c_init() {
|
||||
LL_I2C_InitTypeDef I2C_InitStruct = {0};
|
||||
LL_GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||
|
||||
@ -38,7 +38,7 @@ void api_hal_i2c_init() {
|
||||
LL_I2C_EnableClockStretching(I2C1);
|
||||
}
|
||||
|
||||
bool api_hal_i2c_tx(
|
||||
bool furi_hal_i2c_tx(
|
||||
I2C_TypeDef* instance,
|
||||
uint8_t address,
|
||||
const uint8_t* data,
|
||||
@ -79,7 +79,7 @@ bool api_hal_i2c_tx(
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool api_hal_i2c_rx(
|
||||
bool furi_hal_i2c_rx(
|
||||
I2C_TypeDef* instance,
|
||||
uint8_t address,
|
||||
uint8_t* data,
|
||||
@ -120,7 +120,7 @@ bool api_hal_i2c_rx(
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool api_hal_i2c_trx(
|
||||
bool furi_hal_i2c_trx(
|
||||
I2C_TypeDef* instance,
|
||||
uint8_t address,
|
||||
const uint8_t* tx_data,
|
||||
@ -128,8 +128,8 @@ bool api_hal_i2c_trx(
|
||||
uint8_t* rx_data,
|
||||
uint8_t rx_size,
|
||||
uint32_t timeout) {
|
||||
if(api_hal_i2c_tx(instance, address, tx_data, tx_size, timeout) &&
|
||||
api_hal_i2c_rx(instance, address, rx_data, rx_size, timeout)) {
|
||||
if(furi_hal_i2c_tx(instance, address, tx_data, tx_size, timeout) &&
|
||||
furi_hal_i2c_rx(instance, address, rx_data, rx_size, timeout)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
@ -2,29 +2,29 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <api-hal-resources.h>
|
||||
#include <furi-hal-resources.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void api_hal_i2c_init();
|
||||
void furi_hal_i2c_init();
|
||||
|
||||
bool api_hal_i2c_tx(
|
||||
bool furi_hal_i2c_tx(
|
||||
I2C_TypeDef* instance,
|
||||
const uint8_t address,
|
||||
const uint8_t* data,
|
||||
const uint8_t size,
|
||||
uint32_t timeout);
|
||||
|
||||
bool api_hal_i2c_rx(
|
||||
bool furi_hal_i2c_rx(
|
||||
I2C_TypeDef* instance,
|
||||
const uint8_t address,
|
||||
uint8_t* data,
|
||||
const uint8_t size,
|
||||
uint32_t timeout);
|
||||
|
||||
bool api_hal_i2c_trx(
|
||||
bool furi_hal_i2c_trx(
|
||||
I2C_TypeDef* instance,
|
||||
const uint8_t address,
|
||||
const uint8_t* tx_data,
|
||||
@ -33,7 +33,7 @@ bool api_hal_i2c_trx(
|
||||
const uint8_t rx_size,
|
||||
uint32_t timeout);
|
||||
|
||||
#define with_api_hal_i2c(type, pointer, function_body) \
|
||||
#define with_furi_hal_i2c(type, pointer, function_body) \
|
||||
{ \
|
||||
*pointer = ({ type __fn__ function_body __fn__; })(); \
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
#include <api-hal-light.h>
|
||||
#include <furi-hal-light.h>
|
||||
#include <lp5562.h>
|
||||
|
||||
#define LED_CURRENT_RED 50
|
||||
@ -6,7 +6,7 @@
|
||||
#define LED_CURRENT_BLUE 50
|
||||
#define LED_CURRENT_WHITE 150
|
||||
|
||||
void api_hal_light_init() {
|
||||
void furi_hal_light_init() {
|
||||
lp5562_reset();
|
||||
|
||||
lp5562_set_channel_current(LP5562ChannelRed, LED_CURRENT_RED);
|
||||
@ -23,7 +23,7 @@ void api_hal_light_init() {
|
||||
lp5562_configure();
|
||||
}
|
||||
|
||||
void api_hal_light_set(Light light, uint8_t value) {
|
||||
void furi_hal_light_set(Light light, uint8_t value) {
|
||||
switch(light) {
|
||||
case LightRed:
|
||||
lp5562_set_channel_value(LP5562ChannelRed, value);
|
@ -2,15 +2,15 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <api-hal-resources.h>
|
||||
#include <furi-hal-resources.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void api_hal_light_init();
|
||||
void furi_hal_light_init();
|
||||
|
||||
void api_hal_light_set(Light light, uint8_t value);
|
||||
void furi_hal_light_set(Light light, uint8_t value);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
6
bootloader/targets/f6/furi-hal/furi-hal.c
Normal file
6
bootloader/targets/f6/furi-hal/furi-hal.c
Normal file
@ -0,0 +1,6 @@
|
||||
#include <furi-hal.h>
|
||||
|
||||
void furi_hal_init() {
|
||||
furi_hal_i2c_init();
|
||||
furi_hal_light_init();
|
||||
}
|
6
bootloader/targets/f6/furi-hal/furi-hal.h
Normal file
6
bootloader/targets/f6/furi-hal/furi-hal.h
Normal file
@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <furi-hal-i2c.h>
|
||||
#include <furi-hal-light.h>
|
||||
|
||||
void furi_hal_init();
|
@ -10,7 +10,7 @@
|
||||
#include <stm32wbxx_hal_flash.h>
|
||||
|
||||
#include <lib/toolbox/version.h>
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal.h>
|
||||
|
||||
// Boot request enum
|
||||
#define BOOT_REQUEST_TAINTED 0x00000000
|
||||
@ -28,32 +28,32 @@
|
||||
#define RTC_CLOCK_IS_READY() (LL_RCC_LSE_IsReady() && LL_RCC_LSI1_IsReady())
|
||||
|
||||
void target_led_control(char* c) {
|
||||
api_hal_light_set(LightRed, 0x00);
|
||||
api_hal_light_set(LightGreen, 0x00);
|
||||
api_hal_light_set(LightBlue, 0x00);
|
||||
furi_hal_light_set(LightRed, 0x00);
|
||||
furi_hal_light_set(LightGreen, 0x00);
|
||||
furi_hal_light_set(LightBlue, 0x00);
|
||||
do {
|
||||
if(*c == 'R') {
|
||||
api_hal_light_set(LightRed, 0xFF);
|
||||
furi_hal_light_set(LightRed, 0xFF);
|
||||
} else if(*c == 'G') {
|
||||
api_hal_light_set(LightGreen, 0xFF);
|
||||
furi_hal_light_set(LightGreen, 0xFF);
|
||||
} else if(*c == 'B') {
|
||||
api_hal_light_set(LightBlue, 0xFF);
|
||||
furi_hal_light_set(LightBlue, 0xFF);
|
||||
} else if(*c == '.') {
|
||||
LL_mDelay(125);
|
||||
api_hal_light_set(LightRed, 0x00);
|
||||
api_hal_light_set(LightGreen, 0x00);
|
||||
api_hal_light_set(LightBlue, 0x00);
|
||||
furi_hal_light_set(LightRed, 0x00);
|
||||
furi_hal_light_set(LightGreen, 0x00);
|
||||
furi_hal_light_set(LightBlue, 0x00);
|
||||
LL_mDelay(125);
|
||||
} else if(*c == '-') {
|
||||
LL_mDelay(250);
|
||||
api_hal_light_set(LightRed, 0x00);
|
||||
api_hal_light_set(LightGreen, 0x00);
|
||||
api_hal_light_set(LightBlue, 0x00);
|
||||
furi_hal_light_set(LightRed, 0x00);
|
||||
furi_hal_light_set(LightGreen, 0x00);
|
||||
furi_hal_light_set(LightBlue, 0x00);
|
||||
LL_mDelay(250);
|
||||
} else if(*c == '|') {
|
||||
api_hal_light_set(LightRed, 0x00);
|
||||
api_hal_light_set(LightGreen, 0x00);
|
||||
api_hal_light_set(LightBlue, 0x00);
|
||||
furi_hal_light_set(LightRed, 0x00);
|
||||
furi_hal_light_set(LightGreen, 0x00);
|
||||
furi_hal_light_set(LightBlue, 0x00);
|
||||
}
|
||||
c++;
|
||||
} while(*c != 0);
|
||||
@ -125,7 +125,7 @@ void usb_wire_reset() {
|
||||
void target_init() {
|
||||
clock_init();
|
||||
gpio_init();
|
||||
api_hal_init();
|
||||
furi_hal_init();
|
||||
target_led_control("RGB");
|
||||
rtc_init();
|
||||
version_save();
|
||||
|
@ -34,8 +34,8 @@ CFLAGS += -I$(DRIVERS_DIR)
|
||||
C_SOURCES += $(DRIVERS_DIR)/lp5562.c
|
||||
|
||||
# API-HAL
|
||||
CFLAGS += -I$(TARGET_DIR)/api-hal
|
||||
C_SOURCES += $(wildcard $(TARGET_DIR)/api-hal/*.c)
|
||||
CFLAGS += -I$(TARGET_DIR)/furi-hal
|
||||
C_SOURCES += $(wildcard $(TARGET_DIR)/furi-hal/*.c)
|
||||
|
||||
# Version generation
|
||||
C_SOURCES += $(PROJECT_ROOT)/lib/toolbox/version.c
|
||||
|
@ -4,5 +4,5 @@ CFLAGS += -I$(CORE_DIR) -D_GNU_SOURCE
|
||||
ASM_SOURCES += $(wildcard $(CORE_DIR)/*.s)
|
||||
C_SOURCES += $(wildcard $(CORE_DIR)/*.c)
|
||||
C_SOURCES += $(wildcard $(CORE_DIR)/furi/*.c)
|
||||
C_SOURCES += $(wildcard $(CORE_DIR)/api-hal/*.c)
|
||||
C_SOURCES += $(wildcard $(CORE_DIR)/furi-hal/*.c)
|
||||
CPP_SOURCES += $(wildcard $(CORE_DIR)/*.cpp)
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "flipper.h"
|
||||
#include <applications.h>
|
||||
#include <furi.h>
|
||||
#include <api-hal-version.h>
|
||||
#include <furi-hal-version.h>
|
||||
|
||||
static void flipper_print_version(const char* target, const Version* version) {
|
||||
if(version) {
|
||||
@ -25,10 +25,10 @@ static void flipper_print_version(const char* target, const Version* version) {
|
||||
void flipper_init() {
|
||||
const Version* version;
|
||||
|
||||
version = (const Version*)api_hal_version_get_boot_version();
|
||||
version = (const Version*)furi_hal_version_get_boot_version();
|
||||
flipper_print_version("Bootloader", version);
|
||||
|
||||
version = (const Version*)api_hal_version_get_firmware_version();
|
||||
version = (const Version*)furi_hal_version_get_firmware_version();
|
||||
flipper_print_version("Firmware", version);
|
||||
|
||||
FURI_LOG_I("FLIPPER", "starting services");
|
||||
|
@ -13,8 +13,8 @@
|
||||
#include <furi/valuemutex.h>
|
||||
#include <furi/log.h>
|
||||
|
||||
#include <api-hal-gpio.h>
|
||||
#include <api-hal/api-interrupt-mgr.h>
|
||||
#include <furi-hal-gpio.h>
|
||||
#include <furi-hal/api-interrupt-mgr.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "check.h"
|
||||
#include "api-hal-task.h"
|
||||
#include "furi-hal-task.h"
|
||||
#include <stdio.h>
|
||||
|
||||
void __furi_abort(void);
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include "check.h"
|
||||
#include "memmgr.h"
|
||||
|
||||
#include <api-hal.h>
|
||||
#include <furi-hal.h>
|
||||
#include <m-dict.h>
|
||||
|
||||
DICT_DEF2(
|
||||
@ -58,7 +58,7 @@ static ssize_t stdout_write(void* _cookie, const char* data, size_t size) {
|
||||
return 0;
|
||||
}
|
||||
// Debug uart
|
||||
if(!consumed) api_hal_console_tx((const uint8_t*)data, size);
|
||||
if(!consumed) furi_hal_console_tx((const uint8_t*)data, size);
|
||||
// All data consumed
|
||||
return size;
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ include $(PROJECT_ROOT)/core/core.mk
|
||||
include $(PROJECT_ROOT)/applications/applications.mk
|
||||
include $(PROJECT_ROOT)/lib/lib.mk
|
||||
|
||||
CFLAGS += -I$(PROJECT_ROOT) -Itargets/api-hal-include
|
||||
CFLAGS += -I$(PROJECT_ROOT) -Itargets/furi-hal-include
|
||||
CFLAGS += -Werror -Wno-address-of-packed-member
|
||||
CPPFLAGS += -Werror
|
||||
|
||||
|
@ -31,7 +31,7 @@ You can find platform code for STM32WB55 version in `f4` folder:
|
||||
```
|
||||
├── Inc # CubeMX generated headers
|
||||
├── Src # CubeMX generated code
|
||||
├── api-hal # Our HAL wrappers and platform specifics
|
||||
├── furi-hal # Our HAL wrappers and platform specifics
|
||||
├── ble-glue # BLE specific code(Glue for STMWPAN)
|
||||
├── f4.ioc # CubeMX project file
|
||||
├── startup_stm32wb55xx_cm4.s # Board startup/initialization assembler code
|
||||
@ -46,7 +46,7 @@ Working with CubeMX:
|
||||
3. Do whatever you want to
|
||||
3. Click `generate code`
|
||||
4. After regenerating, look at git status, regeneration may brake some files.
|
||||
5. Check one more time that things that you've changes are not covered in platform api-hal. Because you know...
|
||||
5. Check one more time that things that you've changes are not covered in platform furi-hal. Because you know...
|
||||
|
||||
# Flipper Universal Registry Implementation (FURI)
|
||||
|
||||
|
@ -1,34 +0,0 @@
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** Boot modes */
|
||||
typedef enum {
|
||||
ApiHalBootModeNormal,
|
||||
ApiHalBootModeDFU
|
||||
} ApiHalBootMode;
|
||||
|
||||
/** Boot flags */
|
||||
typedef enum {
|
||||
ApiHalBootFlagDefault=0,
|
||||
ApiHalBootFlagFactoryReset=1,
|
||||
} ApiHalBootFlag;
|
||||
|
||||
/** Initialize boot subsystem */
|
||||
void api_hal_boot_init();
|
||||
|
||||
/** Set boot mode */
|
||||
void api_hal_boot_set_mode(ApiHalBootMode mode);
|
||||
|
||||
/** Set boot flags */
|
||||
void api_hal_boot_set_flags(ApiHalBootFlag flags);
|
||||
|
||||
/** Get boot flag */
|
||||
ApiHalBootFlag api_hal_boot_get_flags();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -1,20 +0,0 @@
|
||||
#pragma once
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void api_hal_ibutton_start();
|
||||
|
||||
void api_hal_ibutton_stop();
|
||||
|
||||
void api_hal_ibutton_pin_low();
|
||||
|
||||
void api_hal_ibutton_pin_high();
|
||||
|
||||
bool api_hal_ibutton_pin_get_level();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -1,66 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <rfal_nfc.h>
|
||||
#include <st_errno.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define API_HAL_NFC_UID_MAX_LEN 10
|
||||
|
||||
/**
|
||||
* Init nfc
|
||||
*/
|
||||
void api_hal_nfc_init();
|
||||
|
||||
/**
|
||||
* Check if nfc worker is busy
|
||||
*/
|
||||
bool api_hal_nfc_is_busy();
|
||||
|
||||
/**
|
||||
* NFC field on
|
||||
*/
|
||||
void api_hal_nfc_field_on();
|
||||
|
||||
/**
|
||||
* NFC field off
|
||||
*/
|
||||
void api_hal_nfc_field_off();
|
||||
|
||||
/**
|
||||
* NFC start sleep
|
||||
*/
|
||||
void api_hal_nfc_start_sleep();
|
||||
|
||||
/**
|
||||
* NFC stop sleep
|
||||
*/
|
||||
void api_hal_nfc_exit_sleep();
|
||||
|
||||
/**
|
||||
* NFC poll
|
||||
*/
|
||||
bool api_hal_nfc_detect(rfalNfcDevice** dev_list, uint8_t* dev_cnt, uint32_t timeout, bool deactivate);
|
||||
|
||||
/**
|
||||
* NFC listen
|
||||
*/
|
||||
bool api_hal_nfc_listen(uint8_t* uid, uint8_t uid_len, uint8_t* atqa, uint8_t sak, uint32_t timeout);
|
||||
|
||||
/**
|
||||
* NFC data exchange
|
||||
*/
|
||||
ReturnCode api_hal_nfc_data_exchange(uint8_t* tx_buff, uint16_t tx_len, uint8_t** rx_buff, uint16_t** rx_len, bool deactivate);
|
||||
|
||||
/**
|
||||
* NFC deactivate and start sleep
|
||||
*/
|
||||
void api_hal_nfc_deactivate();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -1,90 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <lib/toolbox/version.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** Device Colors */
|
||||
typedef enum {
|
||||
ApiHalVersionColorUnknown=0x00,
|
||||
ApiHalVersionColorBlack=0x01,
|
||||
ApiHalVersionColorWhite=0x02,
|
||||
} ApiHalVersionColor;
|
||||
|
||||
/** Device Regions */
|
||||
typedef enum {
|
||||
ApiHalVersionRegionUnknown=0x00,
|
||||
ApiHalVersionRegionEuRu=0x01,
|
||||
ApiHalVersionRegionUsCaAu=0x02,
|
||||
ApiHalVersionRegionJp=0x03,
|
||||
} ApiHalVersionRegion;
|
||||
|
||||
/** Init flipper version */
|
||||
void api_hal_version_init();
|
||||
|
||||
/** Check target firmware version */
|
||||
bool api_hal_version_do_i_belong_here();
|
||||
|
||||
/** Get model name */
|
||||
const char* api_hal_version_get_model_name();
|
||||
|
||||
/** Get hardware version */
|
||||
const uint8_t api_hal_version_get_hw_version();
|
||||
|
||||
/** Get hardware target */
|
||||
const uint8_t api_hal_version_get_hw_target();
|
||||
|
||||
/** Get hardware body */
|
||||
const uint8_t api_hal_version_get_hw_body();
|
||||
|
||||
/** Get hardware body color */
|
||||
const ApiHalVersionColor api_hal_version_get_hw_color();
|
||||
|
||||
/** Get hardware connect */
|
||||
const uint8_t api_hal_version_get_hw_connect();
|
||||
|
||||
/** Get hardware region */
|
||||
const ApiHalVersionRegion api_hal_version_get_hw_region();
|
||||
|
||||
/** Get hardware timestamp */
|
||||
const uint32_t api_hal_version_get_hw_timestamp();
|
||||
|
||||
/** Get pointer to target name */
|
||||
const char* api_hal_version_get_name_ptr();
|
||||
|
||||
/** Get pointer to target device name */
|
||||
const char* api_hal_version_get_device_name_ptr();
|
||||
|
||||
/** Get pointer to target ble local device name */
|
||||
const char* api_hal_version_get_ble_local_device_name_ptr();
|
||||
|
||||
const uint8_t* api_hal_version_get_ble_mac();
|
||||
|
||||
/**
|
||||
* Get address of version structure of bootloader, stored in chip flash.
|
||||
*
|
||||
* @return Address of boot version structure.
|
||||
*/
|
||||
const struct Version* api_hal_version_get_boot_version(void);
|
||||
|
||||
/**
|
||||
* Get address of version structure of firmware.
|
||||
*
|
||||
* @return Address of firmware version structure.
|
||||
*/
|
||||
const struct Version* api_hal_version_get_firmware_version(void);
|
||||
|
||||
/** Get platform UID size in bytes */
|
||||
size_t api_hal_version_uid_size();
|
||||
|
||||
/** Get const pointer to UID */
|
||||
const uint8_t* api_hal_version_uid();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -1,32 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
template <unsigned int N> struct STOP_EXTERNING_ME {};
|
||||
#endif
|
||||
|
||||
#include "api-hal-boot.h"
|
||||
#include "api-hal-clock.h"
|
||||
#include "api-hal-console.h"
|
||||
#include "api-hal-os.h"
|
||||
#include "api-hal-i2c.h"
|
||||
#include "api-hal-resources.h"
|
||||
#include "api-hal-gpio.h"
|
||||
#include "api-hal-light.h"
|
||||
#include "api-hal-delay.h"
|
||||
#include "api-hal-pwm.h"
|
||||
#include "api-hal-task.h"
|
||||
#include "api-hal-power.h"
|
||||
#include "api-hal-vcp.h"
|
||||
#include "api-hal-interrupt.h"
|
||||
#include "api-hal-version.h"
|
||||
#include "api-hal-bt.h"
|
||||
#include "api-hal-spi.h"
|
||||
#include "api-hal-flash.h"
|
||||
#include "api-hal-subghz.h"
|
||||
#include "api-hal-vibro.h"
|
||||
#include "api-hal-ibutton.h"
|
||||
#include "api-hal-rfid.h"
|
||||
#include "api-hal-nfc.h"
|
||||
|
||||
/** Init api-hal */
|
||||
void api_hal_init();
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user