Merge branch 'dev' of https://github.com/ClaraCrazy/Flipper-Xtreme into fix-bad_kb_bt-flipper_app-conflict

This commit is contained in:
Willy-JL
2023-02-28 21:24:18 +00:00
226 changed files with 2963 additions and 4547 deletions
+12 -5
View File
@@ -1,5 +1,5 @@
entry,status,name,type,params
Version,+,12.1,,
Version,+,15.0,,
Header,+,applications/services/bt/bt_service/bt.h,,
Header,+,applications/services/cli/cli.h,,
Header,+,applications/services/cli/cli_vcp.h,,
@@ -546,6 +546,7 @@ Function,+,canvas_invert_color,void,Canvas*
Function,+,canvas_reset,void,Canvas*
Function,+,canvas_set_bitmap_mode,void,"Canvas*, _Bool"
Function,+,canvas_set_color,void,"Canvas*, Color"
Function,+,canvas_set_custom_u8g2_font,void,"Canvas*, const uint8_t*"
Function,+,canvas_set_font,void,"Canvas*, Font"
Function,+,canvas_set_font_direction,void,"Canvas*, CanvasDirection"
Function,+,canvas_string_width,uint16_t,"Canvas*, const char*"
@@ -978,7 +979,7 @@ Function,+,furi_hal_power_enable_external_3_3v,void,
Function,+,furi_hal_power_enable_otg,void,
Function,+,furi_hal_power_gauge_is_ok,_Bool,
Function,+,furi_hal_power_get_bat_health_pct,uint8_t,
Function,+,furi_hal_power_get_battery_charging_voltage,float,
Function,+,furi_hal_power_get_battery_charge_voltage_limit,float,
Function,+,furi_hal_power_get_battery_current,float,FuriHalPowerIC
Function,+,furi_hal_power_get_battery_design_capacity,uint32_t,
Function,+,furi_hal_power_get_battery_full_capacity,uint32_t,
@@ -997,7 +998,7 @@ Function,+,furi_hal_power_is_charging_done,_Bool,
Function,+,furi_hal_power_is_otg_enabled,_Bool,
Function,+,furi_hal_power_off,void,
Function,+,furi_hal_power_reset,void,
Function,+,furi_hal_power_set_battery_charging_voltage,void,float
Function,+,furi_hal_power_set_battery_charge_voltage_limit,void,float
Function,+,furi_hal_power_shutdown,void,
Function,+,furi_hal_power_sleep,void,
Function,+,furi_hal_power_sleep_available,_Bool,
@@ -1016,6 +1017,7 @@ Function,+,furi_hal_region_is_frequency_allowed,_Bool,uint32_t
Function,+,furi_hal_region_is_provisioned,_Bool,
Function,+,furi_hal_region_set,void,FuriHalRegion*
Function,-,furi_hal_resources_deinit_early,void,
Function,+,furi_hal_resources_get_ext_pin_number,int32_t,const GpioPin*
Function,-,furi_hal_resources_init,void,
Function,-,furi_hal_resources_init_early,void,
Function,+,furi_hal_rtc_datetime_to_timestamp,uint32_t,FuriHalRtcDateTime*
@@ -1061,11 +1063,13 @@ Function,+,furi_hal_spi_bus_handle_deinit,void,FuriHalSpiBusHandle*
Function,+,furi_hal_spi_bus_handle_init,void,FuriHalSpiBusHandle*
Function,+,furi_hal_spi_bus_init,void,FuriHalSpiBus*
Function,+,furi_hal_spi_bus_rx,_Bool,"FuriHalSpiBusHandle*, uint8_t*, size_t, uint32_t"
Function,+,furi_hal_spi_bus_trx,_Bool,"FuriHalSpiBusHandle*, uint8_t*, uint8_t*, size_t, uint32_t"
Function,+,furi_hal_spi_bus_tx,_Bool,"FuriHalSpiBusHandle*, uint8_t*, size_t, uint32_t"
Function,+,furi_hal_spi_bus_trx,_Bool,"FuriHalSpiBusHandle*, const uint8_t*, uint8_t*, size_t, uint32_t"
Function,+,furi_hal_spi_bus_trx_dma,_Bool,"FuriHalSpiBusHandle*, uint8_t*, uint8_t*, size_t, uint32_t"
Function,+,furi_hal_spi_bus_tx,_Bool,"FuriHalSpiBusHandle*, const uint8_t*, size_t, uint32_t"
Function,-,furi_hal_spi_config_deinit_early,void,
Function,-,furi_hal_spi_config_init,void,
Function,-,furi_hal_spi_config_init_early,void,
Function,-,furi_hal_spi_dma_init,void,
Function,+,furi_hal_spi_release,void,FuriHalSpiBusHandle*
Function,+,furi_hal_switch,void,void*
Function,+,furi_hal_uart_deinit,void,FuriHalUartId
@@ -1119,6 +1123,7 @@ Function,+,furi_kernel_unlock,int32_t,
Function,+,furi_log_get_level,FuriLogLevel,
Function,-,furi_log_init,void,
Function,+,furi_log_print_format,void,"FuriLogLevel, const char*, const char*, ..."
Function,+,furi_log_print_raw_format,void,"FuriLogLevel, const char*, ..."
Function,+,furi_log_set_level,void,FuriLogLevel
Function,-,furi_log_set_puts,void,FuriLogPuts
Function,-,furi_log_set_timestamp,void,FuriLogTimestamp
@@ -1231,6 +1236,7 @@ Function,+,furi_thread_flags_wait,uint32_t,"uint32_t, uint32_t, uint32_t"
Function,+,furi_thread_free,void,FuriThread*
Function,+,furi_thread_get_current,FuriThread*,
Function,+,furi_thread_get_current_id,FuriThreadId,
Function,+,furi_thread_get_current_priority,FuriThreadPriority,
Function,+,furi_thread_get_heap_size,size_t,FuriThread*
Function,+,furi_thread_get_id,FuriThreadId,FuriThread*
Function,+,furi_thread_get_name,const char*,FuriThreadId
@@ -1244,6 +1250,7 @@ Function,+,furi_thread_mark_as_service,void,FuriThread*
Function,+,furi_thread_resume,void,FuriThreadId
Function,+,furi_thread_set_callback,void,"FuriThread*, FuriThreadCallback"
Function,+,furi_thread_set_context,void,"FuriThread*, void*"
Function,+,furi_thread_set_current_priority,void,FuriThreadPriority
Function,+,furi_thread_set_name,void,"FuriThread*, const char*"
Function,+,furi_thread_set_priority,void,"FuriThread*, FuriThreadPriority"
Function,+,furi_thread_set_stack_size,void,"FuriThread*, size_t"
1 entry status name type params
2 Version + 12.1 15.0
3 Header + applications/services/bt/bt_service/bt.h
4 Header + applications/services/cli/cli.h
5 Header + applications/services/cli/cli_vcp.h
546 Function + canvas_reset void Canvas*
547 Function + canvas_set_bitmap_mode void Canvas*, _Bool
548 Function + canvas_set_color void Canvas*, Color
549 Function + canvas_set_custom_u8g2_font void Canvas*, const uint8_t*
550 Function + canvas_set_font void Canvas*, Font
551 Function + canvas_set_font_direction void Canvas*, CanvasDirection
552 Function + canvas_string_width uint16_t Canvas*, const char*
979 Function + furi_hal_power_enable_otg void
980 Function + furi_hal_power_gauge_is_ok _Bool
981 Function + furi_hal_power_get_bat_health_pct uint8_t
982 Function + furi_hal_power_get_battery_charging_voltage furi_hal_power_get_battery_charge_voltage_limit float
983 Function + furi_hal_power_get_battery_current float FuriHalPowerIC
984 Function + furi_hal_power_get_battery_design_capacity uint32_t
985 Function + furi_hal_power_get_battery_full_capacity uint32_t
998 Function + furi_hal_power_is_otg_enabled _Bool
999 Function + furi_hal_power_off void
1000 Function + furi_hal_power_reset void
1001 Function + furi_hal_power_set_battery_charging_voltage furi_hal_power_set_battery_charge_voltage_limit void float
1002 Function + furi_hal_power_shutdown void
1003 Function + furi_hal_power_sleep void
1004 Function + furi_hal_power_sleep_available _Bool
1017 Function + furi_hal_region_is_provisioned _Bool
1018 Function + furi_hal_region_set void FuriHalRegion*
1019 Function - furi_hal_resources_deinit_early void
1020 Function + furi_hal_resources_get_ext_pin_number int32_t const GpioPin*
1021 Function - furi_hal_resources_init void
1022 Function - furi_hal_resources_init_early void
1023 Function + furi_hal_rtc_datetime_to_timestamp uint32_t FuriHalRtcDateTime*
1063 Function + furi_hal_spi_bus_handle_init void FuriHalSpiBusHandle*
1064 Function + furi_hal_spi_bus_init void FuriHalSpiBus*
1065 Function + furi_hal_spi_bus_rx _Bool FuriHalSpiBusHandle*, uint8_t*, size_t, uint32_t
1066 Function + furi_hal_spi_bus_trx _Bool FuriHalSpiBusHandle*, uint8_t*, uint8_t*, size_t, uint32_t FuriHalSpiBusHandle*, const uint8_t*, uint8_t*, size_t, uint32_t
1067 Function + furi_hal_spi_bus_tx furi_hal_spi_bus_trx_dma _Bool FuriHalSpiBusHandle*, uint8_t*, size_t, uint32_t FuriHalSpiBusHandle*, uint8_t*, uint8_t*, size_t, uint32_t
1068 Function + furi_hal_spi_bus_tx _Bool FuriHalSpiBusHandle*, const uint8_t*, size_t, uint32_t
1069 Function - furi_hal_spi_config_deinit_early void
1070 Function - furi_hal_spi_config_init void
1071 Function - furi_hal_spi_config_init_early void
1072 Function - furi_hal_spi_dma_init void
1073 Function + furi_hal_spi_release void FuriHalSpiBusHandle*
1074 Function + furi_hal_switch void void*
1075 Function + furi_hal_uart_deinit void FuriHalUartId
1123 Function + furi_log_get_level FuriLogLevel
1124 Function - furi_log_init void
1125 Function + furi_log_print_format void FuriLogLevel, const char*, const char*, ...
1126 Function + furi_log_print_raw_format void FuriLogLevel, const char*, ...
1127 Function + furi_log_set_level void FuriLogLevel
1128 Function - furi_log_set_puts void FuriLogPuts
1129 Function - furi_log_set_timestamp void FuriLogTimestamp
1236 Function + furi_thread_free void FuriThread*
1237 Function + furi_thread_get_current FuriThread*
1238 Function + furi_thread_get_current_id FuriThreadId
1239 Function + furi_thread_get_current_priority FuriThreadPriority
1240 Function + furi_thread_get_heap_size size_t FuriThread*
1241 Function + furi_thread_get_id FuriThreadId FuriThread*
1242 Function + furi_thread_get_name const char* FuriThreadId
1250 Function + furi_thread_resume void FuriThreadId
1251 Function + furi_thread_set_callback void FuriThread*, FuriThreadCallback
1252 Function + furi_thread_set_context void FuriThread*, void*
1253 Function + furi_thread_set_current_priority void FuriThreadPriority
1254 Function + furi_thread_set_name void FuriThread*, const char*
1255 Function + furi_thread_set_priority void FuriThread*, FuriThreadPriority
1256 Function + furi_thread_set_stack_size void FuriThread*, size_t
+1
View File
@@ -51,6 +51,7 @@ void furi_hal_init() {
furi_hal_version_init();
furi_hal_spi_config_init();
furi_hal_spi_dma_init();
furi_hal_speaker_init();
FURI_LOG_I(TAG, "Speaker OK");
@@ -199,3 +199,27 @@ void furi_hal_resources_init() {
NVIC_SetPriority(EXTI15_10_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(), 5, 0));
NVIC_EnableIRQ(EXTI15_10_IRQn);
}
int32_t furi_hal_resources_get_ext_pin_number(const GpioPin* gpio) {
// TODO: describe second ROW
if(gpio == &gpio_ext_pa7)
return 2;
else if(gpio == &gpio_ext_pa6)
return 3;
else if(gpio == &gpio_ext_pa4)
return 4;
else if(gpio == &gpio_ext_pb3)
return 5;
else if(gpio == &gpio_ext_pb2)
return 6;
else if(gpio == &gpio_ext_pc3)
return 7;
else if(gpio == &gpio_ext_pc1)
return 15;
else if(gpio == &gpio_ext_pc0)
return 16;
else if(gpio == &ibutton_gpio)
return 17;
else
return -1;
}
@@ -111,6 +111,13 @@ void furi_hal_resources_deinit_early();
void furi_hal_resources_init();
/**
* Get a corresponding external connector pin number for a gpio
* @param gpio GpioPin
* @return pin number or -1 if gpio is not on the external connector
*/
int32_t furi_hal_resources_get_ext_pin_number(const GpioPin* gpio);
#ifdef __cplusplus
}
#endif
+46 -31
View File
@@ -498,6 +498,10 @@ Function,+,acquire_mutex,void*,"ValueMutex*, uint32_t"
Function,-,aligned_alloc,void*,"size_t, size_t"
Function,+,aligned_free,void,void*
Function,+,aligned_malloc,void*,"size_t, size_t"
Function,-,alutech_get_custom_btn,uint8_t,
Function,-,alutech_get_original_btn,uint8_t,
Function,-,alutech_reset_original_btn,void,
Function,-,alutech_set_btn,void,uint8_t
Function,-,arc4random,__uint32_t,
Function,-,arc4random_buf,void,"void*, size_t"
Function,-,arc4random_uniform,__uint32_t,__uint32_t
@@ -624,7 +628,7 @@ Function,-,bzero,void,"void*, size_t"
Function,-,calloc,void*,"size_t, size_t"
Function,+,canvas_clear,void,Canvas*
Function,+,canvas_commit,void,Canvas*
Function,+,canvas_current_font_height,uint8_t,Canvas*
Function,+,canvas_current_font_height,uint8_t,const Canvas*
Function,+,canvas_draw_bitmap,void,"Canvas*, uint8_t, uint8_t, uint8_t, uint8_t, const uint8_t*"
Function,+,canvas_draw_box,void,"Canvas*, uint8_t, uint8_t, uint8_t, uint8_t"
Function,+,canvas_draw_circle,void,"Canvas*, uint8_t, uint8_t, uint8_t"
@@ -645,11 +649,11 @@ Function,+,canvas_draw_xbm,void,"Canvas*, uint8_t, uint8_t, uint8_t, uint8_t, co
Function,-,canvas_frame_set,void,"Canvas*, uint8_t, uint8_t, uint8_t, uint8_t"
Function,-,canvas_free,void,Canvas*
Function,+,canvas_get_buffer,uint8_t*,Canvas*
Function,+,canvas_get_buffer_size,size_t,Canvas*
Function,+,canvas_get_font_params,CanvasFontParameters*,"Canvas*, Font"
Function,+,canvas_get_buffer_size,size_t,const Canvas*
Function,+,canvas_get_font_params,const CanvasFontParameters*,"const Canvas*, Font"
Function,-,canvas_get_orientation,CanvasOrientation,const Canvas*
Function,+,canvas_glyph_width,uint8_t,"Canvas*, char"
Function,+,canvas_height,uint8_t,Canvas*
Function,+,canvas_height,uint8_t,const Canvas*
Function,-,canvas_init,Canvas*,
Function,+,canvas_invert_color,void,Canvas*
Function,+,canvas_reset,void,Canvas*
@@ -660,7 +664,7 @@ Function,+,canvas_set_font,void,"Canvas*, Font"
Function,+,canvas_set_font_direction,void,"Canvas*, CanvasDirection"
Function,-,canvas_set_orientation,void,"Canvas*, CanvasOrientation"
Function,+,canvas_string_width,uint16_t,"Canvas*, const char*"
Function,+,canvas_width,uint8_t,Canvas*
Function,+,canvas_width,uint8_t,const Canvas*
Function,-,cbrt,double,double
Function,-,cbrtf,float,float
Function,-,cbrtl,long double,long double
@@ -1173,20 +1177,13 @@ Function,+,furi_hal_i2c_tx,_Bool,"FuriHalI2cBusHandle*, const uint8_t, const uin
Function,+,furi_hal_i2c_write_mem,_Bool,"FuriHalI2cBusHandle*, uint8_t, uint8_t, uint8_t*, uint8_t, uint32_t"
Function,+,furi_hal_i2c_write_reg_16,_Bool,"FuriHalI2cBusHandle*, uint8_t, uint8_t, uint16_t, uint32_t"
Function,+,furi_hal_i2c_write_reg_8,_Bool,"FuriHalI2cBusHandle*, uint8_t, uint8_t, uint8_t, uint32_t"
Function,+,furi_hal_ibutton_add_interrupt,void,"GpioExtiCallback, void*"
Function,+,furi_hal_ibutton_emulate_set_next,void,uint32_t
Function,+,furi_hal_ibutton_emulate_start,void,"uint32_t, FuriHalIbuttonEmulateCallback, void*"
Function,+,furi_hal_ibutton_emulate_stop,void,
Function,-,furi_hal_ibutton_init,void,
Function,+,furi_hal_ibutton_pin_get_level,_Bool,
Function,+,furi_hal_ibutton_pin_high,void,
Function,+,furi_hal_ibutton_pin_low,void,
Function,+,furi_hal_ibutton_remove_interrupt,void,
Function,+,furi_hal_ibutton_start_drive,void,
Function,+,furi_hal_ibutton_start_drive_in_isr,void,
Function,+,furi_hal_ibutton_start_interrupt,void,
Function,+,furi_hal_ibutton_start_interrupt_in_isr,void,
Function,+,furi_hal_ibutton_stop,void,
Function,+,furi_hal_ibutton_pin_configure,void,
Function,+,furi_hal_ibutton_pin_reset,void,
Function,+,furi_hal_ibutton_pin_write,void,const _Bool
Function,+,furi_hal_info_get,void,"PropertyValueCallback, char, void*"
Function,+,furi_hal_infrared_async_rx_set_capture_isr_callback,void,"FuriHalInfraredRxCaptureCallback, void*"
Function,+,furi_hal_infrared_async_rx_set_timeout,void,uint32_t
@@ -1198,7 +1195,9 @@ Function,+,furi_hal_infrared_async_tx_set_signal_sent_isr_callback,void,"FuriHal
Function,+,furi_hal_infrared_async_tx_start,void,"uint32_t, float"
Function,+,furi_hal_infrared_async_tx_stop,void,
Function,+,furi_hal_infrared_async_tx_wait_termination,void,
Function,+,furi_hal_infrared_get_debug_out_status,_Bool,
Function,+,furi_hal_infrared_is_busy,_Bool,
Function,+,furi_hal_infrared_set_debug_out,void,_Bool
Function,-,furi_hal_init,void,
Function,-,furi_hal_init_early,void,
Function,-,furi_hal_interrupt_init,void,
@@ -1261,7 +1260,7 @@ Function,+,furi_hal_power_enable_external_3_3v,void,
Function,+,furi_hal_power_enable_otg,void,
Function,+,furi_hal_power_gauge_is_ok,_Bool,
Function,+,furi_hal_power_get_bat_health_pct,uint8_t,
Function,+,furi_hal_power_get_battery_charging_voltage,float,
Function,+,furi_hal_power_get_battery_charge_voltage_limit,float,
Function,+,furi_hal_power_get_battery_current,float,FuriHalPowerIC
Function,+,furi_hal_power_get_battery_design_capacity,uint32_t,
Function,+,furi_hal_power_get_battery_full_capacity,uint32_t,
@@ -1280,7 +1279,7 @@ Function,+,furi_hal_power_is_charging_done,_Bool,
Function,+,furi_hal_power_is_otg_enabled,_Bool,
Function,+,furi_hal_power_off,void,
Function,+,furi_hal_power_reset,void,
Function,+,furi_hal_power_set_battery_charging_voltage,void,float
Function,+,furi_hal_power_set_battery_charge_voltage_limit,void,float
Function,+,furi_hal_power_shutdown,void,
Function,+,furi_hal_power_sleep,void,
Function,+,furi_hal_power_sleep_available,_Bool,
@@ -1386,6 +1385,7 @@ Function,+,furi_hal_subghz_flush_rx,void,
Function,+,furi_hal_subghz_flush_tx,void,
Function,+,furi_hal_subghz_get_lqi,uint8_t,
Function,+,furi_hal_subghz_get_radio_type,SubGhzRadioType,
Function,+,furi_hal_subghz_get_rolling_counter_mult,uint8_t,
Function,+,furi_hal_subghz_get_rssi,float,
Function,+,furi_hal_subghz_idle,void,
Function,-,furi_hal_subghz_init,void,
@@ -1407,6 +1407,7 @@ Function,+,furi_hal_subghz_set_frequency,uint32_t,uint32_t
Function,+,furi_hal_subghz_set_frequency_and_path,uint32_t,uint32_t
Function,+,furi_hal_subghz_set_path,void,FuriHalSubGhzPath
Function,+,furi_hal_subghz_set_radio_type,_Bool,SubGhzRadioType
Function,+,furi_hal_subghz_set_rolling_counter_mult,void,uint8_t
Function,-,furi_hal_subghz_shutdown,void,
Function,+,furi_hal_subghz_sleep,void,
Function,+,furi_hal_subghz_start_async_rx,void,"FuriHalSubGhzCaptureCallback, void*"
@@ -1470,6 +1471,7 @@ Function,+,furi_kernel_unlock,int32_t,
Function,+,furi_log_get_level,FuriLogLevel,
Function,-,furi_log_init,void,
Function,+,furi_log_print_format,void,"FuriLogLevel, const char*, const char*, ..."
Function,+,furi_log_print_raw_format,void,"FuriLogLevel, const char*, ..."
Function,+,furi_log_set_level,void,FuriLogLevel
Function,-,furi_log_set_puts,void,FuriLogPuts
Function,-,furi_log_set_timestamp,void,FuriLogTimestamp
@@ -1582,6 +1584,7 @@ Function,+,furi_thread_flags_wait,uint32_t,"uint32_t, uint32_t, uint32_t"
Function,+,furi_thread_free,void,FuriThread*
Function,+,furi_thread_get_current,FuriThread*,
Function,+,furi_thread_get_current_id,FuriThreadId,
Function,+,furi_thread_get_current_priority,FuriThreadPriority,
Function,+,furi_thread_get_heap_size,size_t,FuriThread*
Function,+,furi_thread_get_id,FuriThreadId,FuriThread*
Function,+,furi_thread_get_name,const char*,FuriThreadId
@@ -1595,6 +1598,7 @@ Function,+,furi_thread_mark_as_service,void,FuriThread*
Function,+,furi_thread_resume,void,FuriThreadId
Function,+,furi_thread_set_callback,void,"FuriThread*, FuriThreadCallback"
Function,+,furi_thread_set_context,void,"FuriThread*, void*"
Function,+,furi_thread_set_current_priority,void,FuriThreadPriority
Function,+,furi_thread_set_name,void,"FuriThread*, const char*"
Function,+,furi_thread_set_priority,void,"FuriThread*, FuriThreadPriority"
Function,+,furi_thread_set_stack_size,void,"FuriThread*, size_t"
@@ -1623,7 +1627,6 @@ Function,-,gap_init,_Bool,"GapConfig*, GapEventCallback, void*"
Function,-,gap_start_advertising,void,
Function,-,gap_stop_advertising,void,
Function,-,gap_thread_stop,void,
Function,+,getRandomDeed,DolphinDeed,
Function,-,getc,int,FILE*
Function,-,getc_unlocked,int,FILE*
Function,-,getchar,int,
@@ -1638,7 +1641,7 @@ Function,+,gui_add_framebuffer_callback,void,"Gui*, GuiCanvasCommitCallback, voi
Function,+,gui_add_view_port,void,"Gui*, ViewPort*, GuiLayer"
Function,+,gui_direct_draw_acquire,Canvas*,Gui*
Function,+,gui_direct_draw_release,void,Gui*
Function,+,gui_get_framebuffer_size,size_t,Gui*
Function,+,gui_get_framebuffer_size,size_t,const Gui*
Function,+,gui_remove_framebuffer_callback,void,"Gui*, GuiCanvasCommitCallback, void*"
Function,+,gui_remove_view_port,void,"Gui*, ViewPort*"
Function,+,gui_set_lockdown,void,"Gui*, _Bool"
@@ -1681,9 +1684,9 @@ Function,+,ibutton_worker_write_set_callback,void,"iButtonWorker*, iButtonWorker
Function,+,ibutton_worker_write_start,void,"iButtonWorker*, iButtonKey*"
Function,+,icon_animation_alloc,IconAnimation*,const Icon*
Function,+,icon_animation_free,void,IconAnimation*
Function,+,icon_animation_get_height,uint8_t,IconAnimation*
Function,+,icon_animation_get_width,uint8_t,IconAnimation*
Function,+,icon_animation_is_last_frame,_Bool,IconAnimation*
Function,+,icon_animation_get_height,uint8_t,const IconAnimation*
Function,+,icon_animation_get_width,uint8_t,const IconAnimation*
Function,+,icon_animation_is_last_frame,_Bool,const IconAnimation*
Function,+,icon_animation_set_update_callback,void,"IconAnimation*, IconAnimationCallback, void*"
Function,+,icon_animation_start,void,IconAnimation*
Function,+,icon_animation_stop,void,IconAnimation*
@@ -1779,8 +1782,12 @@ Function,-,j1f,float,float
Function,-,jn,double,"int, double"
Function,-,jnf,float,"int, float"
Function,-,jrand48,long,unsigned short[3]
Function,-,keeloq_get_custom_btn,uint8_t,
Function,-,keeloq_get_original_btn,uint8_t,
Function,-,keeloq_reset_kl_type,void,
Function,-,keeloq_reset_mfname,void,
Function,-,keeloq_reset_original_btn,void,
Function,-,keeloq_set_btn,void,uint8_t
Function,-,l64a,char*,long
Function,-,labs,long,long
Function,-,lcong48,void,unsigned short[7]
@@ -1827,7 +1834,7 @@ Function,-,llround,long long int,double
Function,-,llroundf,long long int,float
Function,-,llroundl,long long int,long double
Function,+,loader_get_pubsub,FuriPubSub*,Loader*
Function,+,loader_is_locked,_Bool,Loader*
Function,+,loader_is_locked,_Bool,const Loader*
Function,+,loader_lock,_Bool,Loader*
Function,+,loader_show_menu,void,
Function,+,loader_start,LoaderStatus,"Loader*, const char*, const char*"
@@ -2128,6 +2135,10 @@ Function,-,nfcv_inventory,ReturnCode,uint8_t*
Function,-,nfcv_read_blocks,ReturnCode,"NfcVReader*, NfcVData*"
Function,-,nfcv_read_card,_Bool,"NfcVReader*, FuriHalNfcDevData*, NfcVData*"
Function,-,nfcv_read_sysinfo,ReturnCode,"FuriHalNfcDevData*, NfcVData*"
Function,-,nice_flors_get_custom_btn,uint8_t,
Function,-,nice_flors_get_original_btn,uint8_t,
Function,-,nice_flors_reset_original_btn,void,
Function,-,nice_flors_set_btn,void,uint8_t
Function,+,notification_internal_message,void,"NotificationApp*, const NotificationSequence*"
Function,+,notification_internal_message_block,void,"NotificationApp*, const NotificationSequence*"
Function,+,notification_message,void,"NotificationApp*, const NotificationSequence*"
@@ -2140,7 +2151,7 @@ Function,+,onewire_device_detach,void,OneWireDevice*
Function,+,onewire_device_free,void,OneWireDevice*
Function,+,onewire_device_get_id_p,uint8_t*,OneWireDevice*
Function,+,onewire_device_send_id,void,OneWireDevice*
Function,+,onewire_host_alloc,OneWireHost*,
Function,+,onewire_host_alloc,OneWireHost*,const GpioPin*
Function,+,onewire_host_free,void,OneWireHost*
Function,+,onewire_host_read,uint8_t,OneWireHost*
Function,+,onewire_host_read_bit,_Bool,OneWireHost*
@@ -2154,7 +2165,7 @@ Function,+,onewire_host_stop,void,OneWireHost*
Function,+,onewire_host_target_search,void,"OneWireHost*, uint8_t"
Function,+,onewire_host_write,void,"OneWireHost*, uint8_t"
Function,+,onewire_host_write_bit,void,"OneWireHost*, _Bool"
Function,+,onewire_slave_alloc,OneWireSlave*,
Function,+,onewire_slave_alloc,OneWireSlave*,const GpioPin*
Function,+,onewire_slave_attach,void,"OneWireSlave*, OneWireDevice*"
Function,+,onewire_slave_detach,void,OneWireSlave*
Function,+,onewire_slave_free,void,OneWireSlave*
@@ -2484,11 +2495,11 @@ Function,-,scalbnl,long double,"long double, int"
Function,-,scanf,int,"const char*, ..."
Function,+,scene_manager_alloc,SceneManager*,"const SceneManagerHandlers*, void*"
Function,+,scene_manager_free,void,SceneManager*
Function,+,scene_manager_get_scene_state,uint32_t,"SceneManager*, uint32_t"
Function,+,scene_manager_get_scene_state,uint32_t,"const SceneManager*, uint32_t"
Function,+,scene_manager_handle_back_event,_Bool,SceneManager*
Function,+,scene_manager_handle_custom_event,_Bool,"SceneManager*, uint32_t"
Function,+,scene_manager_handle_tick_event,void,SceneManager*
Function,+,scene_manager_has_previous_scene,_Bool,"SceneManager*, uint32_t"
Function,+,scene_manager_has_previous_scene,_Bool,"const SceneManager*, uint32_t"
Function,+,scene_manager_next_scene,void,"SceneManager*, uint32_t"
Function,+,scene_manager_previous_scene,_Bool,SceneManager*
Function,+,scene_manager_search_and_switch_to_another_scene,_Bool,"SceneManager*, uint32_t"
@@ -2532,6 +2543,10 @@ Function,-,siprintf,int,"char*, const char*, ..."
Function,-,siscanf,int,"const char*, const char*, ..."
Function,-,sniprintf,int,"char*, size_t, const char*, ..."
Function,+,snprintf,int,"char*, size_t, const char*, ..."
Function,-,somfy_telis_get_custom_btn,uint8_t,
Function,-,somfy_telis_get_original_btn,uint8_t,
Function,-,somfy_telis_reset_original_btn,void,
Function,-,somfy_telis_set_btn,void,uint8_t
Function,-,sprintf,int,"char*, const char*, ..."
Function,-,sqrt,double,double
Function,-,sqrtf,float,float
@@ -3262,7 +3277,7 @@ Function,-,subghz_protocol_encoder_star_line_yield,LevelDuration,void*
Function,-,subghz_protocol_faac_slh_create_data,_Bool,"void*, FlipperFormat*, uint32_t, uint8_t, uint32_t, uint32_t, const char*, SubGhzRadioPreset*"
Function,-,subghz_protocol_keeloq_bft_create_data,_Bool,"void*, FlipperFormat*, uint32_t, uint8_t, uint16_t, uint32_t, const char*, SubGhzRadioPreset*"
Function,-,subghz_protocol_keeloq_create_data,_Bool,"void*, FlipperFormat*, uint32_t, uint8_t, uint16_t, const char*, SubGhzRadioPreset*"
Function,-,subghz_protocol_nice_flor_s_create_data,_Bool,"void*, FlipperFormat*, uint32_t, uint8_t, uint16_t, SubGhzRadioPreset*"
Function,-,subghz_protocol_nice_flor_s_create_data,_Bool,"void*, FlipperFormat*, uint32_t, uint8_t, uint16_t, SubGhzRadioPreset*, _Bool"
Function,-,subghz_protocol_nice_flor_s_encrypt,uint64_t,"uint64_t, const char*"
Function,+,subghz_protocol_raw_file_encoder_worker_set_callback_end,void,"SubGhzProtocolEncoderRAW*, SubGhzProtocolEncoderRAWCallbackEnd, void*"
Function,+,subghz_protocol_raw_gen_fff_data,void,"FlipperFormat*, const char*"
@@ -4604,11 +4619,11 @@ Function,+,view_port_alloc,ViewPort*,
Function,+,view_port_draw_callback_set,void,"ViewPort*, ViewPortDrawCallback, void*"
Function,+,view_port_enabled_set,void,"ViewPort*, _Bool"
Function,+,view_port_free,void,ViewPort*
Function,+,view_port_get_height,uint8_t,ViewPort*
Function,+,view_port_get_height,uint8_t,const ViewPort*
Function,+,view_port_get_orientation,ViewPortOrientation,const ViewPort*
Function,+,view_port_get_width,uint8_t,ViewPort*
Function,+,view_port_get_width,uint8_t,const ViewPort*
Function,+,view_port_input_callback_set,void,"ViewPort*, ViewPortInputCallback, void*"
Function,+,view_port_is_enabled,_Bool,ViewPort*
Function,+,view_port_is_enabled,_Bool,const ViewPort*
Function,+,view_port_set_height,void,"ViewPort*, uint8_t"
Function,+,view_port_set_orientation,void,"ViewPort*, ViewPortOrientation"
Function,+,view_port_set_width,void,"ViewPort*, uint8_t"
1 entry status name type params
498 Function - aligned_alloc void* size_t, size_t
499 Function + aligned_free void void*
500 Function + aligned_malloc void* size_t, size_t
501 Function - alutech_get_custom_btn uint8_t
502 Function - alutech_get_original_btn uint8_t
503 Function - alutech_reset_original_btn void
504 Function - alutech_set_btn void uint8_t
505 Function - arc4random __uint32_t
506 Function - arc4random_buf void void*, size_t
507 Function - arc4random_uniform __uint32_t __uint32_t
628 Function - calloc void* size_t, size_t
629 Function + canvas_clear void Canvas*
630 Function + canvas_commit void Canvas*
631 Function + canvas_current_font_height uint8_t Canvas* const Canvas*
632 Function + canvas_draw_bitmap void Canvas*, uint8_t, uint8_t, uint8_t, uint8_t, const uint8_t*
633 Function + canvas_draw_box void Canvas*, uint8_t, uint8_t, uint8_t, uint8_t
634 Function + canvas_draw_circle void Canvas*, uint8_t, uint8_t, uint8_t
649 Function - canvas_frame_set void Canvas*, uint8_t, uint8_t, uint8_t, uint8_t
650 Function - canvas_free void Canvas*
651 Function + canvas_get_buffer uint8_t* Canvas*
652 Function + canvas_get_buffer_size size_t Canvas* const Canvas*
653 Function + canvas_get_font_params CanvasFontParameters* const CanvasFontParameters* Canvas*, Font const Canvas*, Font
654 Function - canvas_get_orientation CanvasOrientation const Canvas*
655 Function + canvas_glyph_width uint8_t Canvas*, char
656 Function + canvas_height uint8_t Canvas* const Canvas*
657 Function - canvas_init Canvas*
658 Function + canvas_invert_color void Canvas*
659 Function + canvas_reset void Canvas*
664 Function + canvas_set_font_direction void Canvas*, CanvasDirection
665 Function - canvas_set_orientation void Canvas*, CanvasOrientation
666 Function + canvas_string_width uint16_t Canvas*, const char*
667 Function + canvas_width uint8_t Canvas* const Canvas*
668 Function - cbrt double double
669 Function - cbrtf float float
670 Function - cbrtl long double long double
1177 Function + furi_hal_i2c_write_mem _Bool FuriHalI2cBusHandle*, uint8_t, uint8_t, uint8_t*, uint8_t, uint32_t
1178 Function + furi_hal_i2c_write_reg_16 _Bool FuriHalI2cBusHandle*, uint8_t, uint8_t, uint16_t, uint32_t
1179 Function + furi_hal_i2c_write_reg_8 _Bool FuriHalI2cBusHandle*, uint8_t, uint8_t, uint8_t, uint32_t
Function + furi_hal_ibutton_add_interrupt void GpioExtiCallback, void*
1180 Function + furi_hal_ibutton_emulate_set_next void uint32_t
1181 Function + furi_hal_ibutton_emulate_start void uint32_t, FuriHalIbuttonEmulateCallback, void*
1182 Function + furi_hal_ibutton_emulate_stop void
1183 Function - furi_hal_ibutton_init void
1184 Function + furi_hal_ibutton_pin_get_level furi_hal_ibutton_pin_configure _Bool void
1185 Function + furi_hal_ibutton_pin_high furi_hal_ibutton_pin_reset void
1186 Function + furi_hal_ibutton_pin_low furi_hal_ibutton_pin_write void const _Bool
Function + furi_hal_ibutton_remove_interrupt void
Function + furi_hal_ibutton_start_drive void
Function + furi_hal_ibutton_start_drive_in_isr void
Function + furi_hal_ibutton_start_interrupt void
Function + furi_hal_ibutton_start_interrupt_in_isr void
Function + furi_hal_ibutton_stop void
1187 Function + furi_hal_info_get void PropertyValueCallback, char, void*
1188 Function + furi_hal_infrared_async_rx_set_capture_isr_callback void FuriHalInfraredRxCaptureCallback, void*
1189 Function + furi_hal_infrared_async_rx_set_timeout void uint32_t
1195 Function + furi_hal_infrared_async_tx_start void uint32_t, float
1196 Function + furi_hal_infrared_async_tx_stop void
1197 Function + furi_hal_infrared_async_tx_wait_termination void
1198 Function + furi_hal_infrared_get_debug_out_status _Bool
1199 Function + furi_hal_infrared_is_busy _Bool
1200 Function + furi_hal_infrared_set_debug_out void _Bool
1201 Function - furi_hal_init void
1202 Function - furi_hal_init_early void
1203 Function - furi_hal_interrupt_init void
1260 Function + furi_hal_power_enable_otg void
1261 Function + furi_hal_power_gauge_is_ok _Bool
1262 Function + furi_hal_power_get_bat_health_pct uint8_t
1263 Function + furi_hal_power_get_battery_charging_voltage furi_hal_power_get_battery_charge_voltage_limit float
1264 Function + furi_hal_power_get_battery_current float FuriHalPowerIC
1265 Function + furi_hal_power_get_battery_design_capacity uint32_t
1266 Function + furi_hal_power_get_battery_full_capacity uint32_t
1279 Function + furi_hal_power_is_otg_enabled _Bool
1280 Function + furi_hal_power_off void
1281 Function + furi_hal_power_reset void
1282 Function + furi_hal_power_set_battery_charging_voltage furi_hal_power_set_battery_charge_voltage_limit void float
1283 Function + furi_hal_power_shutdown void
1284 Function + furi_hal_power_sleep void
1285 Function + furi_hal_power_sleep_available _Bool
1385 Function + furi_hal_subghz_flush_tx void
1386 Function + furi_hal_subghz_get_lqi uint8_t
1387 Function + furi_hal_subghz_get_radio_type SubGhzRadioType
1388 Function + furi_hal_subghz_get_rolling_counter_mult uint8_t
1389 Function + furi_hal_subghz_get_rssi float
1390 Function + furi_hal_subghz_idle void
1391 Function - furi_hal_subghz_init void
1407 Function + furi_hal_subghz_set_frequency_and_path uint32_t uint32_t
1408 Function + furi_hal_subghz_set_path void FuriHalSubGhzPath
1409 Function + furi_hal_subghz_set_radio_type _Bool SubGhzRadioType
1410 Function + furi_hal_subghz_set_rolling_counter_mult void uint8_t
1411 Function - furi_hal_subghz_shutdown void
1412 Function + furi_hal_subghz_sleep void
1413 Function + furi_hal_subghz_start_async_rx void FuriHalSubGhzCaptureCallback, void*
1471 Function + furi_log_get_level FuriLogLevel
1472 Function - furi_log_init void
1473 Function + furi_log_print_format void FuriLogLevel, const char*, const char*, ...
1474 Function + furi_log_print_raw_format void FuriLogLevel, const char*, ...
1475 Function + furi_log_set_level void FuriLogLevel
1476 Function - furi_log_set_puts void FuriLogPuts
1477 Function - furi_log_set_timestamp void FuriLogTimestamp
1584 Function + furi_thread_free void FuriThread*
1585 Function + furi_thread_get_current FuriThread*
1586 Function + furi_thread_get_current_id FuriThreadId
1587 Function + furi_thread_get_current_priority FuriThreadPriority
1588 Function + furi_thread_get_heap_size size_t FuriThread*
1589 Function + furi_thread_get_id FuriThreadId FuriThread*
1590 Function + furi_thread_get_name const char* FuriThreadId
1598 Function + furi_thread_resume void FuriThreadId
1599 Function + furi_thread_set_callback void FuriThread*, FuriThreadCallback
1600 Function + furi_thread_set_context void FuriThread*, void*
1601 Function + furi_thread_set_current_priority void FuriThreadPriority
1602 Function + furi_thread_set_name void FuriThread*, const char*
1603 Function + furi_thread_set_priority void FuriThread*, FuriThreadPriority
1604 Function + furi_thread_set_stack_size void FuriThread*, size_t
1627 Function - gap_start_advertising void
1628 Function - gap_stop_advertising void
1629 Function - gap_thread_stop void
Function + getRandomDeed DolphinDeed
1630 Function - getc int FILE*
1631 Function - getc_unlocked int FILE*
1632 Function - getchar int
1641 Function + gui_add_view_port void Gui*, ViewPort*, GuiLayer
1642 Function + gui_direct_draw_acquire Canvas* Gui*
1643 Function + gui_direct_draw_release void Gui*
1644 Function + gui_get_framebuffer_size size_t Gui* const Gui*
1645 Function + gui_remove_framebuffer_callback void Gui*, GuiCanvasCommitCallback, void*
1646 Function + gui_remove_view_port void Gui*, ViewPort*
1647 Function + gui_set_lockdown void Gui*, _Bool
1684 Function + ibutton_worker_write_start void iButtonWorker*, iButtonKey*
1685 Function + icon_animation_alloc IconAnimation* const Icon*
1686 Function + icon_animation_free void IconAnimation*
1687 Function + icon_animation_get_height uint8_t IconAnimation* const IconAnimation*
1688 Function + icon_animation_get_width uint8_t IconAnimation* const IconAnimation*
1689 Function + icon_animation_is_last_frame _Bool IconAnimation* const IconAnimation*
1690 Function + icon_animation_set_update_callback void IconAnimation*, IconAnimationCallback, void*
1691 Function + icon_animation_start void IconAnimation*
1692 Function + icon_animation_stop void IconAnimation*
1782 Function - jn double int, double
1783 Function - jnf float int, float
1784 Function - jrand48 long unsigned short[3]
1785 Function - keeloq_get_custom_btn uint8_t
1786 Function - keeloq_get_original_btn uint8_t
1787 Function - keeloq_reset_kl_type void
1788 Function - keeloq_reset_mfname void
1789 Function - keeloq_reset_original_btn void
1790 Function - keeloq_set_btn void uint8_t
1791 Function - l64a char* long
1792 Function - labs long long
1793 Function - lcong48 void unsigned short[7]
1834 Function - llroundf long long int float
1835 Function - llroundl long long int long double
1836 Function + loader_get_pubsub FuriPubSub* Loader*
1837 Function + loader_is_locked _Bool Loader* const Loader*
1838 Function + loader_lock _Bool Loader*
1839 Function + loader_show_menu void
1840 Function + loader_start LoaderStatus Loader*, const char*, const char*
2135 Function - nfcv_read_blocks ReturnCode NfcVReader*, NfcVData*
2136 Function - nfcv_read_card _Bool NfcVReader*, FuriHalNfcDevData*, NfcVData*
2137 Function - nfcv_read_sysinfo ReturnCode FuriHalNfcDevData*, NfcVData*
2138 Function - nice_flors_get_custom_btn uint8_t
2139 Function - nice_flors_get_original_btn uint8_t
2140 Function - nice_flors_reset_original_btn void
2141 Function - nice_flors_set_btn void uint8_t
2142 Function + notification_internal_message void NotificationApp*, const NotificationSequence*
2143 Function + notification_internal_message_block void NotificationApp*, const NotificationSequence*
2144 Function + notification_message void NotificationApp*, const NotificationSequence*
2151 Function + onewire_device_free void OneWireDevice*
2152 Function + onewire_device_get_id_p uint8_t* OneWireDevice*
2153 Function + onewire_device_send_id void OneWireDevice*
2154 Function + onewire_host_alloc OneWireHost* const GpioPin*
2155 Function + onewire_host_free void OneWireHost*
2156 Function + onewire_host_read uint8_t OneWireHost*
2157 Function + onewire_host_read_bit _Bool OneWireHost*
2165 Function + onewire_host_target_search void OneWireHost*, uint8_t
2166 Function + onewire_host_write void OneWireHost*, uint8_t
2167 Function + onewire_host_write_bit void OneWireHost*, _Bool
2168 Function + onewire_slave_alloc OneWireSlave* const GpioPin*
2169 Function + onewire_slave_attach void OneWireSlave*, OneWireDevice*
2170 Function + onewire_slave_detach void OneWireSlave*
2171 Function + onewire_slave_free void OneWireSlave*
2495 Function - scanf int const char*, ...
2496 Function + scene_manager_alloc SceneManager* const SceneManagerHandlers*, void*
2497 Function + scene_manager_free void SceneManager*
2498 Function + scene_manager_get_scene_state uint32_t SceneManager*, uint32_t const SceneManager*, uint32_t
2499 Function + scene_manager_handle_back_event _Bool SceneManager*
2500 Function + scene_manager_handle_custom_event _Bool SceneManager*, uint32_t
2501 Function + scene_manager_handle_tick_event void SceneManager*
2502 Function + scene_manager_has_previous_scene _Bool SceneManager*, uint32_t const SceneManager*, uint32_t
2503 Function + scene_manager_next_scene void SceneManager*, uint32_t
2504 Function + scene_manager_previous_scene _Bool SceneManager*
2505 Function + scene_manager_search_and_switch_to_another_scene _Bool SceneManager*, uint32_t
2543 Function - siscanf int const char*, const char*, ...
2544 Function - sniprintf int char*, size_t, const char*, ...
2545 Function + snprintf int char*, size_t, const char*, ...
2546 Function - somfy_telis_get_custom_btn uint8_t
2547 Function - somfy_telis_get_original_btn uint8_t
2548 Function - somfy_telis_reset_original_btn void
2549 Function - somfy_telis_set_btn void uint8_t
2550 Function - sprintf int char*, const char*, ...
2551 Function - sqrt double double
2552 Function - sqrtf float float
3277 Function - subghz_protocol_faac_slh_create_data _Bool void*, FlipperFormat*, uint32_t, uint8_t, uint32_t, uint32_t, const char*, SubGhzRadioPreset*
3278 Function - subghz_protocol_keeloq_bft_create_data _Bool void*, FlipperFormat*, uint32_t, uint8_t, uint16_t, uint32_t, const char*, SubGhzRadioPreset*
3279 Function - subghz_protocol_keeloq_create_data _Bool void*, FlipperFormat*, uint32_t, uint8_t, uint16_t, const char*, SubGhzRadioPreset*
3280 Function - subghz_protocol_nice_flor_s_create_data _Bool void*, FlipperFormat*, uint32_t, uint8_t, uint16_t, SubGhzRadioPreset* void*, FlipperFormat*, uint32_t, uint8_t, uint16_t, SubGhzRadioPreset*, _Bool
3281 Function - subghz_protocol_nice_flor_s_encrypt uint64_t uint64_t, const char*
3282 Function + subghz_protocol_raw_file_encoder_worker_set_callback_end void SubGhzProtocolEncoderRAW*, SubGhzProtocolEncoderRAWCallbackEnd, void*
3283 Function + subghz_protocol_raw_gen_fff_data void FlipperFormat*, const char*
4619 Function + view_port_draw_callback_set void ViewPort*, ViewPortDrawCallback, void*
4620 Function + view_port_enabled_set void ViewPort*, _Bool
4621 Function + view_port_free void ViewPort*
4622 Function + view_port_get_height uint8_t ViewPort* const ViewPort*
4623 Function + view_port_get_orientation ViewPortOrientation const ViewPort*
4624 Function + view_port_get_width uint8_t ViewPort* const ViewPort*
4625 Function + view_port_input_callback_set void ViewPort*, ViewPortInputCallback, void*
4626 Function + view_port_is_enabled _Bool ViewPort* const ViewPort*
4627 Function + view_port_set_height void ViewPort*, uint8_t
4628 Function + view_port_set_orientation void ViewPort*, ViewPortOrientation
4629 Function + view_port_set_width void ViewPort*, uint8_t
+1 -37
View File
@@ -17,7 +17,6 @@
#define SD_DUMMY_BYTE 0xFF
#define SD_ANSWER_RETRY_COUNT 8
#define SD_IDLE_RETRY_COUNT 100
#define SD_BLOCK_SIZE 512
#define FLAG_SET(x, y) (((x) & (y)) == (y))
@@ -598,23 +597,6 @@ static SdSpiStatus sd_spi_get_cid(SD_CID* Cid) {
return ret;
}
static inline bool sd_cache_get(uint32_t address, uint32_t* data) {
uint8_t* cached_data = sector_cache_get(address);
if(cached_data) {
memcpy(data, cached_data, SD_BLOCK_SIZE);
return true;
}
return false;
}
static inline void sd_cache_put(uint32_t address, uint32_t* data) {
sector_cache_put(address, (uint8_t*)data);
}
static inline void sd_cache_invalidate_range(uint32_t start_sector, uint32_t end_sector) {
sector_cache_invalidate_range(start_sector, end_sector);
}
static SdSpiStatus
sd_spi_cmd_read_blocks(uint32_t* data, uint32_t address, uint32_t blocks, uint32_t timeout_ms) {
uint32_t block_address = address;
@@ -833,30 +815,12 @@ SdSpiStatus sd_get_card_info(SD_CardInfo* card_info) {
SdSpiStatus
sd_read_blocks(uint32_t* data, uint32_t address, uint32_t blocks, uint32_t timeout_ms) {
SdSpiStatus status = SdSpiStatusError;
bool single_sector_read = (blocks == 1);
if(single_sector_read) {
if(sd_cache_get(address, data)) {
return SdSpiStatusOK;
}
status = sd_spi_cmd_read_blocks(data, address, blocks, timeout_ms);
if(status == SdSpiStatusOK) {
sd_cache_put(address, data);
}
} else {
status = sd_spi_cmd_read_blocks(data, address, blocks, timeout_ms);
}
SdSpiStatus status = sd_spi_cmd_read_blocks(data, address, blocks, timeout_ms);
return status;
}
SdSpiStatus
sd_write_blocks(uint32_t* data, uint32_t address, uint32_t blocks, uint32_t timeout_ms) {
sd_cache_invalidate_range(address, address + blocks);
SdSpiStatus status = sd_spi_cmd_write_blocks(data, address, blocks, timeout_ms);
return status;
}
+1
View File
@@ -5,6 +5,7 @@
#define __IO volatile
#define SD_TIMEOUT_MS (1000)
#define SD_BLOCK_SIZE 512
typedef enum {
SdSpiStatusOK,
-5
View File
@@ -8,7 +8,6 @@
#define SECTOR_SIZE 512
#define N_SECTORS 8
#define TAG "SDCache"
typedef struct {
uint32_t itr;
@@ -20,15 +19,11 @@ static SectorCache* cache = NULL;
void sector_cache_init() {
if(cache == NULL) {
// TODO: tuneup allocation order, to place cache in mem pool (MEM2)
cache = memmgr_alloc_from_pool(sizeof(SectorCache));
}
if(cache != NULL) {
FURI_LOG_I(TAG, "Init");
memset(cache, 0, sizeof(SectorCache));
} else {
FURI_LOG_E(TAG, "Init failed");
}
}
-98
View File
@@ -1,98 +0,0 @@
#include <furi_hal.h>
#include <furi.h>
#define SD_DUMMY_BYTE 0xFF
const uint32_t SpiTimeout = 1000;
uint8_t SD_IO_WriteByte(uint8_t Data);
/******************************************************************************
BUS OPERATIONS
*******************************************************************************/
/**
* @brief SPI Write byte(s) to device
* @param DataIn: Pointer to data buffer to write
* @param DataOut: Pointer to data buffer for read data
* @param DataLength: number of bytes to write
* @retval None
*/
static void SPIx_WriteReadData(const uint8_t* DataIn, uint8_t* DataOut, uint16_t DataLength) {
furi_check(furi_hal_spi_bus_trx(
furi_hal_sd_spi_handle, (uint8_t*)DataIn, DataOut, DataLength, SpiTimeout));
}
/**
* @brief SPI Write a byte to device
* @param Value: value to be written
* @retval None
*/
__attribute__((unused)) static void SPIx_Write(uint8_t Value) {
furi_check(furi_hal_spi_bus_tx(furi_hal_sd_spi_handle, (uint8_t*)&Value, 1, SpiTimeout));
}
/******************************************************************************
LINK OPERATIONS
*******************************************************************************/
/********************************* LINK SD ************************************/
/**
* @brief Initialize the SD Card and put it into StandBy State (Ready for
* data transfer).
* @retval None
*/
void SD_IO_Init(void) {
uint8_t counter = 0;
/* SD chip select high */
furi_hal_gpio_write(furi_hal_sd_spi_handle->cs, true);
furi_delay_us(10);
/* Send dummy byte 0xFF, 10 times with CS high */
/* Rise CS and MOSI for 80 clocks cycles */
for(counter = 0; counter <= 200; counter++) {
/* Send dummy byte 0xFF */
SD_IO_WriteByte(SD_DUMMY_BYTE);
}
}
/**
* @brief Set SD interface Chip Select state
* @param val: 0 (low) or 1 (high) state
* @retval None
*/
void SD_IO_CSState(uint8_t val) {
/* Some SD Cards are prone to fail if CLK-ed too soon after CS transition. Worst case found: 8us */
if(val == 1) {
furi_delay_us(10); // Exit guard time for some SD cards
furi_hal_gpio_write(furi_hal_sd_spi_handle->cs, true);
} else {
furi_hal_gpio_write(furi_hal_sd_spi_handle->cs, false);
furi_delay_us(10); // Entry guard time for some SD cards
}
}
/**
* @brief Write byte(s) on the SD
* @param DataIn: Pointer to data buffer to write
* @param DataOut: Pointer to data buffer for read data
* @param DataLength: number of bytes to write
* @retval None
*/
void SD_IO_WriteReadData(const uint8_t* DataIn, uint8_t* DataOut, uint16_t DataLength) {
/* Send the byte */
SPIx_WriteReadData(DataIn, DataOut, DataLength);
}
/**
* @brief Write a byte on the SD.
* @param Data: byte to send.
* @retval Data written
*/
uint8_t SD_IO_WriteByte(uint8_t Data) {
uint8_t tmp;
/* Send the byte */
SPIx_WriteReadData(&Data, &tmp, 1);
return tmp;
}
File diff suppressed because it is too large Load Diff
@@ -1,245 +0,0 @@
/**
******************************************************************************
* @file stm32_adafruit_sd.h
* @author MCD Application Team
* @version V3.0.0
* @date 23-December-2016
* @brief This file contains the common defines and functions prototypes for
* the stm32_adafruit_sd.c driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32_ADAFRUIT_SD_H
#define __STM32_ADAFRUIT_SD_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include <stdint.h>
#include <stdbool.h>
/** @addtogroup BSP
* @{
*/
#define __IO volatile
/** @addtogroup STM32_ADAFRUIT
* @{
*/
/** @defgroup STM32_ADAFRUIT_SD
* @{
*/
/** @defgroup STM32_ADAFRUIT_SD_Exported_Types
* @{
*/
/**
* @brief SD status structure definition
*/
enum { BSP_SD_OK = 0x00, MSD_OK = 0x00, BSP_SD_ERROR = 0x01, BSP_SD_TIMEOUT };
typedef struct {
uint8_t Reserved1 : 2; /* Reserved */
uint16_t DeviceSize : 12; /* Device Size */
uint8_t MaxRdCurrentVDDMin : 3; /* Max. read current @ VDD min */
uint8_t MaxRdCurrentVDDMax : 3; /* Max. read current @ VDD max */
uint8_t MaxWrCurrentVDDMin : 3; /* Max. write current @ VDD min */
uint8_t MaxWrCurrentVDDMax : 3; /* Max. write current @ VDD max */
uint8_t DeviceSizeMul : 3; /* Device size multiplier */
} struct_v1;
typedef struct {
uint8_t Reserved1 : 6; /* Reserved */
uint32_t DeviceSize : 22; /* Device Size */
uint8_t Reserved2 : 1; /* Reserved */
} struct_v2;
/**
* @brief Card Specific Data: CSD Register
*/
typedef struct {
/* Header part */
uint8_t CSDStruct : 2; /* CSD structure */
uint8_t Reserved1 : 6; /* Reserved */
uint8_t TAAC : 8; /* Data read access-time 1 */
uint8_t NSAC : 8; /* Data read access-time 2 in CLK cycles */
uint8_t MaxBusClkFrec : 8; /* Max. bus clock frequency */
uint16_t CardComdClasses : 12; /* Card command classes */
uint8_t RdBlockLen : 4; /* Max. read data block length */
uint8_t PartBlockRead : 1; /* Partial blocks for read allowed */
uint8_t WrBlockMisalign : 1; /* Write block misalignment */
uint8_t RdBlockMisalign : 1; /* Read block misalignment */
uint8_t DSRImpl : 1; /* DSR implemented */
/* v1 or v2 struct */
union csd_version {
struct_v1 v1;
struct_v2 v2;
} version;
uint8_t EraseSingleBlockEnable : 1; /* Erase single block enable */
uint8_t EraseSectorSize : 7; /* Erase group size multiplier */
uint8_t WrProtectGrSize : 7; /* Write protect group size */
uint8_t WrProtectGrEnable : 1; /* Write protect group enable */
uint8_t Reserved2 : 2; /* Reserved */
uint8_t WrSpeedFact : 3; /* Write speed factor */
uint8_t MaxWrBlockLen : 4; /* Max. write data block length */
uint8_t WriteBlockPartial : 1; /* Partial blocks for write allowed */
uint8_t Reserved3 : 5; /* Reserved */
uint8_t FileFormatGrouop : 1; /* File format group */
uint8_t CopyFlag : 1; /* Copy flag (OTP) */
uint8_t PermWrProtect : 1; /* Permanent write protection */
uint8_t TempWrProtect : 1; /* Temporary write protection */
uint8_t FileFormat : 2; /* File Format */
uint8_t Reserved4 : 2; /* Reserved */
uint8_t crc : 7; /* Reserved */
uint8_t Reserved5 : 1; /* always 1*/
} SD_CSD;
/**
* @brief Card Identification Data: CID Register
*/
typedef struct {
uint8_t ManufacturerID; /* ManufacturerID */
char OEM_AppliID[2]; /* OEM/Application ID */
char ProdName[5]; /* Product Name */
uint8_t ProdRev; /* Product Revision */
uint32_t ProdSN; /* Product Serial Number */
uint8_t Reserved1; /* Reserved1 */
uint8_t ManufactYear; /* Manufacturing Year */
uint8_t ManufactMonth; /* Manufacturing Month */
uint8_t CID_CRC; /* CID CRC */
uint8_t Reserved2; /* always 1 */
} SD_CID;
/**
* @brief SD Card information
*/
typedef struct {
SD_CSD Csd;
SD_CID Cid;
uint64_t CardCapacity; /*!< Card Capacity */
uint32_t CardBlockSize; /*!< Card Block Size */
uint32_t LogBlockNbr; /*!< Specifies the Card logical Capacity in blocks */
uint32_t LogBlockSize; /*!< Specifies logical block size in bytes */
} SD_CardInfo;
/**
* @}
*/
/** @defgroup STM32_ADAFRUIT_SPI_SD_Exported_Constants
* @{
*/
/**
* @brief Block Size
*/
#define SD_BLOCK_SIZE 0x200
/**
* @brief SD detection on its memory slot
*/
#define SD_PRESENT ((uint8_t)0x01)
#define SD_NOT_PRESENT ((uint8_t)0x00)
#define SD_DATATIMEOUT ((uint32_t)100000000)
/**
* @brief SD Card information structure
*/
#define BSP_SD_CardInfo SD_CardInfo
/**
* @}
*/
/** @defgroup STM32_ADAFRUIT_SD_Exported_Macro
* @{
*/
/**
* @}
*/
/** @defgroup STM32_ADAFRUIT_SD_Exported_Functions
* @{
*/
uint8_t BSP_SD_MaxMountRetryCount();
uint8_t BSP_SD_Init(bool reset_card);
uint8_t
BSP_SD_ReadBlocks(uint32_t* pData, uint32_t ReadAddr, uint32_t NumOfBlocks, uint32_t Timeout);
uint8_t
BSP_SD_WriteBlocks(uint32_t* pData, uint32_t WriteAddr, uint32_t NumOfBlocks, uint32_t Timeout);
uint8_t BSP_SD_Erase(uint32_t StartAddr, uint32_t EndAddr);
uint8_t BSP_SD_GetCardState(void);
uint8_t BSP_SD_GetCardInfo(SD_CardInfo* pCardInfo);
uint8_t BSP_SD_GetCIDRegister(SD_CID* Cid);
/* Link functions for SD Card peripheral*/
void SD_SPI_Slow_Init(void);
void SD_SPI_Fast_Init(void);
void SD_IO_Init(void);
void SD_IO_CSState(uint8_t state);
void SD_IO_WriteReadData(const uint8_t* DataIn, uint8_t* DataOut, uint16_t DataLength);
uint8_t SD_IO_WriteByte(uint8_t Data);
/* Link function for HAL delay */
void HAL_Delay(__IO uint32_t Delay);
#ifdef __cplusplus
}
#endif
#endif /* __STM32_ADAFRUIT_SD_H */
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
+62 -11
View File
@@ -36,6 +36,7 @@
/* Includes ------------------------------------------------------------------*/
#include "user_diskio.h"
#include <furi_hal.h>
#include "sector_cache.h"
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
@@ -46,7 +47,7 @@ static volatile DSTATUS Stat = STA_NOINIT;
static DSTATUS User_CheckStatus(BYTE lun) {
UNUSED(lun);
Stat = STA_NOINIT;
if(BSP_SD_GetCardState() == MSD_OK) {
if(sd_get_card_state() == SdSpiStatusOK) {
Stat &= ~STA_NOINIT;
}
@@ -79,6 +80,26 @@ Diskio_drvTypeDef USER_Driver = {
};
/* Private functions ---------------------------------------------------------*/
static inline bool sd_cache_get(uint32_t address, uint32_t* data) {
uint8_t* cached_data = sector_cache_get(address);
if(cached_data) {
memcpy(data, cached_data, SD_BLOCK_SIZE);
return true;
}
return false;
}
static inline void sd_cache_put(uint32_t address, uint32_t* data) {
sector_cache_put(address, (uint8_t*)data);
}
static inline void sd_cache_invalidate_range(uint32_t start_sector, uint32_t end_sector) {
sector_cache_invalidate_range(start_sector, end_sector);
}
static inline void sd_cache_invalidate_all() {
sector_cache_init();
}
/**
* @brief Initializes a Drive
@@ -125,19 +146,38 @@ DRESULT USER_read(BYTE pdrv, BYTE* buff, DWORD sector, UINT count) {
UNUSED(pdrv);
DRESULT res = RES_ERROR;
bool single_sector = count == 1;
if(single_sector) {
if(sd_cache_get(sector, (uint32_t*)buff)) {
return RES_OK;
}
}
furi_hal_spi_acquire(&furi_hal_spi_bus_handle_sd_fast);
furi_hal_sd_spi_handle = &furi_hal_spi_bus_handle_sd_fast;
if(BSP_SD_ReadBlocks((uint32_t*)buff, (uint32_t)(sector), count, SD_DATATIMEOUT) == MSD_OK) {
if(sd_read_blocks((uint32_t*)buff, (uint32_t)(sector), count, SD_TIMEOUT_MS) ==
SdSpiStatusOK) {
FuriHalCortexTimer timer = furi_hal_cortex_timer_get(SD_TIMEOUT_MS * 1000);
/* wait until the read operation is finished */
while(BSP_SD_GetCardState() != MSD_OK) {
}
res = RES_OK;
while(sd_get_card_state() != SdSpiStatusOK) {
if(furi_hal_cortex_timer_is_expired(timer)) {
res = RES_ERROR;
break;
}
}
}
furi_hal_sd_spi_handle = NULL;
furi_hal_spi_release(&furi_hal_spi_bus_handle_sd_fast);
if(single_sector && res == RES_OK) {
sd_cache_put(sector, (uint32_t*)buff);
}
return res;
/* USER CODE END READ */
}
@@ -157,14 +197,25 @@ DRESULT USER_write(BYTE pdrv, const BYTE* buff, DWORD sector, UINT count) {
UNUSED(pdrv);
DRESULT res = RES_ERROR;
sd_cache_invalidate_range(sector, sector + count);
furi_hal_spi_acquire(&furi_hal_spi_bus_handle_sd_fast);
furi_hal_sd_spi_handle = &furi_hal_spi_bus_handle_sd_fast;
if(BSP_SD_WriteBlocks((uint32_t*)buff, (uint32_t)(sector), count, SD_DATATIMEOUT) == MSD_OK) {
if(sd_write_blocks((uint32_t*)buff, (uint32_t)(sector), count, SD_TIMEOUT_MS) ==
SdSpiStatusOK) {
FuriHalCortexTimer timer = furi_hal_cortex_timer_get(SD_TIMEOUT_MS * 1000);
/* wait until the Write operation is finished */
while(BSP_SD_GetCardState() != MSD_OK) {
}
res = RES_OK;
while(sd_get_card_state() != SdSpiStatusOK) {
if(furi_hal_cortex_timer_is_expired(timer)) {
sd_cache_invalidate_all();
res = RES_ERROR;
break;
}
}
}
furi_hal_sd_spi_handle = NULL;
@@ -187,7 +238,7 @@ DRESULT USER_ioctl(BYTE pdrv, BYTE cmd, void* buff) {
/* USER CODE BEGIN IOCTL */
UNUSED(pdrv);
DRESULT res = RES_ERROR;
BSP_SD_CardInfo CardInfo;
SD_CardInfo CardInfo;
if(Stat & STA_NOINIT) return RES_NOTRDY;
@@ -202,21 +253,21 @@ DRESULT USER_ioctl(BYTE pdrv, BYTE cmd, void* buff) {
/* Get number of sectors on the disk (DWORD) */
case GET_SECTOR_COUNT:
BSP_SD_GetCardInfo(&CardInfo);
sd_get_card_info(&CardInfo);
*(DWORD*)buff = CardInfo.LogBlockNbr;
res = RES_OK;
break;
/* Get R/W sector size (WORD) */
case GET_SECTOR_SIZE:
BSP_SD_GetCardInfo(&CardInfo);
sd_get_card_info(&CardInfo);
*(WORD*)buff = CardInfo.LogBlockSize;
res = RES_OK;
break;
/* Get erase block size in unit of sector (DWORD) */
case GET_BLOCK_SIZE:
BSP_SD_GetCardInfo(&CardInfo);
sd_get_card_info(&CardInfo);
*(DWORD*)buff = CardInfo.LogBlockSize;
res = RES_OK;
break;
+1 -1
View File
@@ -30,7 +30,7 @@ extern "C" {
/* USER CODE BEGIN 0 */
/* Includes ------------------------------------------------------------------*/
#include "stm32_adafruit_sd.h"
#include "sd_spi_io.h"
#include "fatfs/ff_gen_drv.h"
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
+1
View File
@@ -52,6 +52,7 @@ void furi_hal_init() {
furi_hal_version_init();
furi_hal_spi_config_init();
furi_hal_spi_dma_init();
furi_hal_ibutton_init();
FURI_LOG_I(TAG, "iButton OK");
+21 -19
View File
@@ -54,25 +54,27 @@ FuriHalBtProfileConfig profile_config[FuriHalBtProfileNumber] = {
},
},
},
[FuriHalBtProfileHidKeyboard] = {
.start = furi_hal_bt_hid_start,
.stop = furi_hal_bt_hid_stop,
.config =
{
.adv_service_uuid = HUMAN_INTERFACE_DEVICE_SERVICE_UUID,
.appearance_char = GAP_APPEARANCE_KEYBOARD,
.bonding_mode = true,
.pairing_method = GapPairingPinCodeVerifyYesNo,
.mac_address = FURI_HAL_BT_DEFAULT_MAC_ADDR,
.conn_param =
{
.conn_int_min = 0x18, // 30 ms
.conn_int_max = 0x24, // 45 ms
.slave_latency = 0,
.supervisor_timeout = 0,
},
},
}};
[FuriHalBtProfileHidKeyboard] =
{
.start = furi_hal_bt_hid_start,
.stop = furi_hal_bt_hid_stop,
.config =
{
.adv_service_uuid = HUMAN_INTERFACE_DEVICE_SERVICE_UUID,
.appearance_char = GAP_APPEARANCE_KEYBOARD,
.bonding_mode = true,
.pairing_method = GapPairingPinCodeVerifyYesNo,
.mac_address = FURI_HAL_BT_DEFAULT_MAC_ADDR,
.conn_param =
{
.conn_int_min = 0x18, // 30 ms
.conn_int_max = 0x24, // 45 ms
.slave_latency = 0,
.supervisor_timeout = 0,
},
},
},
};
FuriHalBtProfileConfig* current_profile = NULL;
void furi_hal_bt_init() {
@@ -64,6 +64,12 @@ static const uint8_t furi_hal_bt_hid_report_map_data[] = {
HID_REPORT_COUNT(1),
HID_REPORT_SIZE(8),
HID_INPUT(HID_IOF_CONSTANT | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE),
HID_USAGE_PAGE(HID_PAGE_LED),
HID_REPORT_COUNT(8),
HID_REPORT_SIZE(1),
HID_USAGE_MINIMUM(1),
HID_USAGE_MAXIMUM(8),
HID_OUTPUT(HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE),
HID_REPORT_COUNT(FURI_HAL_BT_HID_KB_MAX_KEYS),
HID_REPORT_SIZE(8),
HID_LOGICAL_MINIMUM(0),
@@ -196,6 +202,7 @@ void furi_hal_bt_hid_start() {
if(!hid_svc_is_started()) {
hid_svc_start();
}
// Configure HID Keyboard
hid_svc_register_led_state_callback(furi_hal_bt_hid_led_state_cb, &hid_host_led_state);
+17 -16
View File
@@ -1,6 +1,7 @@
#include <furi.h>
#include <furi_hal_gpio.h>
#include <furi_hal_version.h>
#include <furi_hal_resources.h>
#include <stm32wbxx_ll_comp.h>
#define GET_SYSCFG_EXTI_PORT(gpio) \
@@ -224,85 +225,85 @@ static void furi_hal_gpio_int_call(uint16_t pin_num) {
/* Interrupt handlers */
void EXTI0_IRQHandler(void) {
if(LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_0)) {
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_0);
furi_hal_gpio_int_call(0);
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_0);
}
}
void EXTI1_IRQHandler(void) {
if(LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_1)) {
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_1);
furi_hal_gpio_int_call(1);
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_1);
}
}
void EXTI2_IRQHandler(void) {
if(LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_2)) {
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_2);
furi_hal_gpio_int_call(2);
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_2);
}
}
void EXTI3_IRQHandler(void) {
if(LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_3)) {
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_3);
furi_hal_gpio_int_call(3);
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_3);
}
}
void EXTI4_IRQHandler(void) {
if(LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_4)) {
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_4);
furi_hal_gpio_int_call(4);
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_4);
}
}
void EXTI9_5_IRQHandler(void) {
if(LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_5)) {
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_5);
furi_hal_gpio_int_call(5);
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_5);
}
if(LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_6)) {
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_6);
furi_hal_gpio_int_call(6);
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_6);
}
if(LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_7)) {
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_7);
furi_hal_gpio_int_call(7);
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_7);
}
if(LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_8)) {
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_8);
furi_hal_gpio_int_call(8);
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_8);
}
if(LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_9)) {
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_9);
furi_hal_gpio_int_call(9);
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_9);
}
}
void EXTI15_10_IRQHandler(void) {
if(LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_10)) {
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_10);
furi_hal_gpio_int_call(10);
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_10);
}
if(LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_11)) {
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_11);
furi_hal_gpio_int_call(11);
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_11);
}
if(LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_12)) {
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_12);
furi_hal_gpio_int_call(12);
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_12);
}
if(LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_13)) {
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_13);
furi_hal_gpio_int_call(13);
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_13);
}
if(LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_14)) {
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_14);
furi_hal_gpio_int_call(14);
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_14);
}
if(LL_EXTI_IsActiveFlag_0_31(LL_EXTI_LINE_15)) {
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_15);
furi_hal_gpio_int_call(15);
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_15);
}
}
@@ -89,47 +89,16 @@ void furi_hal_ibutton_emulate_stop() {
}
}
void furi_hal_ibutton_start_drive() {
furi_hal_ibutton_pin_high();
void furi_hal_ibutton_pin_configure() {
furi_hal_gpio_write(&ibutton_gpio, true);
furi_hal_gpio_init(&ibutton_gpio, GpioModeOutputOpenDrain, GpioPullNo, GpioSpeedLow);
}
void furi_hal_ibutton_start_drive_in_isr() {
furi_hal_gpio_init(&ibutton_gpio, GpioModeOutputOpenDrain, GpioPullNo, GpioSpeedLow);
LL_EXTI_ClearFlag_0_31(ibutton_gpio.pin);
}
void furi_hal_ibutton_start_interrupt() {
furi_hal_ibutton_pin_high();
furi_hal_gpio_init(&ibutton_gpio, GpioModeInterruptRiseFall, GpioPullNo, GpioSpeedLow);
}
void furi_hal_ibutton_start_interrupt_in_isr() {
furi_hal_gpio_init(&ibutton_gpio, GpioModeInterruptRiseFall, GpioPullNo, GpioSpeedLow);
LL_EXTI_ClearFlag_0_31(ibutton_gpio.pin);
}
void furi_hal_ibutton_stop() {
furi_hal_ibutton_pin_high();
void furi_hal_ibutton_pin_reset() {
furi_hal_gpio_write(&ibutton_gpio, true);
furi_hal_gpio_init(&ibutton_gpio, GpioModeAnalog, GpioPullNo, GpioSpeedLow);
}
void furi_hal_ibutton_add_interrupt(GpioExtiCallback cb, void* context) {
furi_hal_gpio_add_int_callback(&ibutton_gpio, cb, context);
}
void furi_hal_ibutton_remove_interrupt() {
furi_hal_gpio_remove_int_callback(&ibutton_gpio);
}
void furi_hal_ibutton_pin_low() {
furi_hal_gpio_write(&ibutton_gpio, false);
}
void furi_hal_ibutton_pin_high() {
furi_hal_gpio_write(&ibutton_gpio, true);
}
bool furi_hal_ibutton_pin_get_level() {
return furi_hal_gpio_read(&ibutton_gpio);
void furi_hal_ibutton_pin_write(const bool state) {
furi_hal_gpio_write(&ibutton_gpio, state);
}
+19 -47
View File
@@ -7,7 +7,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <furi_hal_gpio.h>
#ifdef __cplusplus
extern "C" {
@@ -18,70 +17,43 @@ typedef void (*FuriHalIbuttonEmulateCallback)(void* context);
/** Initialize */
void furi_hal_ibutton_init();
/**
* Start emulation timer
* @param period timer period
* @param callback timer callback
* @param context callback context
*/
void furi_hal_ibutton_emulate_start(
uint32_t period,
FuriHalIbuttonEmulateCallback callback,
void* context);
/**
* Update emulation timer period
* @param period new timer period
*/
void furi_hal_ibutton_emulate_set_next(uint32_t period);
/**
* Stop emulation timer
*/
void furi_hal_ibutton_emulate_stop();
/**
* Sets the pin to normal mode (open collector), and sets it to float
* Set the pin to normal mode (open collector), and sets it to float
*/
void furi_hal_ibutton_start_drive();
/**
* Sets the pin to normal mode (open collector), and clears pin EXTI interrupt.
* Used in EXTI interrupt context.
*/
void furi_hal_ibutton_start_drive_in_isr();
/**
* Sets the pin to interrupt mode (EXTI interrupt on rise or fall), and sets it to float
*/
void furi_hal_ibutton_start_interrupt();
/**
* Sets the pin to interrupt mode (EXTI interrupt on rise or fall), and clears pin EXTI interrupt.
* Used in EXTI interrupt context.
*/
void furi_hal_ibutton_start_interrupt_in_isr();
void furi_hal_ibutton_pin_configure();
/**
* Sets the pin to analog mode, and sets it to float
*/
void furi_hal_ibutton_stop();
void furi_hal_ibutton_pin_reset();
/**
* Attach interrupt callback to iButton pin
* @param cb callback
* @param context context
* iButton write pin
* @param state true / false
*/
void furi_hal_ibutton_add_interrupt(GpioExtiCallback cb, void* context);
/**
* Remove interrupt callback from iButton pin
*/
void furi_hal_ibutton_remove_interrupt();
/**
* Sets the pin to low
*/
void furi_hal_ibutton_pin_low();
/**
* Sets the pin to high (float in iButton pin modes)
*/
void furi_hal_ibutton_pin_high();
/**
* Get pin level
* @return true if level is high
* @return false if level is low
*/
bool furi_hal_ibutton_pin_get_level();
void furi_hal_ibutton_pin_write(const bool state);
#ifdef __cplusplus
}
+126 -85
View File
@@ -13,13 +13,6 @@
#include <furi.h>
#include <math.h>
#define INFRARED_TX_DEBUG 0
#if INFRARED_TX_DEBUG == 1
#define gpio_infrared_tx gpio_infrared_tx_debug
const GpioPin gpio_infrared_tx_debug = {.port = GPIOA, .pin = LL_GPIO_PIN_6};
#endif
#define INFRARED_TIM_TX_DMA_BUFFER_SIZE 200
#define INFRARED_POLARITY_SHIFT 1
@@ -28,6 +21,15 @@ const GpioPin gpio_infrared_tx_debug = {.port = GPIOA, .pin = LL_GPIO_PIN_6};
#define INFRARED_TX_CCMR_LOW \
(TIM_CCMR2_OC3PE | LL_TIM_OCMODE_FORCED_INACTIVE) /* Space time - force low */
/* DMA Channels definition */
#define IR_DMA DMA2
#define IR_DMA_CH1_CHANNEL LL_DMA_CHANNEL_1
#define IR_DMA_CH2_CHANNEL LL_DMA_CHANNEL_2
#define IR_DMA_CH1_IRQ FuriHalInterruptIdDma2Ch1
#define IR_DMA_CH2_IRQ FuriHalInterruptIdDma2Ch2
#define IR_DMA_CH1_DEF IR_DMA, IR_DMA_CH1_CHANNEL
#define IR_DMA_CH2_DEF IR_DMA, IR_DMA_CH2_CHANNEL
typedef struct {
FuriHalInfraredRxCaptureCallback capture_callback;
void* capture_context;
@@ -70,6 +72,7 @@ typedef enum {
static volatile InfraredState furi_hal_infrared_state = InfraredStateIdle;
static InfraredTimTx infrared_tim_tx;
static InfraredTimRx infrared_tim_rx;
static bool infrared_external_output;
static void furi_hal_infrared_tx_fill_buffer(uint8_t buf_num, uint8_t polarity_shift);
static void furi_hal_infrared_async_tx_free_resources(void);
@@ -80,6 +83,14 @@ static uint8_t furi_hal_infrared_get_current_dma_tx_buffer(void);
static void furi_hal_infrared_tx_dma_polarity_isr();
static void furi_hal_infrared_tx_dma_isr();
void furi_hal_infrared_set_debug_out(bool enable) {
infrared_external_output = enable;
}
bool furi_hal_infrared_get_debug_out_status(void) {
return infrared_external_output;
}
static void furi_hal_infrared_tim_rx_isr() {
static uint32_t previous_captured_ch2 = 0;
@@ -213,15 +224,15 @@ void furi_hal_infrared_async_rx_set_timeout_isr_callback(
}
static void furi_hal_infrared_tx_dma_terminate(void) {
LL_DMA_DisableIT_TC(DMA1, LL_DMA_CHANNEL_1);
LL_DMA_DisableIT_HT(DMA1, LL_DMA_CHANNEL_2);
LL_DMA_DisableIT_TC(DMA1, LL_DMA_CHANNEL_2);
LL_DMA_DisableIT_TC(IR_DMA_CH1_DEF);
LL_DMA_DisableIT_HT(IR_DMA_CH2_DEF);
LL_DMA_DisableIT_TC(IR_DMA_CH2_DEF);
furi_assert(furi_hal_infrared_state == InfraredStateAsyncTxStopInProgress);
LL_DMA_DisableIT_TC(DMA1, LL_DMA_CHANNEL_1);
LL_DMA_DisableChannel(DMA1, LL_DMA_CHANNEL_2);
LL_DMA_DisableChannel(DMA1, LL_DMA_CHANNEL_1);
LL_DMA_DisableIT_TC(IR_DMA_CH1_DEF);
LL_DMA_DisableChannel(IR_DMA_CH2_DEF);
LL_DMA_DisableChannel(IR_DMA_CH1_DEF);
LL_TIM_DisableCounter(TIM1);
FuriStatus status = furi_semaphore_release(infrared_tim_tx.stop_semaphore);
furi_check(status == FuriStatusOk);
@@ -230,7 +241,7 @@ static void furi_hal_infrared_tx_dma_terminate(void) {
static uint8_t furi_hal_infrared_get_current_dma_tx_buffer(void) {
uint8_t buf_num = 0;
uint32_t buffer_adr = LL_DMA_GetMemoryAddress(DMA1, LL_DMA_CHANNEL_2);
uint32_t buffer_adr = LL_DMA_GetMemoryAddress(IR_DMA_CH2_DEF);
if(buffer_adr == (uint32_t)infrared_tim_tx.buffer[0].data) {
buf_num = 0;
} else if(buffer_adr == (uint32_t)infrared_tim_tx.buffer[1].data) {
@@ -242,12 +253,13 @@ static uint8_t furi_hal_infrared_get_current_dma_tx_buffer(void) {
}
static void furi_hal_infrared_tx_dma_polarity_isr() {
if(LL_DMA_IsActiveFlag_TE1(DMA1)) {
LL_DMA_ClearFlag_TE1(DMA1);
#if IR_DMA_CH1_CHANNEL == LL_DMA_CHANNEL_1
if(LL_DMA_IsActiveFlag_TE1(IR_DMA)) {
LL_DMA_ClearFlag_TE1(IR_DMA);
furi_crash(NULL);
}
if(LL_DMA_IsActiveFlag_TC1(DMA1) && LL_DMA_IsEnabledIT_TC(DMA1, LL_DMA_CHANNEL_1)) {
LL_DMA_ClearFlag_TC1(DMA1);
if(LL_DMA_IsActiveFlag_TC1(IR_DMA) && LL_DMA_IsEnabledIT_TC(IR_DMA_CH1_DEF)) {
LL_DMA_ClearFlag_TC1(IR_DMA);
furi_check(
(furi_hal_infrared_state == InfraredStateAsyncTx) ||
@@ -257,25 +269,29 @@ static void furi_hal_infrared_tx_dma_polarity_isr() {
uint8_t next_buf_num = furi_hal_infrared_get_current_dma_tx_buffer();
furi_hal_infrared_tx_dma_set_polarity(next_buf_num, 0);
}
#else
#error Update this code. Would you kindly?
#endif
}
static void furi_hal_infrared_tx_dma_isr() {
if(LL_DMA_IsActiveFlag_TE2(DMA1)) {
LL_DMA_ClearFlag_TE2(DMA1);
#if IR_DMA_CH2_CHANNEL == LL_DMA_CHANNEL_2
if(LL_DMA_IsActiveFlag_TE2(IR_DMA)) {
LL_DMA_ClearFlag_TE2(IR_DMA);
furi_crash(NULL);
}
if(LL_DMA_IsActiveFlag_HT2(DMA1) && LL_DMA_IsEnabledIT_HT(DMA1, LL_DMA_CHANNEL_2)) {
LL_DMA_ClearFlag_HT2(DMA1);
if(LL_DMA_IsActiveFlag_HT2(IR_DMA) && LL_DMA_IsEnabledIT_HT(IR_DMA_CH2_DEF)) {
LL_DMA_ClearFlag_HT2(IR_DMA);
uint8_t buf_num = furi_hal_infrared_get_current_dma_tx_buffer();
uint8_t next_buf_num = !buf_num;
if(infrared_tim_tx.buffer[buf_num].last_packet_end) {
LL_DMA_DisableIT_HT(DMA1, LL_DMA_CHANNEL_2);
LL_DMA_DisableIT_HT(IR_DMA_CH2_DEF);
} else if(
!infrared_tim_tx.buffer[buf_num].packet_end ||
(furi_hal_infrared_state == InfraredStateAsyncTx)) {
furi_hal_infrared_tx_fill_buffer(next_buf_num, 0);
if(infrared_tim_tx.buffer[next_buf_num].last_packet_end) {
LL_DMA_DisableIT_HT(DMA1, LL_DMA_CHANNEL_2);
LL_DMA_DisableIT_HT(IR_DMA_CH2_DEF);
}
} else if(furi_hal_infrared_state == InfraredStateAsyncTxStopReq) {
/* fallthrough */
@@ -283,8 +299,8 @@ static void furi_hal_infrared_tx_dma_isr() {
furi_crash(NULL);
}
}
if(LL_DMA_IsActiveFlag_TC2(DMA1) && LL_DMA_IsEnabledIT_TC(DMA1, LL_DMA_CHANNEL_2)) {
LL_DMA_ClearFlag_TC2(DMA1);
if(LL_DMA_IsActiveFlag_TC2(IR_DMA) && LL_DMA_IsEnabledIT_TC(IR_DMA_CH2_DEF)) {
LL_DMA_ClearFlag_TC2(IR_DMA);
furi_check(
(furi_hal_infrared_state == InfraredStateAsyncTxStopInProgress) ||
(furi_hal_infrared_state == InfraredStateAsyncTxStopReq) ||
@@ -310,6 +326,9 @@ static void furi_hal_infrared_tx_dma_isr() {
infrared_tim_tx.signal_sent_callback(infrared_tim_tx.signal_sent_context);
}
}
#else
#error Update this code. Would you kindly?
#endif
}
static void furi_hal_infrared_configure_tim_pwm_tx(uint32_t freq, float duty_cycle) {
@@ -323,25 +342,25 @@ static void furi_hal_infrared_configure_tim_pwm_tx(uint32_t freq, float duty_cyc
LL_TIM_EnableARRPreload(TIM1);
LL_TIM_SetAutoReload(
TIM1, __LL_TIM_CALC_ARR(SystemCoreClock, LL_TIM_GetPrescaler(TIM1), freq));
#if INFRARED_TX_DEBUG == 1
LL_TIM_OC_SetCompareCH1(TIM1, ((LL_TIM_GetAutoReload(TIM1) + 1) * (1 - duty_cycle)));
LL_TIM_OC_EnablePreload(TIM1, LL_TIM_CHANNEL_CH1);
/* LL_TIM_OCMODE_PWM2 set by DMA */
LL_TIM_OC_SetMode(TIM1, LL_TIM_CHANNEL_CH1, LL_TIM_OCMODE_FORCED_INACTIVE);
LL_TIM_OC_SetPolarity(TIM1, LL_TIM_CHANNEL_CH1N, LL_TIM_OCPOLARITY_HIGH);
LL_TIM_OC_DisableFast(TIM1, LL_TIM_CHANNEL_CH1);
LL_TIM_CC_EnableChannel(TIM1, LL_TIM_CHANNEL_CH1N);
LL_TIM_DisableIT_CC1(TIM1);
#else
LL_TIM_OC_SetCompareCH3(TIM1, ((LL_TIM_GetAutoReload(TIM1) + 1) * (1 - duty_cycle)));
LL_TIM_OC_EnablePreload(TIM1, LL_TIM_CHANNEL_CH3);
/* LL_TIM_OCMODE_PWM2 set by DMA */
LL_TIM_OC_SetMode(TIM1, LL_TIM_CHANNEL_CH3, LL_TIM_OCMODE_FORCED_INACTIVE);
LL_TIM_OC_SetPolarity(TIM1, LL_TIM_CHANNEL_CH3N, LL_TIM_OCPOLARITY_HIGH);
LL_TIM_OC_DisableFast(TIM1, LL_TIM_CHANNEL_CH3);
LL_TIM_CC_EnableChannel(TIM1, LL_TIM_CHANNEL_CH3N);
LL_TIM_DisableIT_CC3(TIM1);
#endif
if(infrared_external_output) {
LL_TIM_OC_SetCompareCH1(TIM1, ((LL_TIM_GetAutoReload(TIM1) + 1) * (1 - duty_cycle)));
LL_TIM_OC_EnablePreload(TIM1, LL_TIM_CHANNEL_CH1);
/* LL_TIM_OCMODE_PWM2 set by DMA */
LL_TIM_OC_SetMode(TIM1, LL_TIM_CHANNEL_CH1, LL_TIM_OCMODE_FORCED_INACTIVE);
LL_TIM_OC_SetPolarity(TIM1, LL_TIM_CHANNEL_CH1N, LL_TIM_OCPOLARITY_HIGH);
LL_TIM_OC_DisableFast(TIM1, LL_TIM_CHANNEL_CH1);
LL_TIM_CC_EnableChannel(TIM1, LL_TIM_CHANNEL_CH1N);
LL_TIM_DisableIT_CC1(TIM1);
} else {
LL_TIM_OC_SetCompareCH3(TIM1, ((LL_TIM_GetAutoReload(TIM1) + 1) * (1 - duty_cycle)));
LL_TIM_OC_EnablePreload(TIM1, LL_TIM_CHANNEL_CH3);
/* LL_TIM_OCMODE_PWM2 set by DMA */
LL_TIM_OC_SetMode(TIM1, LL_TIM_CHANNEL_CH3, LL_TIM_OCMODE_FORCED_INACTIVE);
LL_TIM_OC_SetPolarity(TIM1, LL_TIM_CHANNEL_CH3N, LL_TIM_OCPOLARITY_HIGH);
LL_TIM_OC_DisableFast(TIM1, LL_TIM_CHANNEL_CH3);
LL_TIM_CC_EnableChannel(TIM1, LL_TIM_CHANNEL_CH3N);
LL_TIM_DisableIT_CC3(TIM1);
}
LL_TIM_DisableMasterSlaveMode(TIM1);
LL_TIM_EnableAllOutputs(TIM1);
LL_TIM_DisableIT_UPDATE(TIM1);
@@ -353,11 +372,11 @@ static void furi_hal_infrared_configure_tim_pwm_tx(uint32_t freq, float duty_cyc
static void furi_hal_infrared_configure_tim_cmgr2_dma_tx(void) {
LL_DMA_InitTypeDef dma_config = {0};
#if INFRARED_TX_DEBUG == 1
dma_config.PeriphOrM2MSrcAddress = (uint32_t) & (TIM1->CCMR1);
#else
dma_config.PeriphOrM2MSrcAddress = (uint32_t) & (TIM1->CCMR2);
#endif
if(infrared_external_output) {
dma_config.PeriphOrM2MSrcAddress = (uint32_t) & (TIM1->CCMR1);
} else {
dma_config.PeriphOrM2MSrcAddress = (uint32_t) & (TIM1->CCMR2);
}
dma_config.MemoryOrM2MDstAddress = (uint32_t)NULL;
dma_config.Direction = LL_DMA_DIRECTION_MEMORY_TO_PERIPH;
dma_config.Mode = LL_DMA_MODE_NORMAL;
@@ -369,16 +388,19 @@ static void furi_hal_infrared_configure_tim_cmgr2_dma_tx(void) {
dma_config.NbData = 0;
dma_config.PeriphRequest = LL_DMAMUX_REQ_TIM1_UP;
dma_config.Priority = LL_DMA_PRIORITY_VERYHIGH;
LL_DMA_Init(DMA1, LL_DMA_CHANNEL_1, &dma_config);
LL_DMA_Init(IR_DMA_CH1_DEF, &dma_config);
LL_DMA_ClearFlag_TE1(DMA1);
LL_DMA_ClearFlag_TC1(DMA1);
#if IR_DMA_CH1_CHANNEL == LL_DMA_CHANNEL_1
LL_DMA_ClearFlag_TE1(IR_DMA);
LL_DMA_ClearFlag_TC1(IR_DMA);
#else
#error Update this code. Would you kindly?
#endif
LL_DMA_EnableIT_TE(DMA1, LL_DMA_CHANNEL_1);
LL_DMA_EnableIT_TC(DMA1, LL_DMA_CHANNEL_1);
LL_DMA_EnableIT_TE(IR_DMA_CH1_DEF);
LL_DMA_EnableIT_TC(IR_DMA_CH1_DEF);
furi_hal_interrupt_set_isr_ex(
FuriHalInterruptIdDma1Ch1, 4, furi_hal_infrared_tx_dma_polarity_isr, NULL);
furi_hal_interrupt_set_isr_ex(IR_DMA_CH1_IRQ, 4, furi_hal_infrared_tx_dma_polarity_isr, NULL);
}
static void furi_hal_infrared_configure_tim_rcr_dma_tx(void) {
@@ -394,18 +416,21 @@ static void furi_hal_infrared_configure_tim_rcr_dma_tx(void) {
dma_config.NbData = 0;
dma_config.PeriphRequest = LL_DMAMUX_REQ_TIM1_UP;
dma_config.Priority = LL_DMA_PRIORITY_MEDIUM;
LL_DMA_Init(DMA1, LL_DMA_CHANNEL_2, &dma_config);
LL_DMA_Init(IR_DMA_CH2_DEF, &dma_config);
LL_DMA_ClearFlag_TC2(DMA1);
LL_DMA_ClearFlag_HT2(DMA1);
LL_DMA_ClearFlag_TE2(DMA1);
#if IR_DMA_CH2_CHANNEL == LL_DMA_CHANNEL_2
LL_DMA_ClearFlag_TC2(IR_DMA);
LL_DMA_ClearFlag_HT2(IR_DMA);
LL_DMA_ClearFlag_TE2(IR_DMA);
#else
#error Update this code. Would you kindly?
#endif
LL_DMA_EnableIT_TC(DMA1, LL_DMA_CHANNEL_2);
LL_DMA_EnableIT_HT(DMA1, LL_DMA_CHANNEL_2);
LL_DMA_EnableIT_TE(DMA1, LL_DMA_CHANNEL_2);
LL_DMA_EnableIT_TC(IR_DMA_CH2_DEF);
LL_DMA_EnableIT_HT(IR_DMA_CH2_DEF);
LL_DMA_EnableIT_TE(IR_DMA_CH2_DEF);
furi_hal_interrupt_set_isr_ex(
FuriHalInterruptIdDma1Ch2, 5, furi_hal_infrared_tx_dma_isr, NULL);
furi_hal_interrupt_set_isr_ex(IR_DMA_CH2_IRQ, 5, furi_hal_infrared_tx_dma_isr, NULL);
}
static void furi_hal_infrared_tx_fill_buffer_last(uint8_t buf_num) {
@@ -507,14 +532,14 @@ static void furi_hal_infrared_tx_dma_set_polarity(uint8_t buf_num, uint8_t polar
furi_assert(buffer->polarity != NULL);
FURI_CRITICAL_ENTER();
bool channel_enabled = LL_DMA_IsEnabledChannel(DMA1, LL_DMA_CHANNEL_1);
bool channel_enabled = LL_DMA_IsEnabledChannel(IR_DMA_CH1_DEF);
if(channel_enabled) {
LL_DMA_DisableChannel(DMA1, LL_DMA_CHANNEL_1);
LL_DMA_DisableChannel(IR_DMA_CH1_DEF);
}
LL_DMA_SetMemoryAddress(DMA1, LL_DMA_CHANNEL_1, (uint32_t)buffer->polarity);
LL_DMA_SetDataLength(DMA1, LL_DMA_CHANNEL_1, buffer->size + polarity_shift);
LL_DMA_SetMemoryAddress(IR_DMA_CH1_DEF, (uint32_t)buffer->polarity);
LL_DMA_SetDataLength(IR_DMA_CH1_DEF, buffer->size + polarity_shift);
if(channel_enabled) {
LL_DMA_EnableChannel(DMA1, LL_DMA_CHANNEL_1);
LL_DMA_EnableChannel(IR_DMA_CH1_DEF);
}
FURI_CRITICAL_EXIT();
}
@@ -527,14 +552,14 @@ static void furi_hal_infrared_tx_dma_set_buffer(uint8_t buf_num) {
/* non-circular mode requires disabled channel before setup */
FURI_CRITICAL_ENTER();
bool channel_enabled = LL_DMA_IsEnabledChannel(DMA1, LL_DMA_CHANNEL_2);
bool channel_enabled = LL_DMA_IsEnabledChannel(IR_DMA_CH2_DEF);
if(channel_enabled) {
LL_DMA_DisableChannel(DMA1, LL_DMA_CHANNEL_2);
LL_DMA_DisableChannel(IR_DMA_CH2_DEF);
}
LL_DMA_SetMemoryAddress(DMA1, LL_DMA_CHANNEL_2, (uint32_t)buffer->data);
LL_DMA_SetDataLength(DMA1, LL_DMA_CHANNEL_2, buffer->size);
LL_DMA_SetMemoryAddress(IR_DMA_CH2_DEF, (uint32_t)buffer->data);
LL_DMA_SetDataLength(IR_DMA_CH2_DEF, buffer->size);
if(channel_enabled) {
LL_DMA_EnableChannel(DMA1, LL_DMA_CHANNEL_2);
LL_DMA_EnableChannel(IR_DMA_CH2_DEF);
}
FURI_CRITICAL_EXIT();
}
@@ -544,9 +569,13 @@ static void furi_hal_infrared_async_tx_free_resources(void) {
(furi_hal_infrared_state == InfraredStateIdle) ||
(furi_hal_infrared_state == InfraredStateAsyncTxStopped));
furi_hal_gpio_init(&gpio_infrared_tx, GpioModeOutputOpenDrain, GpioPullDown, GpioSpeedLow);
furi_hal_interrupt_set_isr(FuriHalInterruptIdDma1Ch1, NULL, NULL);
furi_hal_interrupt_set_isr(FuriHalInterruptIdDma1Ch2, NULL, NULL);
if(infrared_external_output) {
furi_hal_gpio_init(&gpio_ext_pa7, GpioModeOutputOpenDrain, GpioPullDown, GpioSpeedLow);
} else {
furi_hal_gpio_init(&gpio_infrared_tx, GpioModeOutputOpenDrain, GpioPullDown, GpioSpeedLow);
}
furi_hal_interrupt_set_isr(IR_DMA_CH1_IRQ, NULL, NULL);
furi_hal_interrupt_set_isr(IR_DMA_CH2_IRQ, NULL, NULL);
LL_TIM_DeInit(TIM1);
furi_semaphore_free(infrared_tim_tx.stop_semaphore);
@@ -597,15 +626,27 @@ void furi_hal_infrared_async_tx_start(uint32_t freq, float duty_cycle) {
furi_hal_infrared_state = InfraredStateAsyncTx;
LL_TIM_ClearFlag_UPDATE(TIM1);
LL_DMA_EnableChannel(DMA1, LL_DMA_CHANNEL_1);
LL_DMA_EnableChannel(DMA1, LL_DMA_CHANNEL_2);
LL_DMA_EnableChannel(IR_DMA_CH1_DEF);
LL_DMA_EnableChannel(IR_DMA_CH2_DEF);
furi_delay_us(5);
LL_TIM_GenerateEvent_UPDATE(TIM1); /* DMA -> TIMx_RCR */
furi_delay_us(5);
LL_GPIO_ResetOutputPin(
gpio_infrared_tx.port, gpio_infrared_tx.pin); /* when disable it prevents false pulse */
furi_hal_gpio_init_ex(
&gpio_infrared_tx, GpioModeAltFunctionPushPull, GpioPullUp, GpioSpeedHigh, GpioAltFn1TIM1);
if(infrared_external_output) {
LL_GPIO_ResetOutputPin(
gpio_ext_pa7.port, gpio_ext_pa7.pin); /* when disable it prevents false pulse */
furi_hal_gpio_init_ex(
&gpio_ext_pa7, GpioModeAltFunctionPushPull, GpioPullUp, GpioSpeedHigh, GpioAltFn1TIM1);
} else {
LL_GPIO_ResetOutputPin(
gpio_infrared_tx.port,
gpio_infrared_tx.pin); /* when disable it prevents false pulse */
furi_hal_gpio_init_ex(
&gpio_infrared_tx,
GpioModeAltFunctionPushPull,
GpioPullUp,
GpioSpeedHigh,
GpioAltFn1TIM1);
}
FURI_CRITICAL_ENTER();
LL_TIM_GenerateEvent_UPDATE(TIM1); /* TIMx_RCR -> Repetition counter */
@@ -74,6 +74,21 @@ __attribute__((always_inline)) static inline void
NVIC_EnableIRQ(furi_hal_interrupt_irqn[index]);
}
__attribute__((always_inline)) static inline void
furi_hal_interrupt_clear_pending(FuriHalInterruptId index) {
NVIC_ClearPendingIRQ(furi_hal_interrupt_irqn[index]);
}
__attribute__((always_inline)) static inline void
furi_hal_interrupt_get_pending(FuriHalInterruptId index) {
NVIC_GetPendingIRQ(furi_hal_interrupt_irqn[index]);
}
__attribute__((always_inline)) static inline void
furi_hal_interrupt_set_pending(FuriHalInterruptId index) {
NVIC_SetPendingIRQ(furi_hal_interrupt_irqn[index]);
}
__attribute__((always_inline)) static inline void
furi_hal_interrupt_disable(FuriHalInterruptId index) {
NVIC_DisableIRQ(furi_hal_interrupt_irqn[index]);
@@ -123,6 +138,7 @@ void furi_hal_interrupt_set_isr_ex(
// Pre ISR clear
furi_assert(furi_hal_interrupt_isr[index].isr != NULL);
furi_hal_interrupt_disable(index);
furi_hal_interrupt_clear_pending(index);
}
furi_hal_interrupt_isr[index].isr = isr;
@@ -131,6 +147,7 @@ void furi_hal_interrupt_set_isr_ex(
if(isr) {
// Post ISR set
furi_hal_interrupt_clear_pending(index);
furi_hal_interrupt_enable(index, priority);
} else {
// Post ISR clear
@@ -341,14 +341,14 @@ bool furi_hal_power_is_otg_enabled() {
return ret;
}
float furi_hal_power_get_battery_charging_voltage() {
float furi_hal_power_get_battery_charge_voltage_limit() {
furi_hal_i2c_acquire(&furi_hal_i2c_handle_power);
float ret = (float)bq25896_get_vreg_voltage(&furi_hal_i2c_handle_power) / 1000.0f;
furi_hal_i2c_release(&furi_hal_i2c_handle_power);
return ret;
}
void furi_hal_power_set_battery_charging_voltage(float voltage) {
void furi_hal_power_set_battery_charge_voltage_limit(float voltage) {
furi_hal_i2c_acquire(&furi_hal_i2c_handle_power);
// Adding 0.0005 is necessary because 4.016f is 4.015999794000, which gets truncated
bq25896_set_vreg_voltage(&furi_hal_i2c_handle_power, (uint16_t)(voltage * 1000.0f + 0.0005f));
@@ -486,7 +486,7 @@ void furi_hal_power_info_get(PropertyValueCallback out, char sep, void* context)
property_value_out(&property_context, NULL, 2, "format", "major", "2");
property_value_out(&property_context, NULL, 2, "format", "minor", "1");
} else {
property_value_out(&property_context, NULL, 3, "power", "info", "major", "1");
property_value_out(&property_context, NULL, 3, "power", "info", "major", "2");
property_value_out(&property_context, NULL, 3, "power", "info", "minor", "1");
}
@@ -505,8 +505,10 @@ void furi_hal_power_info_get(PropertyValueCallback out, char sep, void* context)
}
property_value_out(&property_context, NULL, 2, "charge", "state", charge_state);
uint16_t charge_voltage = (uint16_t)(furi_hal_power_get_battery_charging_voltage() * 1000.f);
property_value_out(&property_context, "%u", 2, "charge", "voltage", charge_voltage);
uint16_t charge_voltage_limit =
(uint16_t)(furi_hal_power_get_battery_charge_voltage_limit() * 1000.f);
property_value_out(
&property_context, "%u", 3, "charge", "voltage", "limit", charge_voltage_limit);
uint16_t voltage =
(uint16_t)(furi_hal_power_get_battery_voltage(FuriHalPowerICFuelGauge) * 1000.f);
property_value_out(&property_context, "%u", 2, "battery", "voltage", voltage);
@@ -1,6 +1,7 @@
#include <furi_hal_random.h>
#include <furi.h>
#include <furi_hal.h>
#include <stm32wbxx_ll_rng.h>
#include <stm32wbxx_ll_hsem.h>
+34 -22
View File
@@ -21,6 +21,14 @@
#define RFID_CAPTURE_IND_CH LL_TIM_CHANNEL_CH3
#define RFID_CAPTURE_DIR_CH LL_TIM_CHANNEL_CH4
/* DMA Channels definition */
#define RFID_DMA DMA2
#define RFID_DMA_CH1_CHANNEL LL_DMA_CHANNEL_1
#define RFID_DMA_CH2_CHANNEL LL_DMA_CHANNEL_2
#define RFID_DMA_CH1_IRQ FuriHalInterruptIdDma2Ch1
#define RFID_DMA_CH1_DEF RFID_DMA, RFID_DMA_CH1_CHANNEL
#define RFID_DMA_CH2_DEF RFID_DMA, RFID_DMA_CH2_CHANNEL
typedef struct {
FuriHalRfidEmulateCallback callback;
FuriHalRfidDMACallback dma_callback;
@@ -69,7 +77,7 @@ void furi_hal_rfid_init() {
void furi_hal_rfid_pins_reset() {
// ibutton bus disable
furi_hal_ibutton_stop();
furi_hal_ibutton_pin_reset();
// pulldown rfid antenna
furi_hal_gpio_init(&gpio_rfid_carrier_out, GpioModeOutputPushPull, GpioPullNo, GpioSpeedLow);
@@ -86,8 +94,8 @@ void furi_hal_rfid_pins_reset() {
void furi_hal_rfid_pins_emulate() {
// ibutton low
furi_hal_ibutton_start_drive();
furi_hal_ibutton_pin_low();
furi_hal_ibutton_pin_configure();
furi_hal_ibutton_pin_write(false);
// pull pin to timer out
furi_hal_gpio_init_ex(
@@ -107,8 +115,8 @@ void furi_hal_rfid_pins_emulate() {
void furi_hal_rfid_pins_read() {
// ibutton low
furi_hal_ibutton_start_drive();
furi_hal_ibutton_pin_low();
furi_hal_ibutton_pin_configure();
furi_hal_ibutton_pin_write(false);
// dont pull rfid antenna
furi_hal_gpio_init(&gpio_nfc_irq_rfid_pull, GpioModeOutputPushPull, GpioPullNo, GpioSpeedLow);
@@ -302,15 +310,19 @@ void furi_hal_rfid_tim_read_capture_stop() {
}
static void furi_hal_rfid_dma_isr() {
if(LL_DMA_IsActiveFlag_HT1(DMA1)) {
LL_DMA_ClearFlag_HT1(DMA1);
#if RFID_DMA_CH1_CHANNEL == LL_DMA_CHANNEL_1
if(LL_DMA_IsActiveFlag_HT1(RFID_DMA)) {
LL_DMA_ClearFlag_HT1(RFID_DMA);
furi_hal_rfid->dma_callback(true, furi_hal_rfid->context);
}
if(LL_DMA_IsActiveFlag_TC1(DMA1)) {
LL_DMA_ClearFlag_TC1(DMA1);
if(LL_DMA_IsActiveFlag_TC1(RFID_DMA)) {
LL_DMA_ClearFlag_TC1(RFID_DMA);
furi_hal_rfid->dma_callback(false, furi_hal_rfid->context);
}
#else
#error Update this code. Would you kindly?
#endif
}
void furi_hal_rfid_tim_emulate_dma_start(
@@ -347,8 +359,8 @@ void furi_hal_rfid_tim_emulate_dma_start(
dma_config.NbData = length;
dma_config.PeriphRequest = LL_DMAMUX_REQ_TIM2_UP;
dma_config.Priority = LL_DMA_MODE_NORMAL;
LL_DMA_Init(DMA1, LL_DMA_CHANNEL_1, &dma_config);
LL_DMA_EnableChannel(DMA1, LL_DMA_CHANNEL_1);
LL_DMA_Init(RFID_DMA_CH1_DEF, &dma_config);
LL_DMA_EnableChannel(RFID_DMA_CH1_DEF);
// configure DMA "mem -> CCR3" channel
#if FURI_HAL_RFID_EMULATE_TIMER_CHANNEL == LL_TIM_CHANNEL_CH3
@@ -366,13 +378,13 @@ void furi_hal_rfid_tim_emulate_dma_start(
dma_config.NbData = length;
dma_config.PeriphRequest = LL_DMAMUX_REQ_TIM2_UP;
dma_config.Priority = LL_DMA_MODE_NORMAL;
LL_DMA_Init(DMA1, LL_DMA_CHANNEL_2, &dma_config);
LL_DMA_EnableChannel(DMA1, LL_DMA_CHANNEL_2);
LL_DMA_Init(RFID_DMA_CH2_DEF, &dma_config);
LL_DMA_EnableChannel(RFID_DMA_CH2_DEF);
// attach interrupt to one of DMA channels
furi_hal_interrupt_set_isr(FuriHalInterruptIdDma1Ch1, furi_hal_rfid_dma_isr, NULL);
LL_DMA_EnableIT_TC(DMA1, LL_DMA_CHANNEL_1);
LL_DMA_EnableIT_HT(DMA1, LL_DMA_CHANNEL_1);
furi_hal_interrupt_set_isr(RFID_DMA_CH1_IRQ, furi_hal_rfid_dma_isr, NULL);
LL_DMA_EnableIT_TC(RFID_DMA_CH1_DEF);
LL_DMA_EnableIT_HT(RFID_DMA_CH1_DEF);
// start
LL_TIM_EnableAllOutputs(FURI_HAL_RFID_EMULATE_TIMER);
@@ -385,14 +397,14 @@ void furi_hal_rfid_tim_emulate_dma_stop() {
LL_TIM_DisableCounter(FURI_HAL_RFID_EMULATE_TIMER);
LL_TIM_DisableAllOutputs(FURI_HAL_RFID_EMULATE_TIMER);
furi_hal_interrupt_set_isr(FuriHalInterruptIdDma1Ch1, NULL, NULL);
LL_DMA_DisableIT_TC(DMA1, LL_DMA_CHANNEL_1);
LL_DMA_DisableIT_HT(DMA1, LL_DMA_CHANNEL_1);
furi_hal_interrupt_set_isr(RFID_DMA_CH1_IRQ, NULL, NULL);
LL_DMA_DisableIT_TC(RFID_DMA_CH1_DEF);
LL_DMA_DisableIT_HT(RFID_DMA_CH1_DEF);
FURI_CRITICAL_ENTER();
LL_DMA_DeInit(DMA1, LL_DMA_CHANNEL_1);
LL_DMA_DeInit(DMA1, LL_DMA_CHANNEL_2);
LL_DMA_DeInit(RFID_DMA_CH1_DEF);
LL_DMA_DeInit(RFID_DMA_CH2_DEF);
LL_TIM_DeInit(FURI_HAL_RFID_EMULATE_TIMER);
FURI_CRITICAL_EXIT();
@@ -471,4 +483,4 @@ void COMP_IRQHandler() {
(LL_COMP_ReadOutputLevel(COMP1) == LL_COMP_OUTPUT_LEVEL_LOW),
furi_hal_rfid_comp_callback_context);
}
}
}
+1 -1
View File
@@ -409,4 +409,4 @@ uint32_t furi_hal_rtc_datetime_to_timestamp(FuriHalRtcDateTime* datetime) {
timestamp += datetime->second;
return timestamp;
}
}
@@ -39,6 +39,7 @@ volatile FuriHalSubGhz furi_hal_subghz = {
.radio_type = SubGhzRadioInternal,
.spi_bus_handle = &furi_hal_spi_bus_handle_subghz,
.cc1101_g0_pin = &gpio_cc1101_g0,
.rolling_counter_mult = 1,
};
bool furi_hal_subghz_set_radio_type(SubGhzRadioType state) {
@@ -62,6 +63,14 @@ SubGhzRadioType furi_hal_subghz_get_radio_type(void) {
return furi_hal_subghz.radio_type;
}
uint8_t furi_hal_subghz_get_rolling_counter_mult(void) {
return furi_hal_subghz.rolling_counter_mult;
}
void furi_hal_subghz_set_rolling_counter_mult(uint8_t mult) {
furi_hal_subghz.rolling_counter_mult = mult;
}
void furi_hal_subghz_set_async_mirror_pin(const GpioPin* pin) {
furi_hal_subghz.async_mirror_pin = pin;
}
@@ -77,6 +77,7 @@ typedef struct {
SubGhzRadioType radio_type;
FuriHalSpiBusHandle* spi_bus_handle;
const GpioPin* cc1101_g0_pin;
uint8_t rolling_counter_mult;
} FuriHalSubGhz;
extern volatile FuriHalSubGhz furi_hal_subghz;
@@ -309,6 +310,16 @@ void furi_hal_subghz_enable_ext_power(void);
*/
void furi_hal_subghz_disable_ext_power(void);
/** Get the current rolling protocols counter ++ value
* @return uint8_t current value
*/
uint8_t furi_hal_subghz_get_rolling_counter_mult(void);
/** Set the current rolling protocols counter ++ value
* @param mult uint8_t = 1, 2, 4, 8
*/
void furi_hal_subghz_set_rolling_counter_mult(uint8_t mult);
#ifdef __cplusplus
}
#endif
+2 -2
View File
@@ -23,8 +23,8 @@ static FATFS* pfs = NULL;
}
static bool flipper_update_mount_sd() {
for(int i = 0; i < BSP_SD_MaxMountRetryCount(); ++i) {
if(BSP_SD_Init((i % 2) == 0) != MSD_OK) {
for(int i = 0; i < sd_max_mount_retry_count(); ++i) {
if(sd_init((i % 2) == 0) != SdSpiStatusOK) {
/* Next attempt will be without card reset, let it settle */
furi_delay_ms(1000);
continue;
@@ -48,6 +48,12 @@ typedef void (*FuriHalInfraredRxCaptureCallback)(void* ctx, bool level, uint32_t
*/
typedef void (*FuriHalInfraredRxTimeoutCallback)(void* ctx);
// Debug TX pin set
void furi_hal_infrared_set_debug_out(bool enable);
// Debug TX pin get status
bool furi_hal_infrared_get_debug_out_status(void);
/** Initialize INFRARED RX timer to receive interrupts.
*
* It provides interrupts for every RX-signal edge changing with its duration.
@@ -121,21 +121,21 @@ void furi_hal_power_check_otg_status();
*/
bool furi_hal_power_is_otg_enabled();
/** Get battery charging voltage in V
/** Get battery charge voltage limit in V
*
* @return voltage in V
*/
float furi_hal_power_get_battery_charging_voltage();
float furi_hal_power_get_battery_charge_voltage_limit();
/** Set battery charging voltage in V
/** Set battery charge voltage limit in V
*
* Invalid values will be clamped to the nearest valid value.
* Invalid values will be clamped downward to the nearest valid value.
*
* @param voltage[in] voltage in V
*
* @return voltage in V
*/
void furi_hal_power_set_battery_charging_voltage(float voltage);
void furi_hal_power_set_battery_charge_voltage_limit(float voltage);
/** Get remaining battery battery capacity in mAh
*