esp_lcd_panel_ssd1306.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #pragma once
  7. #include <stdbool.h>
  8. #include "esp_err.h"
  9. #include "esp_lcd_panel_dev.h"
  10. #ifdef __cplusplus
  11. extern "C" {
  12. #endif
  13. /**
  14. * @brief SSD1306 configuration structure
  15. *
  16. * To be used as esp_lcd_panel_dev_config_t.vendor_config.
  17. * See esp_lcd_new_panel_ssd1306().
  18. */
  19. typedef struct {
  20. /**
  21. * @brief Display's height in pixels (64(default) or 32)
  22. */
  23. uint8_t height;
  24. } esp_lcd_panel_ssd1306_config_t;
  25. /**
  26. * @brief Create LCD panel for model SSD1306
  27. *
  28. * @param[in] io LCD panel IO handle
  29. * @param[in] panel_dev_config general panel device configuration
  30. * @param[out] ret_panel Returned LCD panel handle
  31. * @return
  32. * - ESP_ERR_INVALID_ARG if parameter is invalid
  33. * - ESP_ERR_NO_MEM if out of memory
  34. * - ESP_OK on success
  35. *
  36. * @note The default panel size is 128x64.
  37. * @note Use esp_lcd_panel_ssd1306_config_t to set the correct size.
  38. * Example usage:
  39. * @code {c}
  40. *
  41. * esp_lcd_panel_ssd1306_config_t ssd1306_config = {
  42. * .height = 32
  43. * };
  44. * esp_lcd_panel_dev_config_t panel_config = {
  45. * <...>
  46. * .vendor_config = &ssd1306_config
  47. * };
  48. *
  49. * esp_lcd_panel_handle_t panel_handle = NULL;
  50. * esp_lcd_new_panel_ssd1306(io_handle, &panel_config, &panel_handle);
  51. * @endcode
  52. */
  53. esp_err_t esp_lcd_new_panel_ssd1306(const esp_lcd_panel_io_handle_t io, const esp_lcd_panel_dev_config_t *panel_dev_config, esp_lcd_panel_handle_t *ret_panel);
  54. #ifdef __cplusplus
  55. }
  56. #endif