Rev 30 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 30 | Rev 46 | ||
|---|---|---|---|
| Line 28... | Line 28... | ||
| 28 | #define abs(x) ((x)>0?(x):-(x)) |
28 | #define abs(x) ((x)>0?(x):-(x)) |
| 29 | 29 | ||
| 30 | static uint8_t rotation = 0; |
30 | static uint8_t rotation = 0; |
| 31 | const uint16_t WIDTH = SSD1306_LCDWIDTH; |
31 | const uint16_t WIDTH = SSD1306_LCDWIDTH; |
| 32 | const uint16_t HEIGHT = SSD1306_LCDHEIGHT; |
32 | const uint16_t HEIGHT = SSD1306_LCDHEIGHT; |
| - | 33 | const uint16_t RAMWIDTH = 128; |
|
| 33 | 34 | ||
| 34 | extern SPI_HandleTypeDef hspi1; |
35 | extern SPI_HandleTypeDef hspi1; |
| 35 | 36 | ||
| 36 | // the memory buffer for the LCD |
37 | // the memory buffer for the LCD |
| 37 | 38 | ||
| Line 350... | Line 351... | ||
| 350 | } |
351 | } |
| 351 | 352 | ||
| 352 | void display(void) { |
353 | void display(void) { |
| 353 | ssd1306_command(SSD1306_COLUMNADDR); |
354 | ssd1306_command(SSD1306_COLUMNADDR); |
| 354 | ssd1306_command(0); // Column start address (0 = reset) |
355 | ssd1306_command(0); // Column start address (0 = reset) |
| 355 | ssd1306_command(131); // Column end address (127 = reset) |
356 | ssd1306_command(RAMWIDTH-1); // Column end address (127 = reset) |
| 356 | 357 | ||
| 357 | ssd1306_command(SSD1306_PAGEADDR); |
358 | ssd1306_command(SSD1306_PAGEADDR); |
| 358 | ssd1306_command(0); // Page start address (0 = reset) |
359 | ssd1306_command(0); // Page start address (0 = reset) |
| 359 | ssd1306_command((SSD1306_LCDHEIGHT == 64) ? 7 : 3); // Page end address |
360 | ssd1306_command((SSD1306_LCDHEIGHT == 64) ? 7 : 3); // Page end address |
| 360 | 361 | ||