Compare commits

...

6 Commits

8 changed files with 176 additions and 208 deletions

View File

@@ -29,13 +29,15 @@
#define BLACK SSD1306_BLACK ///< Draw 'off' pixels #define BLACK SSD1306_BLACK ///< Draw 'off' pixels
#define WHITE SSD1306_WHITE ///< Draw 'on' pixels #define WHITE SSD1306_WHITE ///< Draw 'on' pixels
#define NORMAL SSD1306_NORMAL
#define INVERSE SSD1306_INVERSE ///< Invert pixels #define INVERSE SSD1306_INVERSE ///< Invert pixels
#define SSD1306_ADDRESS 0x3C #define SSD1306_ADDRESS 0x3C
#define SSD1306_TIMEOUT 100 #define SSD1306_TIMEOUT 100
#define SSD1306_BLACK 0 ///< Draw 'off' pixels #define SSD1306_BLACK 0 ///< Draw 'off' pixels
#define SSD1306_WHITE 1 ///< Draw 'on' pixels #define SSD1306_WHITE 1 ///< Draw 'on' pixels
#define SSD1306_INVERSE 2 ///< Invert pixels #define SSD1306_NORMAL 2
#define SSD1306_INVERSE 3 ///< Invert pixels
#define SSD1306_MEMORYMODE 0x20 ///< See datasheet #define SSD1306_MEMORYMODE 0x20 ///< See datasheet
#define SSD1306_COLUMNADDR 0x21 ///< See datasheet #define SSD1306_COLUMNADDR 0x21 ///< See datasheet
@@ -82,7 +84,7 @@ uint8_t SSD1306_display_page(void);
void SSD1306_clear(uint8_t color); void SSD1306_clear(uint8_t color);
void SSD1306_set_pixel(uint8_t x, uint8_t y, uint8_t bw); void SSD1306_set_pixel(uint8_t x, uint8_t y, uint8_t bw);
void SSD1306_write_to_buffer(const uint8_t* data, uint8_t width, uint8_t height, int8_t pos_x, int8_t pos_y, uint8_t color); void SSD1306_write_to_buffer(const uint8_t* data, uint8_t width, uint8_t height, int8_t pos_x, int8_t pos_y, uint8_t mode);
void SSD1306_clear_buffer(uint8_t width, uint8_t height, int8_t pos_x, int8_t pos_y, uint8_t color); void SSD1306_clear_buffer(uint8_t width, uint8_t height, int8_t pos_x, int8_t pos_y, uint8_t color);
#ifdef TEST #ifdef TEST

View File

@@ -41,6 +41,6 @@ extern const FONT_INFO arial_8ptFontInfo;
uint8_t font_print_str(const FONT_INFO * font, uint8_t * text, uint8_t pos_x, uint8_t pos_y); uint8_t font_print_str(const FONT_INFO * font, uint8_t * text, uint8_t pos_x, uint8_t pos_y, uint8_t mode);
uint8_t font_string_lenght_px(const FONT_INFO * font, uint8_t * text); uint8_t font_string_lenght_px(const FONT_INFO * font, uint8_t * text);
#endif /* MK_FONTX_H_ */ #endif /* MK_FONTX_H_ */

View File

@@ -64,7 +64,7 @@ uint8_t SSD1306_display_page(void)
SSD1306_SendCommand(SSD1306_LCDWIDTH - 1); SSD1306_SendCommand(SSD1306_LCDWIDTH - 1);
SSD1306_SendData(buffer_oled + (page * SSD1306_LCDWIDTH), SSD1306_LCDWIDTH); SSD1306_SendData(buffer_oled + (page * SSD1306_LCDWIDTH), SSD1306_LCDWIDTH);
// page++;
if (++page > 7) if (++page > 7)
{ {
page = 0; page = 0;
@@ -148,94 +148,6 @@ void SSD1306_set_pixel(uint8_t x, uint8_t y, uint8_t bw)
} }
} }
// void ssd1306_write_to_buffer(const uint8_t* data, uint8_t width, uint8_t height, int8_t pos_x, int8_t pos_y)
// {
// int16_t max_x, max_y;
// uint8_t shift_x = 0, temp, row = 0;
// uint16_t buf_idx = 0, index = 0;
// // right boundry
// if (width + pos_x > SSD1306_LCDWIDTH) max_x = SSD1306_LCDWIDTH;
// else max_x = width + pos_x;
// // left boundry
// if (pos_x < 0)
// {
// shift_x = pos_x * -1;
// pos_x = 0;
// }
// // bottom boundry
// if (height + pos_y > SSD1306_LCDHEIGHT) max_y = SSD1306_LCDHEIGHT;
// else max_y = height + pos_y;
// max_y = max_y / 8 + (max_y % 8 == 0 ? 0 : 1);
// // top boundry
// if (pos_y < 0)
// {
// uint8_t abs_pos_y = pos_y * -1;
// row = abs_pos_y/8 + (abs_pos_y % 8 == 0 ? 0 : 1);
// pos_y = (8 - abs_pos_y%8)%8;
// }
// uint8_t shift = pos_y % 8;
// uint8_t mask_lsb = 0xFF >> (8 - shift);
// uint8_t mask_msb = 0xFF << shift;
// for (uint8_t y = pos_y / 8; y < max_y; y++)
// {
// index = width * row + shift_x;
// for (uint8_t x = pos_x; x < max_x; x++, index++)
// {
// buf_idx = y * SSD1306_LCDWIDTH + x;
// temp = buffer_oled[buf_idx];
// if (index < width * ((height + 7) / 8))
// temp = data[index] << shift | (temp & mask_lsb);
// // else if (height%8 != 0)
// // mask_msb = 0xFF << ((pos_y + height)%8);
// if (shift != 0 && index >= width)
// temp = data[index - width] >> (8 - shift) | (temp & mask_msb);
// buffer_oled[buf_idx] = temp;
// }
// row++;
// }
// }
// void ssd1306_clear_buffer (uint8_t width, uint8_t height, uint8_t pos_x, uint8_t pos_y)
// {
// uint16_t max_x, max_y, index = 0, temp, row = 0;
// if (width + pos_x > SSD1306_LCDWIDTH) max_x = SSD1306_LCDWIDTH;
// else max_x = width + pos_x;
// if (height + pos_y > SSD1306_LCDHEIGHT) max_y = SSD1306_LCDHEIGHT;
// else max_y = height + pos_y;
// max_y = max_y / 8 + (max_y % 8 == 0 ? 0 : 1);
// uint8_t shift = pos_y % 8;
// uint8_t mask_right = 0xFF >> shift;
// uint8_t mask_left = 0xFF << (8 - shift);
// for (uint8_t y = pos_y / 8; y < max_y; y++, index = width * row)
// {
// for (uint8_t x = pos_x; x < max_x; x++, index++)
// {
// temp = buffer_oled[y * SSD1306_LCDWIDTH + x];
// if (index < width * height/8)
// temp &= mask_left;
// if (index >= width)
// temp &= mask_right;
// buffer_oled[y * SSD1306_LCDWIDTH + x] = temp;
// }
// row++;
// }
// }
typedef struct typedef struct
{ {
uint16_t bitmap_max_idx; uint16_t bitmap_max_idx;
@@ -243,10 +155,12 @@ typedef struct
uint8_t buf_row_last; uint8_t buf_row_last;
uint8_t buf_col_first; uint8_t buf_col_first;
uint8_t buf_col_last; uint8_t buf_col_last;
uint8_t buf_mask_top;
uint8_t buf_mask_bottom;
uint8_t bitmap_col; uint8_t bitmap_col;
uint8_t bitmap_row;
uint8_t bitmap_row_first; uint8_t bitmap_row_first;
uint8_t shift; uint8_t bitmap_row_last;
uint8_t bitmap_shift;
}buf_bitmap_boundry_t; }buf_bitmap_boundry_t;
static void get_boundry (buf_bitmap_boundry_t* boundry, uint8_t bitmap_width, uint8_t bitmap_height, int8_t pos_x, int8_t pos_y) static void get_boundry (buf_bitmap_boundry_t* boundry, uint8_t bitmap_width, uint8_t bitmap_height, int8_t pos_x, int8_t pos_y)
@@ -260,13 +174,19 @@ static void get_boundry (buf_bitmap_boundry_t* boundry, uint8_t bitmap_width, ui
} }
if (pos_y < 0) { if (pos_y < 0) {
boundry->shift = (pos_y * -1); boundry->bitmap_shift = 8 + (pos_y % 8) ;
boundry->bitmap_row_first = boundry->shift / 8; boundry->bitmap_row_first = (pos_y / 8) * (-1) + 1;
boundry->buf_row_first = 0; boundry->buf_row_first = 0;
boundry->buf_mask_top = 0;
} else { } else {
boundry->shift = pos_y; boundry->bitmap_shift = pos_y % 8;
boundry->bitmap_row_first = 0; boundry->bitmap_row_first = 0;
boundry->buf_row_first = pos_y / 8; boundry->buf_row_first = pos_y / 8;
boundry->buf_mask_top = 0xFF >> (8 - boundry->bitmap_shift);
}
boundry->buf_mask_bottom = 0xFF << ((pos_y + bitmap_height) % 8);
if (boundry->buf_mask_bottom == 0xFF) {
boundry->buf_mask_bottom = 0;
} }
if ((bitmap_width + pos_x) > SSD1306_LCDWIDTH) { if ((bitmap_width + pos_x) > SSD1306_LCDWIDTH) {
@@ -281,8 +201,24 @@ static void get_boundry (buf_bitmap_boundry_t* boundry, uint8_t bitmap_width, ui
boundry->buf_row_last = (bitmap_height + pos_y + 7) / 8; boundry->buf_row_last = (bitmap_height + pos_y + 7) / 8;
} }
boundry->bitmap_row_last = (pos_y + bitmap_height) / 8;
boundry->bitmap_max_idx = bitmap_width * ((bitmap_height + 7) / 8); boundry->bitmap_max_idx = bitmap_width * ((bitmap_height + 7) / 8);
} }
static inline uint8_t get_bitmap_byte (const uint8_t* bitmap, uint16_t index, uint8_t color)
{
switch (color)
{
case INVERSE:
return ~(bitmap[index]);
case WHITE:
return 0xFF;
case BLACK:
return 0x00;
default:
return bitmap[index];
}
}
/** /**
* @brief A function that writes a bitmap into the buffer at the given position. * @brief A function that writes a bitmap into the buffer at the given position.
* 0,0 -------->x * 0,0 -------->x
@@ -295,14 +231,15 @@ static void get_boundry (buf_bitmap_boundry_t* boundry, uint8_t bitmap_width, ui
* @param bitmap_height Bitmap height in pixels. * @param bitmap_height Bitmap height in pixels.
* @param pos_x Position x in the display * @param pos_x Position x in the display
* @param pos_y Position y in the display * @param pos_y Position y in the display
* @param color WHITE (1) normal mode, others will cause inverse mode * @param color NORMAL (2) normal mode or INVERSE mode for bitmap
* WHITE (0) or black (1) for fill screen
*/ */
void SSD1306_write_to_buffer(const uint8_t* bitmap, uint8_t bitmap_width, uint8_t bitmap_height, int8_t pos_x, int8_t pos_y, uint8_t color) void SSD1306_write_to_buffer(const uint8_t* bitmap, uint8_t bitmap_width, uint8_t bitmap_height, int8_t pos_x, int8_t pos_y, uint8_t mode)
{ {
if (bitmap_width + pos_x < 0 || bitmap_height + pos_y < 0) return; if (bitmap_width + pos_x < 0 || bitmap_height + pos_y < 0) return;
uint16_t tmp_buf16, bitmap_idx; uint16_t tmp_buf16, bitmap_idx, buf_idx;
uint8_t mask_buf, tmp_bitmap; uint8_t tmp_bitmap, bitmap_row;
buf_bitmap_boundry_t b; buf_bitmap_boundry_t b;
get_boundry(&b, bitmap_width, bitmap_height, pos_x, pos_y); get_boundry(&b, bitmap_width, bitmap_height, pos_x, pos_y);
@@ -310,43 +247,29 @@ void SSD1306_write_to_buffer(const uint8_t* bitmap, uint8_t bitmap_width, uint8_
for(uint8_t col = b.buf_col_first; col < b.buf_col_last; col++, b.bitmap_col++) for(uint8_t col = b.buf_col_first; col < b.buf_col_last; col++, b.bitmap_col++)
{ {
tmp_buf16 = 0; tmp_buf16 = 0;
b.bitmap_row = b.bitmap_row_first; bitmap_row = b.bitmap_row_first;
for( uint8_t buf_row = b.buf_row_first; buf_row < b.buf_row_last; buf_row++, b.bitmap_row++ )
if (b.bitmap_row_first > 0) {
tmp_buf16 = get_bitmap_byte(bitmap, bitmap_width * (b.bitmap_row_first - 1) + b.bitmap_col, mode) >> (8 - b.bitmap_shift);
} else {
tmp_buf16 = buffer_oled[b.buf_row_first * SSD1306_LCDWIDTH + col] & b.buf_mask_top;
}
for( uint8_t buf_row = b.buf_row_first; buf_row < b.buf_row_last; buf_row++, bitmap_row++ )
{ {
bitmap_idx = bitmap_width * b.bitmap_row + b.bitmap_col; bitmap_idx = bitmap_width * bitmap_row + b.bitmap_col;
mask_buf = 0; buf_idx = buf_row * SSD1306_LCDWIDTH + col;
if (b.bitmap_row == 0 && pos_y > 0) { if (bitmap_idx < b.bitmap_max_idx) {
mask_buf |= 0xFF >> (8 - (b.shift % 8)); tmp_bitmap = get_bitmap_byte(bitmap, bitmap_idx, mode);
tmp_buf16 |= tmp_bitmap << b.bitmap_shift;
} }
uint8_t shifted_pixels_left = (pos_y + bitmap_height) - b.bitmap_row * 8; if ( b.bitmap_row_last == buf_row) {
if (shifted_pixels_left < 8) { buffer_oled[buf_idx] = (buffer_oled[buf_idx] & b.buf_mask_bottom) | (tmp_buf16 & ~(b.buf_mask_bottom));
mask_buf |= (0xFF << shifted_pixels_left); } else {
buffer_oled[buf_idx] = (uint8_t) tmp_buf16;
} }
tmp_buf16 |= buffer_oled[buf_row * SSD1306_LCDWIDTH + col] & mask_buf;
if (bitmap_idx < b.bitmap_max_idx)
{
switch (color)
{
case WHITE:
tmp_bitmap = bitmap[bitmap_idx];
break;
default:
tmp_bitmap = ~(bitmap[bitmap_idx]);
break;
}
if (pos_y < 0) {
tmp_buf16 |= tmp_bitmap >> (b.shift % 8);
} else {
tmp_buf16 |= tmp_bitmap << (b.shift % 8);
}
}
buffer_oled[buf_row * SSD1306_LCDWIDTH + col] = (uint8_t) tmp_buf16;
tmp_buf16 = tmp_buf16 >> 8; tmp_buf16 = tmp_buf16 >> 8;
} }
} }
@@ -354,55 +277,6 @@ void SSD1306_write_to_buffer(const uint8_t* bitmap, uint8_t bitmap_width, uint8_
void SSD1306_clear_buffer(uint8_t width, uint8_t height, int8_t pos_x, int8_t pos_y, uint8_t color) void SSD1306_clear_buffer(uint8_t width, uint8_t height, int8_t pos_x, int8_t pos_y, uint8_t color)
{ {
if (width + pos_x < 0 || height + pos_y < 0) return; SSD1306_write_to_buffer(NULL, width, height, pos_x, pos_y, color);
uint16_t tmp_buf16, bitmap_idx;
uint8_t mask_buf;
switch(color)
{
case WHITE:
color = 0xFF;
break;
case BLACK:
color = 0x00;
break;
}
buf_bitmap_boundry_t b;
get_boundry(&b, width, height, pos_x, pos_y);
for(uint8_t col = b.buf_col_first; col < b.buf_col_last; col++, b.bitmap_col++)
{
tmp_buf16 = 0;
b.bitmap_row = b.bitmap_row_first;
for( uint8_t buf_row = b.buf_row_first; buf_row < b.buf_row_last; buf_row++, b.bitmap_row++ )
{
bitmap_idx = width * b.bitmap_row + b.bitmap_col;
mask_buf = 0;
if (b.bitmap_row == 0 && pos_y > 0) {
mask_buf |= 0xFF >> (8 - (b.shift % 8));
}
uint8_t shifted_pixels_left = (pos_y + height) - b.bitmap_row * 8;
if (shifted_pixels_left < 8) {
mask_buf |= (0xFF << shifted_pixels_left);
}
tmp_buf16 |= buffer_oled[buf_row * SSD1306_LCDWIDTH + col] & mask_buf;
if (bitmap_idx < b.bitmap_max_idx)
{
if (pos_y < 0) {
tmp_buf16 |= color >> (b.shift % 8);
} else {
tmp_buf16 |= color << (b.shift % 8);
}
}
buffer_oled[buf_row * SSD1306_LCDWIDTH + col] = (uint8_t) tmp_buf16;
tmp_buf16 = tmp_buf16 >> 8;
}
}
} }

View File

@@ -2015,7 +2015,7 @@ const FONT_CHAR_INFO arial_12ptDescriptors[] =
const FONT_INFO arial_12ptFontInfo = const FONT_INFO arial_12ptFontInfo =
{ {
16, /* Character height */ 16, /* Character height */
'!', /* Start character */ ' ', /* Start character */
'~', /* End character */ '~', /* End character */
2, /* Space between chars */ 2, /* Space between chars */
arial_12ptDescriptors, /* Character descriptor array */ arial_12ptDescriptors, /* Character descriptor array */

View File

@@ -9,7 +9,7 @@
#include "fonts.h" #include "fonts.h"
#include "SSD1306_oled.h" #include "SSD1306_oled.h"
uint8_t font_print_str(const FONT_INFO * font, uint8_t * text, uint8_t pos_x, uint8_t pos_y) uint8_t font_print_str(const FONT_INFO * font, uint8_t * text, uint8_t pos_x, uint8_t pos_y, uint8_t mode)
{ {
uint8_t height = font->heightPixels; uint8_t height = font->heightPixels;
@@ -17,7 +17,14 @@ uint8_t font_print_str(const FONT_INFO * font, uint8_t * text, uint8_t pos_x, ui
uint8_t width = font_string_lenght_px(font, text); uint8_t width = font_string_lenght_px(font, text);
SSD1306_clear_buffer(width, height, pos_x, pos_y, WHITE); switch (mode) {
case INVERSE:
SSD1306_clear_buffer(width+2, height+2, pos_x-1, pos_y-1, WHITE);
break;
default:
SSD1306_clear_buffer(width+2, height+2, pos_x-1, pos_y-1, BLACK);
break;
}
while(*text) while(*text)
{ {
@@ -30,7 +37,7 @@ uint8_t font_print_str(const FONT_INFO * font, uint8_t * text, uint8_t pos_x, ui
uint8_t char_nr = actual_char - font->startChar; uint8_t char_nr = actual_char - font->startChar;
const FONT_CHAR_INFO *charinfo = &font->charInfo[char_nr]; const FONT_CHAR_INFO *charinfo = &font->charInfo[char_nr];
ssd1306_write_to_buffer(font->data + charinfo->offset, charinfo->widthBits, height, x, pos_y, WHITE); SSD1306_write_to_buffer(font->data + charinfo->offset, charinfo->widthBits, height, x, pos_y, mode);
x += charinfo->widthBits + font->interspacePixels; x += charinfo->widthBits + font->interspacePixels;
} }

View File

@@ -59,7 +59,8 @@ void _ITM_SendChar(char character, void* arg);
/* Private user code ---------------------------------------------------------*/ /* Private user code ---------------------------------------------------------*/
/* USER CODE BEGIN 0 */ /* USER CODE BEGIN 0 */
int8_t counter = 0;
uint8_t tekst[32];
/* USER CODE END 0 */ /* USER CODE END 0 */
/** /**
@@ -97,15 +98,26 @@ int main(void)
SSD1306_display_all(); SSD1306_display_all();
// fctprintf(_ITM_SendChar, NULL, "This is a test: %X", 0xAA); // fctprintf(_ITM_SendChar, NULL, "This is a test: %X", 0xAA);
// ssd1306_write_to_buffer(dualshock_btn[0], 24, 24, 10, 3); // ssd1306_write_to_buffer(dualshock_btn[0], 24, 24, 10, 3);
font_print_str(&arial_8ptFontInfo,(uint8_t *) "AgBj0yH", 0, 10); // font_print_str(&arial_8ptFontInfo,(uint8_t *) "AgBj0yH", 0, 10);
font_print_str(&arial_8ptFontInfo,(uint8_t *) "gBj0yHa", 0, 0); // font_print_str(&arial_8ptFontInfo,(uint8_t *) "BarTooL jest Mistrzem", 0, 20);
SSD1306_display_all(); // SSD1306_clear_buffer(10, 10, 64, 24, WHITE);
// SSD1306_display_all();
/* USER CODE END 2 */ /* USER CODE END 2 */
/* Infinite loop */ /* Infinite loop */
/* USER CODE BEGIN WHILE */ /* USER CODE BEGIN WHILE */
while (1) while (1)
{ {
sprintf((char*)tekst, "%3d", counter);
// font_print_str(&arial_12ptFontInfo, tekst, 5, 16);
SSD1306_clear(BLACK);
font_print_str(&arial_8ptFontInfo, tekst, 40, 8, INVERSE);
SSD1306_clear_buffer(24, 12, 0, counter++, WHITE);
if (counter > 64+12){
counter = -16;
}
SSD1306_display_all();
// HAL_Delay(100);
/* USER CODE END WHILE */ /* USER CODE END WHILE */
/* USER CODE BEGIN 3 */ /* USER CODE BEGIN 3 */

73
oled_fonts Debug.launch Normal file
View File

@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="com.st.stm32cube.ide.mcu.debug.launch.launchConfigurationType">
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.access_port_id" value="0"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.enable_live_expr" value="true"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.enable_swv" value="false"/>
<intAttribute key="com.st.stm32cube.ide.mcu.debug.launch.formatVersion" value="2"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.ip_address_local" value="localhost"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.loadList" value="{&quot;fItems&quot;:[{&quot;fIsFromMainTab&quot;:true,&quot;fPath&quot;:&quot;Debug\\oled_fonts.elf&quot;,&quot;fProjectName&quot;:&quot;oled_fonts&quot;,&quot;fPerformBuild&quot;:true,&quot;fDownload&quot;:true,&quot;fLoadSymbols&quot;:true}]}"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.override_start_address_mode" value="default"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.remoteCommand" value="target remote"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.startServer" value="true"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.startuptab.exception.divby0" value="true"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.startuptab.exception.unaligned" value="false"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.startuptab.haltonexception" value="true"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.swd_mode" value="true"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.swv_port" value="61235"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.swv_trace_div" value="8"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.swv_trace_hclk" value="16000000"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.useRemoteTarget" value="true"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.vector_table" value=""/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.verify_flash_download" value="true"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.cti_allow_halt" value="false"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.cti_signal_halt" value="false"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.enable_external_loader" value="false"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.enable_logging" value="false"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.enable_max_halt_delay" value="false"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.enable_shared_stlink" value="false"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.external_loader" value=""/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.external_loader_init" value="false"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.frequency" value="0"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.halt_all_on_reset" value="false"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.log_file" value="D:\MyProjects\stm32\AIO_stm32cubeIDE\oled_fonts\Debug\st-link_gdbserver_log.txt"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.low_power_debug" value="enable"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.max_halt_delay" value="2"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.reset_strategy" value="connect_under_reset"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.stlink_check_serial_number" value="false"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.stlink_txt_serial_number" value=""/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.watchdog_config" value="none"/>
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlinkrestart_configurations" value="{&quot;fItems&quot;:[{&quot;fDisplayName&quot;:&quot;Reset&quot;,&quot;fIsSuppressible&quot;:false,&quot;fResetAttribute&quot;:&quot;Reset&quot;,&quot;fResetStrategies&quot;:[{&quot;fDisplayName&quot;:&quot;Reset&quot;,&quot;fLaunchAttribute&quot;:&quot;monitor reset&quot;,&quot;fGdbCommands&quot;:[&quot;monitor reset&quot;],&quot;fCmdOptions&quot;:[]},{&quot;fDisplayName&quot;:&quot;None&quot;,&quot;fLaunchAttribute&quot;:&quot;no_reset&quot;,&quot;fGdbCommands&quot;:[],&quot;fCmdOptions&quot;:[]}],&quot;fGdbCommandGroup&quot;:{&quot;name&quot;:&quot;Additional commands&quot;,&quot;commands&quot;:[]}}]}"/>
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.swv.swv_wait_for_sync" value="true"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doHalt" value="false"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doReset" value="false"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.initCommands" value=""/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.ipAddress" value="localhost"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.jtagDevice" value="ST-LINK (ST-LINK GDB server)"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.pcRegister" value=""/>
<intAttribute key="org.eclipse.cdt.debug.gdbjtag.core.portNumber" value="61234"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.runCommands" value=""/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setPcRegister" value="false"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setResume" value="true"/>
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setStopAt" value="true"/>
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.stopAt" value="main"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="arm-none-eabi-gdb"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.NON_STOP" value="true"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.UPDATE_THREADLIST_ON_SUSPEND" value="false"/>
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>
<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="remote"/>
<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="Debug\oled_fonts.elf"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="oled_fonts"/>
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="true"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.1500850490"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/oled_fonts"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;memoryBlockExpressionList context=&quot;reserved-for-future-use&quot;/&gt;&#13;&#10;"/>
<stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/>
</launchConfiguration>

View File

@@ -18,105 +18,105 @@ void tearDown(void)
void test_wrtie_to_buffer_at_pos_0_0_height_8pt(void) void test_wrtie_to_buffer_at_pos_0_0_height_8pt(void)
{ {
SSD1306_write_to_buffer(picture_8pt, SSD1306_LCDWIDTH, 8, 0, 0, WHITE); SSD1306_write_to_buffer(picture_8pt, SSD1306_LCDWIDTH, 8, 0, 0, NORMAL);
TEST_ASSERT_EQUAL_UINT8_ARRAY(posX_0_posY_0_8pt, buffer_oled, SSD1306_BUF_SIZE); TEST_ASSERT_EQUAL_UINT8_ARRAY(posX_0_posY_0_8pt, buffer_oled, SSD1306_BUF_SIZE);
} }
void test_wrtie_to_buffer_at_pos_1_0_height_8pt(void) void test_wrtie_to_buffer_at_pos_1_0_height_8pt(void)
{ {
SSD1306_write_to_buffer(picture_8pt, SSD1306_LCDWIDTH, 8, 0, 1, WHITE); SSD1306_write_to_buffer(picture_8pt, SSD1306_LCDWIDTH, 8, 0, 1, NORMAL);
TEST_ASSERT_EQUAL_UINT8_ARRAY(posX_0_posY_1_8pt, buffer_oled, SSD1306_BUF_SIZE); TEST_ASSERT_EQUAL_UINT8_ARRAY(posX_0_posY_1_8pt, buffer_oled, SSD1306_BUF_SIZE);
} }
void test_wrtie_to_buffer_at_pos_7_0_height_8pt(void) void test_wrtie_to_buffer_at_pos_7_0_height_8pt(void)
{ {
SSD1306_write_to_buffer(picture_8pt, SSD1306_LCDWIDTH, 8, 0, 7, WHITE); SSD1306_write_to_buffer(picture_8pt, SSD1306_LCDWIDTH, 8, 0, 7, NORMAL);
TEST_ASSERT_EQUAL_UINT8_ARRAY(posX_0_posY_7_8pt, buffer_oled, SSD1306_BUF_SIZE); TEST_ASSERT_EQUAL_UINT8_ARRAY(posX_0_posY_7_8pt, buffer_oled, SSD1306_BUF_SIZE);
} }
void test_wrtie_to_buffer_at_pos_0_0_height_16pt(void) void test_wrtie_to_buffer_at_pos_0_0_height_16pt(void)
{ {
SSD1306_write_to_buffer(picture_16pt, SSD1306_LCDWIDTH, 16, 0, 0, WHITE); SSD1306_write_to_buffer(picture_16pt, SSD1306_LCDWIDTH, 16, 0, 0, NORMAL);
TEST_ASSERT_EQUAL_UINT8_ARRAY(posX_0_posY_0_16pt, buffer_oled, SSD1306_BUF_SIZE); TEST_ASSERT_EQUAL_UINT8_ARRAY(posX_0_posY_0_16pt, buffer_oled, SSD1306_BUF_SIZE);
} }
void test_wrtie_to_buffer_at_pos_1_0_height_16pt(void) void test_wrtie_to_buffer_at_pos_1_0_height_16pt(void)
{ {
SSD1306_write_to_buffer(picture_16pt, SSD1306_LCDWIDTH, 16, 0, 1, WHITE); SSD1306_write_to_buffer(picture_16pt, SSD1306_LCDWIDTH, 16, 0, 1, NORMAL);
TEST_ASSERT_EQUAL_UINT8_ARRAY(posX_0_posY_1_16pt, buffer_oled, SSD1306_BUF_SIZE); TEST_ASSERT_EQUAL_UINT8_ARRAY(posX_0_posY_1_16pt, buffer_oled, SSD1306_BUF_SIZE);
} }
void test_wrtie_to_buffer_at_pos_7_0_height_16pt(void) void test_wrtie_to_buffer_at_pos_7_0_height_16pt(void)
{ {
SSD1306_write_to_buffer(picture_16pt, SSD1306_LCDWIDTH, 16, 0, 7, WHITE); SSD1306_write_to_buffer(picture_16pt, SSD1306_LCDWIDTH, 16, 0, 7, NORMAL);
TEST_ASSERT_EQUAL_UINT8_ARRAY(posX_0_posY_7_16pt, buffer_oled, SSD1306_BUF_SIZE); TEST_ASSERT_EQUAL_UINT8_ARRAY(posX_0_posY_7_16pt, buffer_oled, SSD1306_BUF_SIZE);
} }
void test_wrtie_to_buffer_at_pos_0_0_height_12pt(void) void test_wrtie_to_buffer_at_pos_0_0_height_12pt(void)
{ {
SSD1306_write_to_buffer(picture_12pt, SSD1306_LCDWIDTH, 12, 0, 0, WHITE); SSD1306_write_to_buffer(picture_12pt, SSD1306_LCDWIDTH, 12, 0, 0, NORMAL);
TEST_ASSERT_EQUAL_UINT8_ARRAY(posX_0_posY_0_12pt, buffer_oled, SSD1306_BUF_SIZE); TEST_ASSERT_EQUAL_UINT8_ARRAY(posX_0_posY_0_12pt, buffer_oled, SSD1306_BUF_SIZE);
} }
void test_wrtie_to_buffer_at_pos_1_0_height_12pt(void) void test_wrtie_to_buffer_at_pos_1_0_height_12pt(void)
{ {
SSD1306_write_to_buffer(picture_12pt, SSD1306_LCDWIDTH, 12, 0, 1, WHITE); SSD1306_write_to_buffer(picture_12pt, SSD1306_LCDWIDTH, 12, 0, 1, NORMAL);
TEST_ASSERT_EQUAL_UINT8_ARRAY(posX_0_posY_1_12pt, buffer_oled, SSD1306_BUF_SIZE); TEST_ASSERT_EQUAL_UINT8_ARRAY(posX_0_posY_1_12pt, buffer_oled, SSD1306_BUF_SIZE);
} }
void test_wrtie_to_buffer_at_pos_0_4_height_12pt(void) void test_wrtie_to_buffer_at_pos_4_0_height_12pt(void)
{ {
SSD1306_write_to_buffer(picture_12pt, SSD1306_LCDWIDTH, 12, 0, 4, WHITE); SSD1306_write_to_buffer(picture_12pt, SSD1306_LCDWIDTH, 12, 0, 4, NORMAL);
TEST_ASSERT_EQUAL_UINT8_ARRAY(posX_0_posY_4_12pt, buffer_oled, SSD1306_BUF_SIZE); TEST_ASSERT_EQUAL_UINT8_ARRAY(posX_0_posY_4_12pt, buffer_oled, SSD1306_BUF_SIZE);
} }
void test_wrtie_to_buffer_at_pos_7_0_height_12pt(void) void test_wrtie_to_buffer_at_pos_7_0_height_12pt(void)
{ {
SSD1306_write_to_buffer(picture_12pt, SSD1306_LCDWIDTH, 12, 0, 7, WHITE); SSD1306_write_to_buffer(picture_12pt, SSD1306_LCDWIDTH, 12, 0, 7, NORMAL);
TEST_ASSERT_EQUAL_HEX8_ARRAY(posX_0_posY_7_12pt, buffer_oled, SSD1306_BUF_SIZE); TEST_ASSERT_EQUAL_HEX8_ARRAY(posX_0_posY_7_12pt, buffer_oled, SSD1306_BUF_SIZE);
} }
void test_wrtie_to_buffer_at_pos_minus1_0_height_8pt(void) void test_wrtie_to_buffer_at_pos_minus1_0_height_8pt(void)
{ {
SSD1306_write_to_buffer(picture_8pt, SSD1306_LCDWIDTH, 8, 0, -1, WHITE); SSD1306_write_to_buffer(picture_8pt, SSD1306_LCDWIDTH, 8, 0, -1, NORMAL);
TEST_ASSERT_EQUAL_HEX8_ARRAY(posX_0_posY_minus1_8pt, buffer_oled, SSD1306_BUF_SIZE); TEST_ASSERT_EQUAL_HEX8_ARRAY(posX_0_posY_minus1_8pt, buffer_oled, SSD1306_BUF_SIZE);
} }
void test_wrtie_to_buffer_at_pos_minus7_0_height_8pt(void) void test_wrtie_to_buffer_at_pos_minus7_0_height_8pt(void)
{ {
SSD1306_write_to_buffer(picture_8pt, SSD1306_LCDWIDTH, 8, 0, -7, WHITE); SSD1306_write_to_buffer(picture_8pt, SSD1306_LCDWIDTH, 8, 0, -7, NORMAL);
TEST_ASSERT_EQUAL_HEX8_ARRAY(posX_0_posY_minus7_8pt, buffer_oled, SSD1306_BUF_SIZE); TEST_ASSERT_EQUAL_HEX8_ARRAY(posX_0_posY_minus7_8pt, buffer_oled, SSD1306_BUF_SIZE);
} }
void test_wrtie_to_buffer_at_pos_minus8_0_height_8pt(void) void test_wrtie_to_buffer_at_pos_minus8_0_height_8pt(void)
{ {
SSD1306_write_to_buffer(picture_8pt, SSD1306_LCDWIDTH, 8, 0, -8, WHITE); SSD1306_write_to_buffer(picture_8pt, SSD1306_LCDWIDTH, 8, 0, -8, NORMAL);
TEST_ASSERT_EQUAL_HEX8_ARRAY(buffer_oled, buffer_oled, SSD1306_BUF_SIZE); TEST_ASSERT_EQUAL_HEX8_ARRAY(buffer_oled, buffer_oled, SSD1306_BUF_SIZE);
} }
void test_wrtie_to_buffer_at_pos_0_minus1_height_8pt(void) void test_wrtie_to_buffer_at_pos_0_minus1_height_8pt(void)
{ {
SSD1306_write_to_buffer(picture_8pt, SSD1306_LCDWIDTH, 8, -1, 0, WHITE); SSD1306_write_to_buffer(picture_8pt, SSD1306_LCDWIDTH, 8, -1, 0, NORMAL);
TEST_ASSERT_EQUAL_HEX8_ARRAY(posX_minus1_posY_0_8pt, buffer_oled, SSD1306_BUF_SIZE); TEST_ASSERT_EQUAL_HEX8_ARRAY(posX_minus1_posY_0_8pt, buffer_oled, SSD1306_BUF_SIZE);
} }
void test_wrtie_to_buffer_at_pos_60_minus1_height_8pt(void) void test_wrtie_to_buffer_at_pos_60_minus1_height_8pt(void)
{ {
SSD1306_write_to_buffer(picture_8pt, SSD1306_LCDWIDTH, 8, -1, 60, WHITE); SSD1306_write_to_buffer(picture_8pt, SSD1306_LCDWIDTH, 8, -1, 60, NORMAL);
TEST_ASSERT_EQUAL_HEX8_ARRAY(posX_minus1_posY_60_8pt, buffer_oled, SSD1306_BUF_SIZE); TEST_ASSERT_EQUAL_HEX8_ARRAY(posX_minus1_posY_60_8pt, buffer_oled, SSD1306_BUF_SIZE);
} }