mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-08 04:27:12 +03:00
Merge with master
This commit is contained in:
@@ -32,14 +32,16 @@
|
||||
#define I2C_PORT 1
|
||||
#define I2C_ADDRESS 0x3C
|
||||
#define LINELEN 40
|
||||
#define TAG "display"
|
||||
static const char *TAG = "display";
|
||||
|
||||
static void vfdc_handler( u8_t *_data, int bytes_read);
|
||||
void grfe_handler( u8_t *data, int len);
|
||||
static bool display_init(char *config);
|
||||
static void grfe_handler( u8_t *data, int len);
|
||||
static bool display_init(char *config, char *welcome);
|
||||
static void print_message(char *msg);
|
||||
|
||||
struct display_handle_s SSD1306_handle = {
|
||||
display_init,
|
||||
print_message,
|
||||
vfdc_handler,
|
||||
grfe_handler,
|
||||
NULL, NULL,
|
||||
@@ -71,7 +73,7 @@ static const unsigned char BitReverseTable256[] =
|
||||
/****************************************************************************************
|
||||
*
|
||||
*/
|
||||
static bool display_init(char *config) {
|
||||
static bool display_init(char *config, char *welcome) {
|
||||
bool res = false;
|
||||
|
||||
if (strstr(config, "I2C")) {
|
||||
@@ -105,6 +107,7 @@ static bool display_init(char *config) {
|
||||
}
|
||||
}
|
||||
if(res){
|
||||
print_message(welcome);
|
||||
ESP_LOGI(TAG, "Initialized I2C display %dx%d (sda:%d, scl:%d, address:%02x)", width, height, sda, scl, address);
|
||||
} else {
|
||||
ESP_LOGE(TAG, "Cannot initialized I2C display %s [%dx%d sda:%d, scl:%d, address:%02x]", config, width, height, sda, scl, address);
|
||||
@@ -116,6 +119,19 @@ static bool display_init(char *config) {
|
||||
return res;
|
||||
}
|
||||
|
||||
/****************************************************************************************
|
||||
*
|
||||
*/
|
||||
static void print_message(char *msg) {
|
||||
if (!msg) return;
|
||||
SSD1306_AddressMode Mode = AddressMode;
|
||||
SSD1306_Clear( &I2CDisplay, SSD_COLOR_BLACK );
|
||||
SSD1306_SetDisplayAddressMode( &I2CDisplay, AddressMode_Horizontal );
|
||||
SSD1306_FontDrawAnchoredString( &I2CDisplay, TextAnchor_Center, msg, SSD_COLOR_WHITE );
|
||||
SSD1306_Update( &I2CDisplay );
|
||||
SSD1306_SetDisplayAddressMode( &I2CDisplay, Mode );
|
||||
}
|
||||
|
||||
/****************************************************************************************
|
||||
* Change special LCD chars to something more printable on screen
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user