Repo for ESP32 Weather Station Development
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

40 lignes
1.4KB

  1. /*
  2. * u8g2_esp32_hal.h
  3. *
  4. * Created on: Feb 12, 2017
  5. * Author: kolban
  6. */
  7. #include "driver/gpio.h"
  8. #include "driver/i2c.h"
  9. #ifndef U8G2_ESP32_HAL_H_
  10. #define U8G2_ESP32_HAL_H_
  11. #include "u8g2.h"
  12. #define U8G2_ESP32_HAL_UNDEFINED (-1)
  13. #define I2C_MASTER_NUM I2C_NUM_1 // I2C port number for master dev
  14. #define I2C_MASTER_TX_BUF_DISABLE 0 // I2C master do not need buffer
  15. #define I2C_MASTER_RX_BUF_DISABLE 0 // I2C master do not need buffer
  16. #define I2C_MASTER_FREQ_HZ 1000000 // I2C master clock frequency
  17. #define ACK_CHECK_EN 0x1 // I2C master will check ack from slave
  18. #define ACK_CHECK_DIS 0x0 // I2C master will not check ack from slave
  19. typedef struct {
  20. gpio_num_t clk;
  21. gpio_num_t mosi;
  22. gpio_num_t sda; // data for I²C
  23. gpio_num_t scl; // clock for I²C
  24. gpio_num_t cs;
  25. gpio_num_t reset;
  26. gpio_num_t dc;
  27. } u8g2_esp32_hal_t ;
  28. #define U8G2_ESP32_HAL_DEFAULT {U8G2_ESP32_HAL_UNDEFINED, U8G2_ESP32_HAL_UNDEFINED, U8G2_ESP32_HAL_UNDEFINED, U8G2_ESP32_HAL_UNDEFINED, U8G2_ESP32_HAL_UNDEFINED, U8G2_ESP32_HAL_UNDEFINED, U8G2_ESP32_HAL_UNDEFINED }
  29. void u8g2_esp32_hal_init(u8g2_esp32_hal_t u8g2_esp32_hal_param);
  30. uint8_t u8g2_esp32_i2c_byte_cb(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr);
  31. uint8_t u8g2_esp32_gpio_and_delay_cb(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr);
  32. #endif /* U8G2_ESP32_HAL_H_ */