mirror of
https://github.com/usatiuk/cardboy.git
synced 2025-10-28 23:27:49 +01:00
32 lines
757 B
C++
32 lines
757 B
C++
//
|
|
// Created by Stepan Usatiuk on 02.03.2025.
|
|
//
|
|
|
|
#ifndef CB_I2C_GLOBAL_HPP
|
|
#define CB_I2C_GLOBAL_HPP
|
|
|
|
#include "config.hpp"
|
|
|
|
#include "driver/i2c_master.h"
|
|
|
|
class I2cGlobal {
|
|
public:
|
|
static I2cGlobal& get();
|
|
i2c_master_bus_handle_t& get_bus_handle();
|
|
|
|
private:
|
|
I2cGlobal();
|
|
static inline i2c_master_bus_config_t _i2c_mst_config = {
|
|
.i2c_port = 0,
|
|
.sda_io_num = I2C_SDA,
|
|
.scl_io_num = I2C_SCL,
|
|
.clk_source = I2C_CLK_SRC_DEFAULT,
|
|
.glitch_ignore_cnt = 7,
|
|
.flags = {.enable_internal_pullup = true, .allow_pd = true},
|
|
};
|
|
i2c_master_bus_handle_t _bus_handle;
|
|
}; // namespace i2c_global
|
|
|
|
|
|
#endif // CB_I2C_GLOBAL_HPP
|