e8211226f3
* ApiHal: set frequency and path in one go. Drivers: proper frequency registers calculation for CC1101. Update subghz cli to match new api. * SubGhz: preparation for parsers porting, tim2 sharing * ApiHal: add interrupts API, move all TIM2 related things there. * SubGhz: refactor protocol lib and add keeloq. * SubGhz: proper init_set for keeloq manafacture key * SubGhz: port more protocols to lib * SubGhz: load keeloq manufacture keys from sd card (if any). * SubGhz: format output from protocols. * SubGhz: use default frequency in subghz_rx cli command. * SubGhz: keeloq key types * Fix compillation error when internal storage disabled * SubGhz: minor cleanup * SubGhz: properly handle timeout and reset signal in subghz_rx * SubGhz: Worker, Capture View. Furi: emulate thread join. * SubGhz: free strings on keeloq key load end * SubGhz: update protocols reporting API, app refactoring and capture view, update API HAL usage. * SubGhz: update dump formatting * ApiHal: backport subghz preset to F5 * ApiHal: backport subghz frequency range to F5
54 lines
1.8 KiB
C
54 lines
1.8 KiB
C
#pragma once
|
|
|
|
#include <m-string.h>
|
|
#include <api-hal.h>
|
|
#include <stdint.h>
|
|
|
|
#define bit_read(value, bit) (((value) >> (bit)) & 0x01)
|
|
#define bit_set(value, bit) ((value) |= (1UL << (bit)))
|
|
#define bit_clear(value, bit) ((value) &= ~(1UL << (bit)))
|
|
#define bit_write(value, bit, bitvalue) (bitvalue ? bit_set(value, bit) : bit_clear(value, bit))
|
|
|
|
#define SUBGHZ_TX_PIN_HIGTH()
|
|
#define SUBGHZ_TX_PIN_LOW()
|
|
#define DURATION_DIFF(x,y) ((x < y) ? (y - x) : (x - y))
|
|
|
|
typedef struct SubGhzProtocolCommon SubGhzProtocolCommon;
|
|
|
|
typedef void (*SubGhzProtocolCommonCallback)(SubGhzProtocolCommon* parser, void* context);
|
|
|
|
typedef void (*SubGhzProtocolCommonToStr)(SubGhzProtocolCommon* instance, string_t output);
|
|
|
|
struct SubGhzProtocolCommon {
|
|
const char* name;
|
|
uint16_t te_long;
|
|
uint16_t te_shot;
|
|
uint16_t te_delta;
|
|
uint64_t code_found;
|
|
uint64_t code_last_found;
|
|
uint8_t code_count_bit;
|
|
uint8_t code_min_count_bit_for_found;
|
|
uint8_t parser_step;
|
|
uint16_t te_last;
|
|
uint8_t header_count;
|
|
uint16_t cnt;
|
|
|
|
/* Standard Callback for on rx complete event */
|
|
SubGhzProtocolCommonCallback callback;
|
|
void* context;
|
|
|
|
/* Dump To String */
|
|
SubGhzProtocolCommonToStr to_string;
|
|
};
|
|
|
|
void subghz_protocol_common_add_bit(SubGhzProtocolCommon *common, uint8_t bit);
|
|
|
|
uint8_t subghz_protocol_common_check_interval(SubGhzProtocolCommon *common, uint32_t interval, uint16_t interval_check);
|
|
|
|
uint64_t subghz_protocol_common_reverse_key(uint64_t key, uint8_t count_bit);
|
|
|
|
void subghz_protocol_common_set_callback(SubGhzProtocolCommon* instance, SubGhzProtocolCommonCallback callback, void* context);
|
|
|
|
void subghz_protocol_common_to_str(SubGhzProtocolCommon* instance, string_t output);
|
|
|