lcd_oled.c ans ssd1306_i2c.c is taking shape, now the initialisation functions are made and we cna call lcd_oled_draw_pixel() and lcd_oled_print_char()

master
Kerem Yollu 2 years ago
parent 13dc881419
commit f330f8fe9a

@ -2,8 +2,10 @@
#include "ssd1306_i2c.h"
i2c_t i2c_device;
int16_t cursor_y = 0;
int16_t cursor_x = 0;
#define pgm_read_byte(addr) (*(const uint8_t *)(addr))
#define ssd1306_swap(a, b) { int16_t t = a; a = b; b = t; }
#define ROTATION 0 // TODO: This shoudl be initiated at the function
uint8_t display_buffer[LCD_OLED_SIZE_X * LCD_OLED_SIZE_Y / 8] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -71,3 +73,122 @@ uint8_t display_buffer[LCD_OLED_SIZE_X * LCD_OLED_SIZE_Y / 8] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
void lcd_oled_init(i2c_t *i2c_dev, uint8_t address)
{
i2c_init(&i2c_device, I2C_CH_1, i2c_mode_master, 0x00,0x00, i2c_address_count_single, i2c_address_size_7b, i2c_clk_speed_standart, i2c_clk_stretching_disable, i2c_wake_disabled);
ssd1306_i2c_set_display_off(i2c_dev);
ssd1306_i2c_set_display_clkDiv_oscFreq(i2c_dev, 0, 15); // Working but to be refined
ssd1306_i2c_set_multiplex_ratio(i2c_dev, LCD_OLED_SIZE_Y - 1); // Pages start at 0 and ends at 63
ssd1306_i2c_set_display_offset(i2c_dev, 0x00); // No Offset
ssd1306_i2c_set_display_start_line(i2c_dev, 0); // Start line 0
ssd1306_i2c_set_chage_pump(i2c_dev, SSD1306_SWITCHCAPVCC);
ssd1306_i2c_set_memory_addressing_mode(i2c_dev, SSD1306_MEMORY_MODE_HORIZONTAL);
ssd1306_i2c_set_segment_remap(i2c_dev, 1);
ssd1306_i2c_set_com_scan_direction(i2c_dev, 0); //Decremental TODO : Make a define for it
ssd1306_i2c_set_com_pins(i2c_dev, SSD1306_COM_SEQ_LR_REMAP_ON);
ssd1306_i2c_set_contrast(i2c_dev,0x9F);
ssd1306_i2c_set_prechage_period(i2c_dev, 0xF0); // TODO : I don't know what he exxect is
ssd1306_i2c_set_com_deselect_level(i2c_dev, 0x40); // TODO : PLeanty of things can influance this capacitor value being the most importnat one
ssd1306_i2c_set_display_entire_on(i2c_dev, SSD1306_DISPLAYALLON_RESUME);
ssd1306_i2c_set_display_invert_pixel(i2c_dev, 0); // Normal pilex printing. Warning this hurts the eye
ssd1306_i2c_set_scroll(i2c_dev, 0);// Turn scrolling off
ssd1306_i2c_set_display_on(i2c_dev);
}
uint8_t lcd_oled_clear()
{
memset(display_buffer, 0,(LCD_OLED_SIZE_X * LCD_OLED_SIZE_Y / 8) * sizeof(uint8_t));
return 1;
}
uint8_t lcd_oled_display()
{
ssd1306_i2c_command(&i2c_device,SSD1306_COLUMNADDR);
ssd1306_i2c_command(&i2c_device,0); // Column start address (0 = reset)
ssd1306_i2c_command(&i2c_device,LCD_OLED_SIZE_X - 1); // Column end address (127
// = reset)
ssd1306_i2c_command(&i2c_device,SSD1306_PAGEADDR);
ssd1306_i2c_command(&i2c_device,0); // Page start address (0 = reset)
ssd1306_i2c_command(&i2c_device,7); // Page end address
uint8_t i2cDataLenght = 1; // Co = 0, D/C = 0
uint16_t address = SSD1306_I2C_ADDRESS; // Co = 0, D/C = 0
uint8_t reg = 0x40;
// I2C
int16_t i;
for (i = 0; i < (LCD_OLED_SIZE_X * SSD1306_LCDHEIGHT / 8); i++) {
i2c_write(&i2c_device, &address, &reg, &display_buffer[i], &i2cDataLenght);
//This sends byte by byte.
//Better to send all buffer
//Should be optimized
}
}
void lcd_oled_print_char(uint16_t x, uint16_t y, uint8_t c, uint8_t color)
{
uint8_t size = 1;
if ((x >= WIDTH) || // Clip right
(y >= HEIGHT) || // Clip bottom
((x + 6 * size - 1) < 0) || // Clip left
((y + 8 * size - 1) < 0)) // Clip top
return;
int16_t i;
int16_t j;
for (i = 0; i < 6; i++) {
int16_t line;
if (i == 5)
line = 0x0;
else
line = pgm_read_byte(font + (c * 5) + i);
for (j = 0; j < 8; j++) {
if (line & 0x1) {
if (size == 1) // default size
lcd_oled_draw_pixel(x + i, y + j, color);
else { // big size To implement
//ssd1306_fillRect(x + (i * size),
// y + (j * size), size,
// size, color);
}
}
line >>= 1;
}
}
}
void lcd_oled_draw_pixel(uint16_t x, uint16_t y, uint8_t color)
{
if ((x < 0) || (x >= LCD_OLED_SIZE_X) || (y < 0) || (y >= LCD_OLED_SIZE_Y))
return;
// check rotation, move pixel around if necessary
switch (ROTATION) {
case 1:
ssd1306_swap(x, y);
x = LCD_OLED_SIZE_X - x - 1;
break;
case 2:
x = LCD_OLED_SIZE_X - x - 1;
y = LCD_OLED_SIZE_Y - y - 1;
break;
case 3:
ssd1306_swap(x, y);
y = LCD_OLED_SIZE_Y - y - 1;
break;
}
// x is which column
switch (color) {
case WHITE:
display_buffer[x + (y / 8) * LCD_OLED_SIZE_X] |= (1 << (y & 7));
break;
case BLACK:
display_buffer[x + (y / 8) * LCD_OLED_SIZE_X] &= ~(1 << (y & 7));
break;
case INVERSE:
display_buffer[x + (y / 8) * LCD_OLED_SIZE_X] ^= (1 << (y & 7));
break;
}
}

@ -6,6 +6,8 @@ extern "C" {
#endif
#include <stdint.h>
#include <string.h>
#include "oled_fonts.h"
#define FILLED 1
#define EMPTY 0
@ -17,7 +19,7 @@ extern "C" {
#if defined LCD_OLED_I2C
#include "i2c.h"
void lcd_oled_init(i2c_t *i2c_dev, pinNo_t pinNo, uint8_t address);
void lcd_oled_init(i2c_t *i2c_dev, uint8_t address);
#elif defined LCD_OLED_SPI
#include "spi.h"
@ -64,7 +66,7 @@ void lcd_oled_change_contrast(uint8_t contrast);
void lcd_oled_rotate(uint8_t angle);
void lcd_oled_inverse(uint8_t yseNo);
void lcd_oled_invert(uint8_t yseNo);
#ifdef __cplusplus
}

@ -36,8 +36,6 @@ All text above, and the splash screen below must be included in any redistributi
#define rotation 0
#define pgm_read_byte(addr) (*(const uint8_t *)(addr))
int8_t cursor_y = 0;
int8_t cursor_x = 0;
@ -175,45 +173,9 @@ uint8_t buffer[SSD1306_LCDWIDTH * SSD1306_LCDHEIGHT / 8] = {
int8_t _vccstate;
int16_t i2cd;
i2c_t i2c_device;
#define ssd1306_swap(a, b) { int16_t t = a; a = b; b = t; }
// the most basic function, set a single pixel
void ssd1306_drawPixel(int16_t x, int16_t y, uint16_t color)
{
if ((x < 0) || (x >= WIDTH) || (y < 0) || (y >= HEIGHT))
return;
// check rotation, move pixel around if necessary
switch (rotation) {
case 1:
ssd1306_swap(x, y);
x = WIDTH - x - 1;
break;
case 2:
x = WIDTH - x - 1;
y = HEIGHT - y - 1;
break;
case 3:
ssd1306_swap(x, y);
y = HEIGHT - y - 1;
break;
}
// x is which column
switch (color) {
case WHITE:
buffer[x + (y / 8) * SSD1306_LCDWIDTH] |= (1 << (y & 7));
break;
case BLACK:
buffer[x + (y / 8) * SSD1306_LCDWIDTH] &= ~(1 << (y & 7));
break;
case INVERSE:
buffer[x + (y / 8) * SSD1306_LCDWIDTH] ^= (1 << (y & 7));
break;
}
}
//Section : 10.1.12 Set Display ON/OFF (AEh/AFh) | Page 37
void ssd1306_i2c_set_display_off(i2c_t *i2c_dev)
@ -231,8 +193,19 @@ void ssd1306_i2c_set_display_on(i2c_t *i2c_dev)
// Section : 10.1.16 Set Display Clock Divide Ratio/ Oscillator Frequency (D5h) | Page : 40
void ssd1306_i2c_set_display_clkDiv_oscFreq(i2c_t *i2c_dev, uint8_t clockDivider, uint8_t oscillatorFreq)
{
uint8_t value = 0;
if(oscillatorFreq <= 15)
{
if(clockDivider <= 16)
{
value = (oscillatorFreq << 4) | clockDivider;
}
}
ssd1306_i2c_command(i2c_dev,SSD1306_SETDISPLAYCLOCKDIV); // 0xD5
ssd1306_i2c_command(i2c_dev,0x80); // the suggested ratio 0x80
ssd1306_i2c_command(i2c_dev,value); // the suggested ratio 0x80
}
// Section : 10.1.11 Set Multiplex Ratio (A8h) | Page : 37
@ -301,62 +274,73 @@ void ssd1306_i2c_set_com_scan_direction(i2c_t *i2c_dev, uint8_t incremental)
ssd1306_i2c_command(i2c_dev,SSD1306_COMSCANDEC);
}
}
// Init SSD1306
void ssd1306_begin(i2c_t *i2c_dev, uint16_t vccstate, uint16_t i2caddr)
{
// I2C Init
_vccstate = vccstate;
ssd1306_i2c_set_display_off(i2c_dev);
ssd1306_i2c_set_display_clkDiv_oscFreq(i2c_dev, 0x00, 0x00);
ssd1306_i2c_set_multiplex_ratio(i2c_dev, HEIGHT - 1); // Pages start at 0 and ends at 63
ssd1306_i2c_set_display_offset(i2c_dev, 0x00); // No Offset
ssd1306_i2c_set_display_start_line(i2c_dev, 0); // Start line 0
ssd1306_i2c_set_chage_pump(i2c_dev, vccstate);
ssd1306_i2c_set_memory_addressing_mode(i2c_dev, SSD1306_MEMORY_MODE_HORIZONTAL);
ssd1306_i2c_set_segment_remap(i2c_dev, 1);
ssd1306_i2c_set_com_scan_direction(i2c_dev, 0); //Decremental TODO : Make a define for it
#if defined SSD1306_128_32
ssd1306_i2c_command(i2c_dev,SSD1306_SETCOMPINS); // 0xDA
ssd1306_i2c_command(i2c_dev,0x02);
ssd1306_i2c_command(i2c_dev,SSD1306_SETCONTRAST); // 0x81
ssd1306_i2c_command(i2c_dev,0x8F);
#elif defined SSD1306_128_64
ssd1306_i2c_command(i2c_dev,SSD1306_SETCOMPINS); // 0xDA
ssd1306_i2c_command(i2c_dev,0x12);
// Section : 10.1.18 Set COM Pins Hardware Configuration (DAh) | Page : 40
void ssd1306_i2c_set_com_pins(i2c_t *i2c_dev, uint8_t alignment)
{
ssd1306_i2c_command(i2c_dev,SSD1306_SETCOMPINS);
ssd1306_i2c_command(i2c_dev,alignment);
}
void ssd1306_i2c_set_contrast(i2c_t *i2c_dev, uint8_t contrast)
{
ssd1306_i2c_command(i2c_dev,SSD1306_SETCONTRAST); // 0x81
if (vccstate == SSD1306_EXTERNALVCC) {
ssd1306_i2c_command(i2c_dev,0x9F);
} else {
ssd1306_i2c_command(i2c_dev,0xCF);
ssd1306_i2c_command(i2c_dev,contrast);
}
void ssd1306_i2c_set_prechage_period(i2c_t *i2c_dev, uint8_t period)
{
ssd1306_i2c_command(i2c_dev,SSD1306_SETPRECHARGE); // 0xd9
ssd1306_i2c_command(i2c_dev,period);
}
void ssd1306_i2c_set_com_deselect_level(i2c_t *i2c_dev, uint8_t voltageLevel)
{
ssd1306_i2c_command(i2c_dev,SSD1306_SETVCOMDETECT); // 0xDB
ssd1306_i2c_command(i2c_dev,voltageLevel);
}
void ssd1306_i2c_set_display_entire_on(i2c_t *i2c_dev, uint8_t resumeOrForce)
{
if(resumeOrForce = SSD1306_DISPLAYALLON_RESUME)
{
ssd1306_i2c_command(i2c_dev,SSD1306_DISPLAYALLON_RESUME); // 0xA4
}
else
{
ssd1306_i2c_command(i2c_dev,SSD1306_DISPLAYALLON); // 0xA4
}
#elif defined SSD1306_96_16
ssd1306_i2c_command(i2c_dev,SSD1306_SETCOMPINS); // 0xDA
ssd1306_i2c_command(i2c_dev,0x2); // ada x12
ssd1306_i2c_command(i2c_dev,SSD1306_SETCONTRAST); // 0x81
if (vccstate == SSD1306_EXTERNALVCC) {
ssd1306_i2c_command(i2c_dev,0x10);
} else {
ssd1306_i2c_command(i2c_dev,0xAF);
}
void ssd1306_i2c_set_display_invert_pixel(i2c_t *i2c_dev, uint8_t inverted)
{
if(inverted)
{
ssd1306_i2c_command(i2c_dev,SSD1306_INVERTDISPLAY); // 0xA6
}
else
{
ssd1306_i2c_command(i2c_dev,SSD1306_NORMALDISPLAY); // 0xA6
}
}
#endif
ssd1306_i2c_command(i2c_dev,SSD1306_SETPRECHARGE); // 0xd9
if (vccstate == SSD1306_EXTERNALVCC) {
ssd1306_i2c_command(i2c_dev,0x22);
} else {
ssd1306_i2c_command(i2c_dev,0xF1);
void ssd1306_i2c_set_scroll(i2c_t *i2c_dev, uint8_t onOff)
{
if(onOff)
{
ssd1306_i2c_command(i2c_dev,SSD1306_ACTIVATE_SCROLL);
}
ssd1306_i2c_command(i2c_dev,SSD1306_SETVCOMDETECT); // 0xDB
ssd1306_i2c_command(i2c_dev,0x40);
ssd1306_i2c_command(i2c_dev,SSD1306_DISPLAYALLON_RESUME); // 0xA4
ssd1306_i2c_command(i2c_dev,SSD1306_NORMALDISPLAY); // 0xA6
else
{
ssd1306_i2c_command(i2c_dev,SSD1306_DEACTIVATE_SCROLL);
}
}
ssd1306_i2c_command(i2c_dev,SSD1306_DEACTIVATE_SCROLL);
// Init SSD1306
void ssd1306_begin(i2c_t *i2c_dev, uint16_t i2caddr)
{
ssd1306_i2c_set_display_on(i2c_dev);
}
void ssd1306_invertDisplay(i2c_t *i2c_dev, uint16_t i)
@ -504,14 +488,6 @@ void ssd1306_dim(i2c_t *i2c_dev, uint16_t dim)
ssd1306_i2c_command(i2c_dev,contrast);
}
// clear everything
void ssd1306_clearDisplay()
{
memset(buffer, 0,
(SSD1306_LCDWIDTH * SSD1306_LCDHEIGHT / 8) * sizeof(int));
cursor_y = 0;
cursor_x = 0;
}
void ssd1306_drawFastHLineInternal(int16_t x, int16_t y, int16_t w, uint16_t color)
{
@ -841,31 +817,17 @@ void ssd1306_drawString(int8_t *str)
// Draw a character
void ssd1306_drawChar(int16_t x, int16_t y, uint8_t c, int16_t color, int16_t size)
{
//Adapted and optimized for oled_lcd.c
}
if ((x >= WIDTH) || // Clip right
(y >= HEIGHT) || // Clip bottom
((x + 6 * size - 1) < 0) || // Clip left
((y + 8 * size - 1) < 0)) // Clip top
return;
int16_t i;
int16_t j;
for (i = 0; i < 6; i++) {
int16_t line;
if (i == 5)
line = 0x0;
else
line = pgm_read_byte(font + (c * 5) + i);
for (j = 0; j < 8; j++) {
if (line & 0x1) {
if (size == 1) // default size
ssd1306_drawPixel(x + i, y + j, color);
else { // big size
ssd1306_fillRect(x + (i * size),
y + (j * size), size,
size, color);
}
}
line >>= 1;
}
}
// the most basic function, set a single pixel
void ssd1306_drawPixel(int16_t x, int16_t y, uint16_t color)
{
//Adapted and optimized for oled_lcd.c
}
// clear everything
void ssd1306_clearDisplay()
{
//Adapted and optimized for oled_lcd.c
}

@ -123,6 +123,10 @@ All text above, and the splash screen must be included in any redistribution
#define SSD1306_COMSCANINC 0xC0
#define SSD1306_COMSCANDEC 0xC8
#define SSD1306_COM_SEQ_LR_REMAP_OFF 0x02
#define SSD1306_COM_SEQ_LR_REMAP_ON 0x12
#define SSD1306_COM_ALT_LR_REMAP_OFF 0x0A
#define SSD1306_COM_ALT_LR_REMAP_ON 0x1A
#define SSD1306_SEGREMAP 0xA0
@ -143,7 +147,7 @@ All text above, and the splash screen must be included in any redistribution
#define SSD1306_VERTICAL_AND_LEFT_HORIZONTAL_SCROLL 0x2A
//switchvcc should be SSD1306_SWITCHCAPVCC
void ssd1306_begin(i2c_t *i2c_dev, uint16_t vccstate, uint16_t i2caddr);
void ssd1306_begin(i2c_t *i2c_dev, uint16_t i2caddr);
void ssd1306_i2c_command(i2c_t *i2c_dev,uint16_t c);
void ssd1306_display(i2c_t *i2c_dev);
@ -182,6 +186,13 @@ void ssd1306_i2c_set_chage_pump(i2c_t *i2c_dev, uint8_t voltageSource);
void ssd1306_i2c_set_memory_addressing_mode(i2c_t *i2c_dev, uint8_t mode);
void ssd1306_i2c_set_segment_remap(i2c_t *i2c_dev, uint8_t enable);
void ssd1306_i2c_set_com_scan_direction(i2c_t *i2c_dev, uint8_t incremental);
void ssd1306_i2c_set_com_pins(i2c_t *i2c_dev, uint8_t alignment);
void ssd1306_i2c_set_contrast(i2c_t *i2c_dev, uint8_t contrast);
void ssd1306_i2c_set_prechage_period(i2c_t *i2c_dev, uint8_t period);
void ssd1306_i2c_set_com_deselect_level(i2c_t *i2c_dev, uint8_t voltageLevel);
void ssd1306_i2c_set_display_entire_on(i2c_t *i2c_dev, uint8_t resumeOrForce);
void ssd1306_i2c_set_display_invert_pixel(i2c_t *i2c_dev, uint8_t inverted);
void ssd1306_i2c_set_scroll(i2c_t *i2c_dev, uint8_t onOff);

@ -6,114 +6,15 @@
#include "timer.h"
#include "i2c.h"
#include "ssd1306_i2c.h"
void timer_test(timerNo_t timer, pinNo_t pin)
{
timerInitCounter(timer, 4000, 999, downCounting);
timerSart(timer);
for(int i = 0; i < 10 ; i++)
{
while(!timerGetUpdateInterrupt(timer));
timerClearUpdateInterrupt(timer);
pinToggle(pin);
}
pinWrite(pin,0);
}
void timer_capture_compare_test(timerNo_t timer)
{
uint16_t i = 0;
timerInitCounter(timer, 100, 99, downCounting);
// We use pin PA3 (Arduino header A2)
//timerInitOutputCompare(timer, toggle, 4, pinA3, 2,0, 300);
timerInitOutputCompare(timer, pwm_normal, 2, pinB3, 2,0, 900);
timerSart(timer);
while(1){
delayMs(200);
timerSetCounterCompareValue(timer, 2, i);
i += 10;
if(i>99) i = 0;
}
}
void printBinary32(uint32_t toPrint, uint8_t lsbFirst)
{
int i;
char pt;
if(lsbFirst)
{
print_Usart(usart2, "Bit Pos | 0| 1| 2| 3| 4| 5| 6| 7| 8| 9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|");
print_Usart(usart2, "\n\r");
print_Usart(usart2, "Bits |");
for(i=0; i < 32; i++)
{
pt = (toPrint >> i) & 1;
usartSendChar(usart2, ' ');
usartSendChar(usart2, pt + 0x30);
usartSendChar(usart2, '|');
}
}
else
{
print_Usart(usart2, "Bit Pos |31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10| 9| 8| 7| 6| 5| 4| 3| 2| 1| 0|");
print_Usart(usart2, "\n\r");
print_Usart(usart2, "Bits |");
for(i=0; i < 32; i++)
{
pt = (toPrint >> (31-i)) & 1;
usartSendChar(usart2, ' ');
usartSendChar(usart2, pt + 0x30);
usartSendChar(usart2, '|');
}
}
}
void printBinary8(uint8_t toPrint, uint8_t lsbFirst)
{
int i;
char pt;
if(lsbFirst)
{
print_Usart(usart2, "Bit Pos | 0| 1| 2| 3| 4| 5| 6| 7|");
print_Usart(usart2, "\n\r");
print_Usart(usart2, "Bits |");
for(i=0; i < 8; i++)
{
pt = (toPrint >> i) & 1;
usartSendChar(usart2, ' ');
usartSendChar(usart2, pt + 0x30);
usartSendChar(usart2, '|');
}
}
else
{
print_Usart(usart2, "Bit Pos | 7| 6| 5| 4| 3| 2| 1| 0|");
print_Usart(usart2, "\n\r");
print_Usart(usart2, "Bits |");
for(i=0; i < 8; i++)
{
pt = (toPrint >> (7-i)) & 1;
usartSendChar(usart2, ' ');
usartSendChar(usart2, pt + 0x30);
usartSendChar(usart2, '|');
}
}
}
#include "lcd_oled.h"
int main(int argc, char *argv[])
{
{
uint8_t i = 0;
uint16_t slaveAddress = 0xC0;
uint8_t registerToRead = 0x00;
uint8_t i2cRecieved = 0;
uint8_t i2cData = 0xFF;
uint8_t i2cDataLenght = 1;
i2c_t i2c_1;
delayInitMs(8000000, 1000); // Clock Freq and Divider for ARM library
@ -168,54 +69,54 @@ int main(int argc, char *argv[])
* -> R8 Needs to be bridged
*/
ssd1306_begin(&i2c_1, SSD1306_SWITCHCAPVCC, SSD1306_I2C_ADDRESS);
ssd1306_display(&i2c_1); //Adafruit logo is visible
lcd_oled_init(&i2c_1 , SSD1306_I2C_ADDRESS);
lcd_oled_display(); //Adafruit logo is visible
delayMs(1000);
ssd1306_clearDisplay(&i2c_1);
lcd_oled_clear();
i = 5;
ssd1306_drawChar(i, 5, 'K' , WHITE, 1);
lcd_oled_print_char(i, 5, 'K' , WHITE);
i += 6;
ssd1306_drawChar(i, 5, 'E' , WHITE, 1);
lcd_oled_print_char(i, 5, 'E' , WHITE);
i += 6;
ssd1306_drawChar(i, 5, 'D' , WHITE, 1);
lcd_oled_print_char(i, 5, 'D' , WHITE);
i += 6;
ssd1306_drawChar(i, 5, ' ' , WHITE, 1);
lcd_oled_print_char(i, 5, ' ' , WHITE);
i += 6;
ssd1306_drawChar(i, 5, 'W' , WHITE, 1);
lcd_oled_print_char(i, 5, 'W' , WHITE);
i += 6;
ssd1306_drawChar(i, 5, 'E' , WHITE, 1);
lcd_oled_print_char(i, 5, 'E' , WHITE);
i += 6;
ssd1306_drawChar(i, 5, 'L' , WHITE, 1);
lcd_oled_print_char(i, 5, 'L' , WHITE);
i += 6;
ssd1306_drawChar(i, 5, 'C' , WHITE, 1);
lcd_oled_print_char(i, 5, 'C' , WHITE);
i += 6;
ssd1306_drawChar(i, 5, 'O' , WHITE, 1);
lcd_oled_print_char(i, 5, 'O' , WHITE);
i += 6;
ssd1306_drawChar(i, 5, 'M' , WHITE, 1);
lcd_oled_print_char(i, 5, 'M' , WHITE);
i += 6;
ssd1306_drawChar(i, 5, 'E' , WHITE, 1);
lcd_oled_print_char(i, 5, 'E' , WHITE);
i += 6;
ssd1306_drawChar(i, 5, 'S' , WHITE, 1);
lcd_oled_print_char(i, 5, 'S' , WHITE);
i += 6;
ssd1306_drawChar(i, 5, ' ' , WHITE, 1);
lcd_oled_print_char(i, 5, ' ' , WHITE);
i += 6;
ssd1306_drawChar(i, 5, 'Y' , WHITE, 1);
lcd_oled_print_char(i, 5, 'Y' , WHITE);
i += 6;
ssd1306_drawChar(i, 5, 'O' , WHITE, 1);
lcd_oled_print_char(i, 5, 'O' , WHITE);
i += 6;
ssd1306_drawChar(i, 5, 'U' , WHITE, 1);
lcd_oled_print_char(i, 5, 'U' , WHITE);
for(i = 15; i < 50; i++)
{
ssd1306_drawPixel(i,i,WHITE);
lcd_oled_draw_pixel(i,i,WHITE);
}
for(i = 15; i < 53; i++)
{
ssd1306_drawPixel(15,i,WHITE);
lcd_oled_draw_pixel(15,i,WHITE);
}
ssd1306_display(&i2c_1);
lcd_oled_display(&i2c_1);
delayMs(2000);
print_Usart(usart2, "\n\r");
@ -231,4 +132,3 @@ int main(int argc, char *argv[])
return 1;
}

Loading…
Cancel
Save