RISC-V/V003/keyboard/keyboard.h

30 lines
809 B
C
Raw Permalink Normal View History

2024-04-23 14:16:07 +02:00
#ifndef KEYBOARD_H
#define KEYBOARD_H
#include "gpio.h"
#include "oneway.h"
#include "generator.h"
class Usart;
class Keyboard : public OneWay {
enum PASSENUM { BEGIN = 0, END };
Usart & usart;
GpioClass led, relay;
Generator gl,gh;
unsigned col_cnt, pas_cnt;
const char * password;
PASSENUM pas_num;
uint8_t status [4];
public:
explicit Keyboard (Usart & serial) noexcept : OneWay(), usart (serial), led (GPIOD, 4u), relay (GPIOD, 3u),
gl (), gh (), col_cnt (0u), pas_cnt (0u), password (nullptr), pas_num (BEGIN) {
init();
}
void setPassword (const char * const pwd) { password = pwd; }
unsigned int Send (uint16_t * const ptr, const unsigned int len) override;
protected:
void init () noexcept;
void out (const char c);
};
#endif // KEYBOARD_H