#pragma once #include #include class W433DataTransmitter { private: static constexpr uint16_t BIT_RATE = 2000; static constexpr int32_t DELAY_US = 1000000/BIT_RATE; static constexpr int16_t LONG_DELAY_MS = 10; static constexpr uint16_t SIGNATURE = 0xb38; volatile unsigned char * const _port; const unsigned char _pin; void sendSymbol(const uint8_t data); void sendData(const uint8_t data); static constexpr int SYMBOL_TABLE_SIZE = 16; static constexpr uint8_t symbols[SYMBOL_TABLE_SIZE] = { 0xd, 0xe, 0x13, 0x15, 0x16, 0x19, 0x1a, 0x1c, 0x23, 0x25, 0x26, 0x29, 0x2a, 0x2c, 0x32, 0x34 }; uint16_t calcCrc(const uint32_t data); public: W433DataTransmitter(volatile unsigned char * const port, const unsigned char pin); void send(const uint8_t* const data, uint16_t length); void send(const uint8_t data); void sendPacket(const uint32_t data); };