[riot-notifications] [RIOT-OS/RIOT] black/white e-Paper/e-Ink display driver (#12509)

Alexandre Abadie notifications at github.com
Wed May 19 18:02:22 CEST 2021


@aabadie commented on this pull request.



> +void epd_bw_spi_wait(epd_bw_spi_params_t *p, uint32_t usec)
+{
+    if (p->busy_pin != GPIO_UNDEF) {
+        DEBUG("[epd_bw_spi] wait: for busy bin\n");
+        while (gpio_read(p->busy_pin)) {}
+    }
+    else {
+        DEBUG("[epd_bw_spi] wait: for %" PRIu32 " microseconds\n", usec);
+        xtimer_usleep(usec);
+    }
+}
+
+int epd_bw_spi_init(epd_bw_spi_t *dev,
+                    const epd_bw_spi_params_t *params,
+                    const epd_bw_spi_controller_t *controller,
+                    uint8_t size_x, uint16_t size_y,

I see, this looks nicer but not from the params struct static initializer point of view. I think a flat struct is ok here:

```c
/**
 * @brief   Driver parameters.
 */
typedef struct {
    spi_t spi;          /**< SPI device that the display is connected to */
    spi_clk_t spi_clk;  /**<; SPI clock speed to use */
    gpio_t cs_pin;      /**<; pin connected to the CHIP SELECT line */
    gpio_t dc_pin;      /**< pin connected to the DC line */
    gpio_t rst_pin;     /**< pin connected to the reset line */
    gpio_t busy_pin;    /**< pin connected to the busy line */
    bool busy_value;    /**< expected value for the busy pin */
    bool dummy;         /**< if device requires a dummy cycle before read */
    epd_bw_spi_entry_mode_t entry_mode;
    uint16_t size_x;    /**< supported number of horizontal pixels */
    uint16_t size_y;    /**< supported number of vertical pixels */
    epd_bw_spi_controller_t controller; /**< E-paper controller configuration */
} epd_bw_spi_params_t;
```

And then in the params:

```c
/**
 * @brief    Default controller definition
 */      
#ifndef EPD_BW_SPI_CONTROLLER
#define EPD_BW_SPI_CONTROLLER EPD_BW_SPI_CONTROLLER_IL3829
#endif

#define EPD_BW_SPI_PARAMS           { .spi = EPD_BW_SPI_PARAM_SPI, \
                                          .spi_clk = EPD_BW_SPI_PARAM_SPI_CLK, \
                                          .cs_pin = EPD_BW_SPI_PARAM_CS, \
                                          .dc_pin = EPD_BW_SPI_PARAM_DC, \
                                          .rst_pin = EPD_BW_SPI_PARAM_RST, \
                                          .busy_pin = EPD_BW_SPI_PARAM_BUSY, \      
                                          .busy_value = EPD_BW_SPI_PARAM_BUSY_VAL, \
                                          .dummy = EPD_BW_SPI_PARAM_DUMMY, \
                                          .entry_mode = EPD_BW_SPI_PARAM_ENTRY_MODE, \
                                          .size_x = EPD_BW_SPI_PARAM_DISPLAY_X, \
                                          .size_y = EPD_BW_SPI_PARAM_DISPLAY_Y, \
                                          .controller = EPD_BW_SPI_PARAM_CONTROLLER, \
}
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/12509#discussion_r635382858
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210519/1e77b945/attachment.htm>


More information about the notifications mailing list