esp32-car/include/ir.h

32 lines
373 B
C
Raw Normal View History

2024-12-27 11:32:09 +08:00
#ifndef IR_H
#define IR_H
2025-01-01 17:53:59 +08:00
#include <Wire.h>
2024-12-27 11:32:09 +08:00
#include <Arduino.h>
2025-01-01 17:53:59 +08:00
#include <algorithm>
2025-01-01 13:21:24 +08:00
#include "consts.h"
2024-12-27 11:32:09 +08:00
enum IRMode
{
IR_MODE_GPIO,
2025-01-01 17:53:59 +08:00
IR_MODE_I2C
2024-12-27 11:32:09 +08:00
};
struct IRData
{
2025-01-01 13:21:24 +08:00
IRMode mode;
uint8_t pins[IR_COUNT];
uint8_t count;
2024-12-27 11:32:09 +08:00
uint8_t data[8];
};
class IR
{
public:
2025-01-01 17:53:59 +08:00
static TwoWire *i2c;
2024-12-27 11:32:09 +08:00
static IRData data;
2025-01-01 13:21:24 +08:00
static void init();
2024-12-27 11:32:09 +08:00
static void update();
};
#endif