mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-12-17 02:13:19 +03:00
22e1ecb642
* Hal lfrfid: add read timer pulse and period config fns * New debug application for lfrfid subsystem * New lfrfid: app, fix naming * App lfrfid: assets * Container view module * App ibutton: remove unused header * App lfrfid scenes * App notification, add yield to blocking operations, add speaker volume control * App lfrfid: reading key scene * Assets: placeholder icon * App lfrfid: reworked container view module * App lfrfid: new scenes * App lfrfid: write scene * App lfrfid: write hid * App lfrfid: emulate scene * App lfrfid: save name scene * App lfrfid: add missing file
37 lines
961 B
C++
37 lines
961 B
C++
#include "encoder-indala-40134.h"
|
|
#include "protocols/protocol-indala-40134.h"
|
|
#include <furi.h>
|
|
|
|
void EncoderIndala_40134::init(const uint8_t* data, const uint8_t data_size) {
|
|
ProtocolIndala40134 indala;
|
|
indala.encode(data, data_size, reinterpret_cast<uint8_t*>(&card_data), sizeof(card_data));
|
|
|
|
last_bit = card_data & 1;
|
|
card_data_index = 0;
|
|
current_polarity = true;
|
|
}
|
|
|
|
void EncoderIndala_40134::get_next(bool* polarity, uint16_t* period, uint16_t* pulse) {
|
|
*period = 2;
|
|
*pulse = 1;
|
|
*polarity = current_polarity;
|
|
|
|
bit_clock_index++;
|
|
if(bit_clock_index >= clock_per_bit) {
|
|
bit_clock_index = 0;
|
|
|
|
bool current_bit = (card_data >> (63 - card_data_index)) & 1;
|
|
|
|
if(current_bit != last_bit) {
|
|
current_polarity = !current_polarity;
|
|
}
|
|
|
|
last_bit = current_bit;
|
|
|
|
card_data_index++;
|
|
if(card_data_index >= 64) {
|
|
card_data_index = 0;
|
|
}
|
|
}
|
|
}
|