@@ -54,29 +54,28 @@ void ws_get_frequency_modulation(
54
54
55
55
void ws_begin (WeatherStationApp * app , uint8_t * preset_data ) {
56
56
furi_assert (app );
57
- UNUSED (preset_data );
58
- furi_hal_subghz_reset ();
59
- furi_hal_subghz_idle ();
60
- furi_hal_subghz_load_custom_preset (preset_data );
61
- furi_hal_gpio_init (furi_hal_subghz .cc1101_g0_pin , GpioModeInput , GpioPullNo , GpioSpeedLow );
57
+ subghz_devices_reset (app -> txrx -> radio_device );
58
+ subghz_devices_idle (app -> txrx -> radio_device );
59
+ subghz_devices_load_preset (app -> txrx -> radio_device , FuriHalSubGhzPresetCustom , preset_data );
62
60
app -> txrx -> txrx_state = WSTxRxStateIDLE ;
63
61
}
64
62
65
63
uint32_t ws_rx (WeatherStationApp * app , uint32_t frequency ) {
66
64
furi_assert (app );
67
- if (!furi_hal_subghz_is_frequency_valid ( frequency )) {
65
+ if (!subghz_devices_is_frequency_valid ( app -> txrx -> radio_device , frequency )) {
68
66
furi_crash ("WeatherStation: Incorrect RX frequency." );
69
67
}
70
68
furi_assert (
71
69
app -> txrx -> txrx_state != WSTxRxStateRx && app -> txrx -> txrx_state != WSTxRxStateSleep );
72
70
73
- furi_hal_subghz_idle ();
74
- uint32_t value = furi_hal_subghz_set_frequency_and_path (frequency );
75
- furi_hal_gpio_init (furi_hal_subghz .cc1101_g0_pin , GpioModeInput , GpioPullNo , GpioSpeedLow );
76
- furi_hal_subghz_flush_rx ();
77
- furi_hal_subghz_rx ();
71
+ subghz_devices_idle (app -> txrx -> radio_device );
72
+ uint32_t value = subghz_devices_set_frequency (app -> txrx -> radio_device , frequency );
73
+ subghz_devices_flush_rx (app -> txrx -> radio_device );
74
+ subghz_devices_set_rx (app -> txrx -> radio_device );
75
+
76
+ subghz_devices_start_async_rx (
77
+ app -> txrx -> radio_device , subghz_worker_rx_callback , app -> txrx -> worker );
78
78
79
- furi_hal_subghz_start_async_rx (subghz_worker_rx_callback , app -> txrx -> worker );
80
79
subghz_worker_start (app -> txrx -> worker );
81
80
app -> txrx -> txrx_state = WSTxRxStateRx ;
82
81
return value ;
@@ -85,7 +84,7 @@ uint32_t ws_rx(WeatherStationApp* app, uint32_t frequency) {
85
84
void ws_idle (WeatherStationApp * app ) {
86
85
furi_assert (app );
87
86
furi_assert (app -> txrx -> txrx_state != WSTxRxStateSleep );
88
- furi_hal_subghz_idle ( );
87
+ subghz_devices_idle ( app -> txrx -> radio_device );
89
88
app -> txrx -> txrx_state = WSTxRxStateIDLE ;
90
89
}
91
90
@@ -94,15 +93,15 @@ void ws_rx_end(WeatherStationApp* app) {
94
93
furi_assert (app -> txrx -> txrx_state == WSTxRxStateRx );
95
94
if (subghz_worker_is_running (app -> txrx -> worker )) {
96
95
subghz_worker_stop (app -> txrx -> worker );
97
- furi_hal_subghz_stop_async_rx ( );
96
+ subghz_devices_stop_async_rx ( app -> txrx -> radio_device );
98
97
}
99
- furi_hal_subghz_idle ( );
98
+ subghz_devices_idle ( app -> txrx -> radio_device );
100
99
app -> txrx -> txrx_state = WSTxRxStateIDLE ;
101
100
}
102
101
103
102
void ws_sleep (WeatherStationApp * app ) {
104
103
furi_assert (app );
105
- furi_hal_subghz_sleep ( );
104
+ subghz_devices_sleep ( app -> txrx -> radio_device );
106
105
app -> txrx -> txrx_state = WSTxRxStateSleep ;
107
106
}
108
107
@@ -125,7 +124,7 @@ void ws_hopper_update(WeatherStationApp* app) {
125
124
float rssi = -127.0f ;
126
125
if (app -> txrx -> hopper_state != WSHopperStateRSSITimeOut ) {
127
126
// See RSSI Calculation timings in CC1101 17.3 RSSI
128
- rssi = furi_hal_subghz_get_rssi ( );
127
+ rssi = subghz_devices_get_rssi ( app -> txrx -> radio_device );
129
128
130
129
// Stay if RSSI is high enough
131
130
if (rssi > -90.0f ) {
0 commit comments