Changed from MCP23S17 to MCP23017. Lots of changes.

Doesn't really work because of timing stuff.
This commit is contained in:
2019-11-10 14:45:33 +01:00
parent 88655b543d
commit 2ea2ec479a
14 changed files with 423 additions and 156 deletions

View File

@ -5,17 +5,19 @@
#include "player.h"
#include "mqtt_client.h"
#include <MFRC522.h>
#include <MCP23S17/MCP23S17.h>
#include <Adafruit_MCP23017.h>
class Controller {
private:
MFRC522* _rfid;
MCP* _mcp;
Adafruit_MCP23017* _mcp;
SPIMaster* _spi;
MQTTClient* _mqtt_client;
bool _rfid_enabled = true;
void _check_rfid();
void _check_serial();
void _check_buttons();
bool _debounce_button(uint8_t index);
uint32_t _get_rfid_card_uid();
uint32_t _last_rfid_card_uid = 0;
uint8_t _no_rfid_card_count = 0;
@ -30,7 +32,7 @@ private:
unsigned long _last_mqtt_report_at = 0;
void _send_mqtt_report();
public:
Controller(Player* p, MCP* m);
Controller(Player* p, Adafruit_MCP23017* m, SPIMaster* s);
void set_mqtt_client(MQTTClient* m);
String get_status_json();
void loop();