int ssd130x_display_on(struct oled_display* conf)
{
int ret = 0;
+ uint8_t val = 0;
/* Display OFF */
- ret = ssd130x_display_power(conf, SSD130x_DISP_OFF);
+ ret = ssd130x_display_power(conf, SSD130x_DISP_OFF); /* 0xAE */
if (ret != 0) {
return ret;
}
+ if (conf->charge_pump == SSD130x_INTERNAL_PUMP) {
+ val = SSD130x_CMD_CHARGE_INTERN;
+ ssd130x_send_command(conf, SSD130x_CMD_CHARGE_PUMP, &val, 1); /* 0x8D */
+ }
+
ret = ssd130x_set_mem_addressing_mode(conf, SSD130x_ADDR_TYPE_HORIZONTAL);
if (ret != 0) {
return ret;
}
+
ret = ssd130x_set_scan_direction(conf);
if (ret != 0) {
return ret;
if (ret != 0) {
return ret;
}
+
+ if (conf->charge_pump == SSD130x_INTERNAL_PUMP) {
+ val = 0xF1;
+ ssd130x_send_command(conf, SSD130x_CMD_SET_PRECHARGE, &val, 1); /* 0xD9 */
+ val = SSD130x_VCOM_083;
+ ssd130x_send_command(conf, SSD130x_CMD_VCOM_LEVEL, &val, 1); /* 0xDB */
+ }
+
ret = ssd130x_set_display_on(conf, SSD130x_DISP_RAM);
if (ret != 0) {
return ret;
uint8_t address; /* 8 bits address */
uint8_t bus_num; /* I2C bus number */
uint8_t probe_ok;
+ uint8_t charge_pump;
uint8_t video_mode;
uint8_t contrast;
uint8_t scan_dir;
#define SSD130x_ADDR_COL(x) ((x) & 0x7F)
#define SSD130x_ADDR_PAGE(x) ((x) & 0x07)
+/* Charge pump */
+#define SSD130x_EXT_VCC 0x01
+#define SSD130x_INTERNAL_PUMP 0x00
+#define SSD130x_CMD_CHARGE_PUMP 0x8D
+#define SSD130x_CMD_CHARGE_EXT 0x10
+#define SSD130x_CMD_CHARGE_INTERN 0x14
+
/* Hardware configuration */
#define SSD130x_CMD_START_LINE(x) (0x40 + ((x) & 0x3F))
#define SSD130x_CMD_SEG0_MAP_RIGHT 0xA1