Skip to content

Commit

Permalink
issue 315
Browse files Browse the repository at this point in the history
  • Loading branch information
olikraus committed Apr 4, 2016
1 parent 469a805 commit b85e668
Show file tree
Hide file tree
Showing 8 changed files with 95 additions and 776 deletions.
14 changes: 14 additions & 0 deletions csrc/u8g_dev_ssd1306_128x32.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,13 @@ uint8_t u8g_dev_ssd1306_128x32_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void
u8g_SetChipSelect(u8g, dev, 0);
}
break;
case U8G_DEV_MSG_CONTRAST:
u8g_SetChipSelect(u8g, dev, 1);
u8g_SetAddress(u8g, dev, 0); /* instruction mode */
u8g_WriteByte(u8g, dev, 0x081);
u8g_WriteByte(u8g, dev, (*(uint8_t *)arg) ); /* 11 Jul 2015: fixed contrast calculation */
u8g_SetChipSelect(u8g, dev, 0);
return 1;
case U8G_DEV_MSG_SLEEP_ON:
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_on);
return 1;
Expand Down Expand Up @@ -268,6 +275,13 @@ uint8_t u8g_dev_ssd1306_128x32_2x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, vo
u8g_SetChipSelect(u8g, dev, 0);
}
break;
case U8G_DEV_MSG_CONTRAST:
u8g_SetChipSelect(u8g, dev, 1);
u8g_SetAddress(u8g, dev, 0); /* instruction mode */
u8g_WriteByte(u8g, dev, 0x081);
u8g_WriteByte(u8g, dev, (*(uint8_t *)arg) ); /* 11 Jul 2015: fixed contrast calculation */
u8g_SetChipSelect(u8g, dev, 0);
return 1;
case U8G_DEV_MSG_SLEEP_ON:
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_on);
return 1;
Expand Down
36 changes: 36 additions & 0 deletions csrc/u8g_dev_ssd1306_128x64.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,15 @@ uint8_t u8g_dev_ssd1306_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void
case U8G_DEV_MSG_SLEEP_OFF:
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_off);
return 1;
case U8G_DEV_MSG_CONTRAST:
{
u8g_SetChipSelect(u8g, dev, 1);
u8g_SetAddress(u8g, dev, 0); /* instruction mode */
u8g_WriteByte(u8g, dev, 0x81);
u8g_WriteByte(u8g, dev, *(uint8_t *) arg);
u8g_SetChipSelect(u8g, dev, 0);
return 1;
}
}
return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg);
}
Expand Down Expand Up @@ -271,6 +280,15 @@ uint8_t u8g_dev_ssd1306_adafruit_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t m
case U8G_DEV_MSG_SLEEP_OFF:
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_off);
return 1;
case U8G_DEV_MSG_CONTRAST:
{
u8g_SetChipSelect(u8g, dev, 1);
u8g_SetAddress(u8g, dev, 0); /* instruction mode */
u8g_WriteByte(u8g, dev, 0x81);
u8g_WriteByte(u8g, dev, *(uint8_t *) arg);
u8g_SetChipSelect(u8g, dev, 0);
return 1;
}
}
return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg);
}
Expand Down Expand Up @@ -349,6 +367,15 @@ uint8_t u8g_dev_ssd1306_128x64_2x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, vo
case U8G_DEV_MSG_SLEEP_OFF:
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_off);
return 1;
case U8G_DEV_MSG_CONTRAST:
{
u8g_SetChipSelect(u8g, dev, 1);
u8g_SetAddress(u8g, dev, 0); /* instruction mode */
u8g_WriteByte(u8g, dev, 0x81);
u8g_WriteByte(u8g, dev, *(uint8_t *) arg);
u8g_SetChipSelect(u8g, dev, 0);
return 1;
}
}
return u8g_dev_pb16v1_base_fn(u8g, dev, msg, arg);
}
Expand Down Expand Up @@ -386,6 +413,15 @@ uint8_t u8g_dev_sh1106_128x64_2x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, voi
case U8G_DEV_MSG_SLEEP_OFF:
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_off);
return 1;
case U8G_DEV_MSG_CONTRAST:
{
u8g_SetChipSelect(u8g, dev, 1);
u8g_SetAddress(u8g, dev, 0); /* instruction mode */
u8g_WriteByte(u8g, dev, 0x81);
u8g_WriteByte(u8g, dev, *(uint8_t *) arg);
u8g_SetChipSelect(u8g, dev, 0);
return 1;
}
}
return u8g_dev_pb16v1_base_fn(u8g, dev, msg, arg);
}
Expand Down
14 changes: 14 additions & 0 deletions csrc/u8g_dev_ssd1306_64x48.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,13 @@ uint8_t u8g_dev_ssd1306_64x48_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *
u8g_SetChipSelect(u8g, dev, 0);
}
break;
case U8G_DEV_MSG_CONTRAST:
u8g_SetChipSelect(u8g, dev, 1);
u8g_SetAddress(u8g, dev, 0); /* instruction mode */
u8g_WriteByte(u8g, dev, 0x081);
u8g_WriteByte(u8g, dev, (*(uint8_t *)arg) ); /* 11 Jul 2015: fixed contrast calculation */
u8g_SetChipSelect(u8g, dev, 0);
return 1;
case U8G_DEV_MSG_SLEEP_ON:
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_on);
return 1;
Expand Down Expand Up @@ -166,6 +173,13 @@ uint8_t u8g_dev_ssd1306_64x48_2x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, voi
u8g_SetChipSelect(u8g, dev, 0);
}
break;
case U8G_DEV_MSG_CONTRAST:
u8g_SetChipSelect(u8g, dev, 1);
u8g_SetAddress(u8g, dev, 0); /* instruction mode */
u8g_WriteByte(u8g, dev, 0x081);
u8g_WriteByte(u8g, dev, (*(uint8_t *)arg) ); /* 11 Jul 2015: fixed contrast calculation */
u8g_SetChipSelect(u8g, dev, 0);
return 1;
case U8G_DEV_MSG_SLEEP_ON:
u8g_WriteEscSeqP(u8g, dev, u8g_dev_ssd13xx_sleep_on);
return 1;
Expand Down
16 changes: 12 additions & 4 deletions csrc/u8g_dev_uc1611_dogm240.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,16 @@


static const uint8_t u8g_dev_uc1611_dogm240_init_seq[] PROGMEM = {
U8G_ESC_CS(1), // enable chip
U8G_ESC_CS(0), /* disable chip */
U8G_ESC_ADR(0), /* instruction mode */
U8G_ESC_RST(1), /* do reset low pulse with (1*16)+2 milliseconds */
U8G_ESC_DLY(200),
U8G_ESC_CS(1), // enable chip
U8G_ESC_ADR(0), // instruction mode
0xe2, // system reset
U8G_ESC_DLY(1),
0x2f, // enable internal charge pump

0xF1, // set last COM electrode
0x3F, // 64-1=63
0xF2, // set display start line
Expand Down Expand Up @@ -96,16 +104,16 @@ uint8_t u8g_dev_uc1611_dogm240_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void
u8g_SetAddress(u8g, dev, 1); /* data mode */
if ( u8g_pb_WriteBuffer(pb, u8g, dev) == 0 )
return 0;
u8g_SetChipSelect(u8g, dev, 1);
u8g_SetChipSelect(u8g, dev, 0);
}
break;
case U8G_DEV_MSG_CONTRAST:
u8g_SetChipSelect(u8g, dev, 0);
u8g_SetChipSelect(u8g, dev, 1);
u8g_SetAddress(u8g, dev, 0); /* instruction mode */
u8g_WriteByte(u8g, dev, 0x81);
/* 11 Jul 2015: bugfix, github issue 339 */
u8g_WriteByte(u8g, dev, (*(uint8_t *)arg) ); /* set contrast from, keep gain at 0 */
u8g_SetChipSelect(u8g, dev, 1);
u8g_SetChipSelect(u8g, dev, 0);
return 1;
}
return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg);
Expand Down
15 changes: 12 additions & 3 deletions csrc/u8g_dev_uc1611_dogxl240.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,17 @@


static const uint8_t u8g_dev_uc1611_dogxl240_init_seq[] PROGMEM = {
U8G_ESC_CS(0), /* disable chip */
U8G_ESC_ADR(0), /* instruction mode */
U8G_ESC_RST(1), /* do reset low pulse with (1*16)+2 milliseconds */
U8G_ESC_DLY(200),
U8G_ESC_CS(1), // enable chip
U8G_ESC_ADR(0), // instruction mode

0xe2, // system reset
U8G_ESC_DLY(1),
0x2f, // enable internal charge pump

0xF1, // set last COM electrode
0x7F, // DOGXL240
0xF2, // set display start line
Expand Down Expand Up @@ -96,16 +105,16 @@ static uint8_t u8g_dev_uc1611_dogxl240_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t ms
u8g_SetAddress(u8g, dev, 1); /* data mode */
if ( u8g_pb_WriteBuffer(pb, u8g, dev) == 0 )
return 0;
u8g_SetChipSelect(u8g, dev, 1);
u8g_SetChipSelect(u8g, dev, 0);
}
break;
case U8G_DEV_MSG_CONTRAST:
u8g_SetChipSelect(u8g, dev, 0);
u8g_SetChipSelect(u8g, dev, 1);
u8g_SetAddress(u8g, dev, 0); /* instruction mode */
u8g_WriteByte(u8g, dev, 0x81);
/* 11 Jul 2015: bugfix, github issue 339 */
u8g_WriteByte(u8g, dev, (*(uint8_t *)arg) ); /* set contrast from, keep gain at 0 */
u8g_SetChipSelect(u8g, dev, 1);
u8g_SetChipSelect(u8g, dev, 0);
return 1;
}
return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg);
Expand Down
2 changes: 1 addition & 1 deletion csrc/u8g_rot.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ uint8_t u8g_dev_rot90_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg);
uint8_t u8g_dev_rot180_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg);
uint8_t u8g_dev_rot270_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg);

uint8_t u8g_dev_rot_dummy_fn(void *u8g, void *dev, uint8_t msg, void *arg)
uint8_t u8g_dev_rot_dummy_fn(u8g_t *u8g, u8g_dev_t*dev, uint8_t msg, void *arg)
{
return 0;
}
Expand Down
Loading

0 comments on commit b85e668

Please sign in to comment.