mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-07-02 22:18:56 -07:00
SubGHz: Add manually +2 new remotes
Allow manual creation of Nice Flor S, Nice Smilo
This commit is contained in:
@@ -340,6 +340,29 @@ static uint64_t
|
||||
return data;
|
||||
}
|
||||
|
||||
bool subghz_protocol_nice_flor_s_create_data(
|
||||
void* context,
|
||||
FlipperFormat* flipper_format,
|
||||
uint32_t serial,
|
||||
uint8_t btn,
|
||||
uint16_t cnt,
|
||||
SubGhzRadioPreset* preset) {
|
||||
furi_assert(context);
|
||||
SubGhzProtocolEncoderNiceFlorS* instance = context;
|
||||
instance->generic.serial = serial;
|
||||
instance->generic.cnt = cnt;
|
||||
instance->generic.data_count_bit = 52;
|
||||
uint64_t decrypt = ((uint64_t)instance->generic.serial << 16) | instance->generic.cnt;
|
||||
uint64_t enc_part = subghz_protocol_nice_flor_s_encrypt(
|
||||
decrypt, instance->nice_flor_s_rainbow_table_file_name);
|
||||
uint8_t byte = btn << 4 | (0xF ^ btn ^ 0x3);
|
||||
instance->generic.data = (uint64_t)byte << 44 | enc_part;
|
||||
|
||||
bool res = subghz_block_generic_serialize(&instance->generic, flipper_format, preset);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
void* subghz_protocol_decoder_nice_flor_s_alloc(SubGhzEnvironment* environment) {
|
||||
SubGhzProtocolDecoderNiceFlorS* instance = malloc(sizeof(SubGhzProtocolDecoderNiceFlorS));
|
||||
instance->base.protocol = &subghz_protocol_nice_flor_s;
|
||||
|
||||
@@ -47,6 +47,24 @@ LevelDuration subghz_protocol_encoder_nice_flor_s_yield(void* context);
|
||||
|
||||
uint64_t subghz_protocol_nice_flor_s_encrypt(uint64_t data, const char* file_name);
|
||||
|
||||
/**
|
||||
* New remote generation.
|
||||
* @param context Pointer to a SubGhzProtocolEncoderKeeloq instance
|
||||
* @param flipper_format Pointer to a FlipperFormat instance
|
||||
* @param serial Serial number
|
||||
* @param btn Button number, 4 bit
|
||||
* @param cnt Counter value, 16 bit
|
||||
* @param preset Modulation, SubGhzRadioPreset
|
||||
* @return true On success
|
||||
*/
|
||||
bool subghz_protocol_nice_flor_s_create_data(
|
||||
void* context,
|
||||
FlipperFormat* flipper_format,
|
||||
uint32_t serial,
|
||||
uint8_t btn,
|
||||
uint16_t cnt,
|
||||
SubGhzRadioPreset* preset);
|
||||
|
||||
/**
|
||||
* Allocate SubGhzProtocolDecoderNiceFlorS.
|
||||
* @param environment Pointer to a SubGhzEnvironment instance
|
||||
|
||||
Reference in New Issue
Block a user