diff --git a/extras/ssd1306/ssd1306.h b/extras/ssd1306/ssd1306.h index 86abaab..e4ec0ad 100644 --- a/extras/ssd1306/ssd1306.h +++ b/extras/ssd1306/ssd1306.h @@ -64,19 +64,16 @@ typedef enum */ typedef struct { - ssd1306_protocol_t protocol; - ssd1306_screen_t screen; - union - { -#if (SSD1306_I2C_SUPPORT) - i2c_dev_t i2c_dev; //!< I2C devuce descriptor, used by SSD1306_PROTO_I2C -#endif + ssd1306_protocol_t protocol : 2; + ssd1306_screen_t screen : 1; #if (SSD1306_SPI4_SUPPORT) || (SSD1306_SPI3_SUPPORT) - uint8_t cs_pin; //!< Chip Select GPIO pin, used by SSD1306_PROTO_SPI3, SSD1306_PROTO_SPI4 + uint8_t cs_pin : 5; //!< Chip Select GPIO pin, used by SSD1306_PROTO_SPI3, SSD1306_PROTO_SPI4 #endif - }; #if (SSD1306_SPI4_SUPPORT) uint8_t dc_pin; //!< Data/Command GPIO pin, used by SSD1306_PROTO_SPI4 +#endif +#if (SSD1306_I2C_SUPPORT) + i2c_dev_t i2c_dev; //!< I2C device descriptor, used by SSD1306_PROTO_I2C #endif uint8_t width; //!< Screen width, currently supported 128px, 96px uint8_t height; //!< Screen height, currently supported 16px, 32px, 64px