Refactored device descriptor to reduce its size

This commit is contained in:
Alex Demenchuk 2018-06-07 09:03:38 -04:00
parent a8c60e0960
commit 87b496eca8

View file

@ -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