#include "all.h" static const char *TAG = "driver_all"; static void init_i2c(); void init_drivers() { init_i2c(); // init char_lcd so we can use it to report other initialization errors. init_lcd(); // init the bottom half so that we can get user input. init_bottom_half(); init_sd(); init_speaker(); init_sseg(); init_game_timers(); init_tft(); init_leds(); init_power_board(); } /// @brief Initializes I2C_NUM_0. /// /// This is hooked up the to: /// - The bottom half /// - The char lcd /// - The power board /// - The MPU6050 /// - The PERH port /// - The Capacitive Touch Panel static void init_i2c() { ESP_LOGI(TAG, "Initializing i2c..."); i2c_config_t conf = { .mode = I2C_MODE_MASTER, .sda_io_num = GPIO_NUM_5, .scl_io_num = GPIO_NUM_6, .sda_pullup_en = GPIO_PULLUP_DISABLE, .scl_pullup_en = GPIO_PULLUP_DISABLE, // .sda_pullup_en = GPIO_PULLUP_ENABLE, // .scl_pullup_en = GPIO_PULLUP_ENABLE, .master = { .clk_speed = 100*1000, }, .clk_flags = I2C_SCLK_SRC_FLAG_FOR_NOMAL }; ESP_ERROR_CHECK(i2c_param_config(I2C_NUM_0, &conf)); ESP_ERROR_CHECK(i2c_driver_install(I2C_NUM_0, conf.mode, 0, 0, 0)); ESP_LOGI(TAG, "i2c initialized!"); }