2023-05-30 22:18:54 +03:00
|
|
|
#include "custom_btn_i.h"
|
2023-04-01 21:37:04 +03:00
|
|
|
|
2023-05-13 14:43:11 +03:00
|
|
|
static uint8_t custom_btn_id = SUBGHZ_CUSTOM_BTN_OK;
|
2023-04-09 23:56:41 +03:00
|
|
|
static uint8_t custom_btn_original = 0;
|
2023-04-01 21:37:04 +03:00
|
|
|
static uint8_t custom_btn_max_btns = 0;
|
2023-05-30 22:18:54 +03:00
|
|
|
static uint8_t controller_programming_mode = PROG_MODE_OFF;
|
2023-04-01 21:37:04 +03:00
|
|
|
|
2023-05-14 01:34:43 +03:00
|
|
|
bool subghz_custom_btn_set(uint8_t btn_id) {
|
2023-05-13 14:43:11 +03:00
|
|
|
if(btn_id > custom_btn_max_btns) {
|
|
|
|
custom_btn_id = SUBGHZ_CUSTOM_BTN_OK;
|
2023-05-14 01:34:43 +03:00
|
|
|
return false;
|
2023-04-01 21:37:04 +03:00
|
|
|
} else {
|
2023-05-13 14:43:11 +03:00
|
|
|
custom_btn_id = btn_id;
|
2023-05-14 01:34:43 +03:00
|
|
|
return true;
|
2023-04-01 21:37:04 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8_t subghz_custom_btn_get() {
|
|
|
|
return custom_btn_id;
|
|
|
|
}
|
|
|
|
|
2023-05-13 14:43:11 +03:00
|
|
|
void subghz_custom_btn_set_original(uint8_t btn_code) {
|
|
|
|
custom_btn_original = btn_code;
|
2023-04-01 21:37:04 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
uint8_t subghz_custom_btn_get_original() {
|
|
|
|
return custom_btn_original;
|
|
|
|
}
|
|
|
|
|
|
|
|
void subghz_custom_btn_set_max(uint8_t b) {
|
|
|
|
custom_btn_max_btns = b;
|
|
|
|
}
|
|
|
|
|
|
|
|
void subghz_custom_btns_reset() {
|
|
|
|
custom_btn_original = 0;
|
|
|
|
custom_btn_max_btns = 0;
|
2023-05-30 22:18:54 +03:00
|
|
|
controller_programming_mode = PROG_MODE_OFF;
|
|
|
|
custom_btn_id = SUBGHZ_CUSTOM_BTN_OK;
|
2023-05-14 01:34:43 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
bool subghz_custom_btn_is_allowed() {
|
|
|
|
return custom_btn_max_btns != 0;
|
2023-05-30 22:18:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void subghz_custom_btn_set_prog_mode(ProgMode prog_mode) {
|
|
|
|
controller_programming_mode = prog_mode;
|
|
|
|
}
|
|
|
|
|
|
|
|
ProgMode subghz_custom_btn_get_prog_mode() {
|
|
|
|
return controller_programming_mode;
|
2023-09-05 05:31:03 +03:00
|
|
|
}
|