mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-12-26 20:53:07 +00:00
cf1c8fb223
* sepate one wire class * TM2004 writer * app mode write ds1990 * test another blanks protocol * new ibutton slave * one wire states * tim1 capture compare and update interrupts * interrupt mgr, new timers IRQ * discard HAL_TIM_PeriodElapsedCallback from main * add exti_14 line * add external interrupt callback * use int mgr in input * better interrupt managment * add interrupt callback enable and disable fns * properly init app * changed timings * rename one wire classes * use new owb classes * properly remove interrupts * new blanks writer * remove unused tests * new core includes * extern c guard * fix api_interrupt_remove usage * remove debug info, new way to detect blanks writing * remove copy constructor * change keys template * fix app sources recipe
40 lines
1,009 B
C++
40 lines
1,009 B
C++
#pragma once
|
|
#include "one_wire_master.h"
|
|
#include "maxim_crc.h"
|
|
|
|
typedef enum {
|
|
KEY_DS1990, /**< DS1990 */
|
|
KEY_CYFRAL, /**< CYFRAL*/
|
|
KEY_METAKOM, /**< METAKOM */
|
|
} KeyType;
|
|
|
|
typedef enum {
|
|
WR_OK,
|
|
WR_SAME_KEY,
|
|
WR_ERROR,
|
|
} WriterResult;
|
|
|
|
class BlanksWriter {
|
|
private:
|
|
const GpioPin* gpio;
|
|
OneWireMaster* onewire;
|
|
|
|
void onewire_release(void);
|
|
void onewire_write_one_bit(bool value, uint32_t delay);
|
|
|
|
bool write_TM2004(const uint8_t* key, uint8_t key_length);
|
|
bool write_1990_1(const uint8_t* key, uint8_t key_length);
|
|
bool write_1990_2(const uint8_t* key, uint8_t key_length);
|
|
bool write_TM01(KeyType type, const uint8_t* key, uint8_t key_length);
|
|
|
|
void write_byte_ds1990(uint8_t data);
|
|
bool compare_key_ds1990(const uint8_t* key, uint8_t key_length);
|
|
|
|
public:
|
|
BlanksWriter(const GpioPin* one_wire_gpio);
|
|
~BlanksWriter();
|
|
|
|
WriterResult write(KeyType type, const uint8_t* key, uint8_t key_length);
|
|
void start();
|
|
void stop();
|
|
};
|