Skip to content

Commit e7bbf08

Browse files
authored
First B1.9 tests
1 parent 5ddba58 commit e7bbf08

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

ATC_Thermometer/lcd.c

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ void init_lcd(){
2222
lcd_version = 0;
2323
i2c_address_lcd = 0x78;
2424
}else if(test_i2c_device(0x3E)){// B1.9
25-
lcd_version = 0;//later 2
25+
lcd_version = 2;
2626
i2c_address_lcd = 0x7C;
2727
}else{// B1.6 uses UART and is not testable this way
2828
lcd_version = 1;
@@ -41,7 +41,19 @@ void init_lcd(){
4141
init_lcd_deepsleep();
4242

4343
}else if(lcd_version == 2){// B1.9 Hardware
44-
//UNKNOWN LCD VERSION
44+
send_i2c(i2c_address_lcd,0xEA, 1);
45+
sleep_us(240);
46+
send_i2c(i2c_address_lcd, 0xA4, 1);
47+
send_i2c(i2c_address_lcd, 0x9c, 1);
48+
send_i2c(i2c_address_lcd, 0xac, 1);
49+
send_i2c(i2c_address_lcd, 0xbc, 1);
50+
send_i2c(i2c_address_lcd, 0xf0, 1);
51+
send_i2c(i2c_address_lcd, 0xfc, 1);
52+
53+
uint8_t lcd_3E_init_segments[] = {0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
54+
send_i2c(i2c_address_lcd,lcd_3E_init_segments, sizeof(lcd_3E_init_segments));
55+
56+
send_i2c(i2c_address_lcd, 0xc8, 1);
4557
}
4658
send_to_lcd_long(0x00,0x00,0x00,0x00,0x00,0x00);
4759
}
@@ -78,7 +90,8 @@ if(lcd_version == 0){// B1.4 Hardware
7890
}else if(lcd_version == 1){// B1.6 Hardware
7991
uart_send_lcd(byte1,byte2,byte3,byte4,byte5,byte6);
8092
}else if(lcd_version == 2){// B1.9 Hardware
81-
//UNKNOWN LCD VERSION
93+
uint8_t lcd_set_segments[] = {0x04,byte1,byte2,0x00,0x00,byte3,byte4,0x00,0x00,byte5,byte6};
94+
send_i2c(i2c_address_lcd,lcd_set_segments, sizeof(lcd_set_segments));
8295
}
8396
}
8497

@@ -89,7 +102,8 @@ if(lcd_version == 0){// B1.4 Hardware
89102
}else if(lcd_version == 1){// B1.6 Hardware
90103
uart_send_lcd(byte1,byte2,byte3,byte4,byte5,byte6);
91104
}else if(lcd_version == 2){// B1.9 Hardware
92-
//UNKNOWN LCD VERSION
105+
uint8_t lcd_set_segments[] = {0x04,byte1,byte2,0x00,0x00,byte3,byte4,0x00,0x00,byte5,byte6};
106+
send_i2c(i2c_address_lcd,lcd_set_segments, sizeof(lcd_set_segments));
93107
}
94108
}
95109

0 commit comments

Comments
 (0)