Skip to content

Commit 2660474

Browse files
author
andygock
committed
Stop using 0b* binary respresentation, not compatible with non gcc compilers.
1 parent 518f6a3 commit 2660474

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

controllers/ST7565R.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ void glcd_power_up(void)
5858

5959
void glcd_set_y_address(uint8_t y)
6060
{
61-
glcd_command(ST7565R_PAGE_ADDRESS_SET | (0b00001111 & y));
61+
glcd_command(ST7565R_PAGE_ADDRESS_SET | (0x0F & y)); /* 0x0F = 0b00001111 */
6262
}
6363

6464
void glcd_set_x_address(uint8_t x)
@@ -89,7 +89,7 @@ void glcd_set_column_lower(uint8_t addr)
8989

9090
void glcd_set_start_line(uint8_t addr)
9191
{
92-
glcd_command( ST7565R_SET_START_LINE | (0b00111111 & addr));
92+
glcd_command( ST7565R_SET_START_LINE | (0x3F & addr)); /* 0x3F == 0b00111111 */
9393
}
9494

9595
/** Clear the display immediately, does not buffer */

controllers/ST7565R.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,17 @@
4242
#define ST7565R_H_
4343

4444
/* Commands */
45-
#define ST7565R_DISPLAY_ON 0b10101111
46-
#define ST7565R_DISPLAY_OFF 0b10101110
47-
#define ST7565R_PAGE_ADDRESS_SET 0b10110000
45+
#define ST7565R_DISPLAY_ON 0xAF /* 0b10101111 */
46+
#define ST7565R_DISPLAY_OFF 0xAE /* 0b10101110 */
47+
#define ST7565R_PAGE_ADDRESS_SET 0xB0 /* 0b10110000 */
4848
#define ST7565R_COLUMN_ADDRESS_SET_LOWER 0x00
4949
#define ST7565R_COLUMN_ADDRESS_SET_UPPER 0x10
50-
#define ST7565R_DISPLAY_NORMAL 0b10100100
51-
#define ST7565R_DISPLAY_ALL_ON 0b10100101
52-
#define ST7565R_NORMAL 0b10100000
53-
#define ST7565R_REVERSE 0b10100001
54-
#define ST7565R_RESET 0b11100010
55-
#define ST7565R_SET_START_LINE (1<<6)
50+
#define ST7565R_DISPLAY_NORMAL 0xA4 /* 0b10100100 */
51+
#define ST7565R_DISPLAY_ALL_ON 0xA5 /* 0b10100101 */
52+
#define ST7565R_NORMAL 0xA0 /* 0b10100000 */
53+
#define ST7565R_REVERSE 0xA1 /* 0b10100001 */
54+
#define ST7565R_RESET 0xE2 /* 0b11100010 */
55+
#define ST7565R_SET_START_LINE (1<<6)
5656

5757
/* These functions only available on ST7565 implementation (for now) */
5858

0 commit comments

Comments
 (0)