Skip to content

Commit

Permalink
Project: format all files according to defined rules
Browse files Browse the repository at this point in the history
  • Loading branch information
niwciu committed Jan 12, 2024
1 parent 1a94d89 commit 73691c6
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 52 deletions.
1 change: 0 additions & 1 deletion src/lcd_hd44780.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ extern "C"
#include "lcd_hd44780_interface.h"
#include "lcd_hd44780_def_char.h"


enum alignment
{
left,
Expand Down
23 changes: 11 additions & 12 deletions src/lcd_hd44780_def_char.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ extern "C"
{
#endif /* __cplusplus */

struct char_bank_struct
{
const uint8_t *char_0;
const uint8_t *char_1;
const uint8_t *char_2;
const uint8_t *char_3;
const uint8_t *char_4;
const uint8_t *char_5;
const uint8_t *char_6;
const uint8_t *char_7;
};
struct char_bank_struct
{
const uint8_t *char_0;
const uint8_t *char_1;
const uint8_t *char_2;
const uint8_t *char_3;
const uint8_t *char_4;
const uint8_t *char_5;
const uint8_t *char_6;
const uint8_t *char_7;
};

#if USE_DEF_CHAR_FUNCTION == ON
#define LCD_CGRAM_BYTES_PER_CHAR 8
Expand All @@ -41,7 +41,6 @@ struct char_bank_struct
// here add "definition" of new chars
/**********************USER CHAR DEFINITIONS END********************************/


/**********************USER CHAR CGRAM BANKS DEFINITIONS START*******************/
static const struct char_bank_struct lcd_cgram_bank_1 = {
Pol_e,
Expand Down
51 changes: 22 additions & 29 deletions test/lcd_hd44780/lcd_hd44780_test_buffering.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ TEST(lcd_hd44780_buffering, GivenLcdBufferingOnAndLcdInitWhenLcdBufStrThenLCD_UP
}

TEST(lcd_hd44780_buffering, GivenLcdBufferingOnAndLcdInitWhenLcdBufClsThenLCD_UPDATE_EVENTflagIsTRUE)
{
{
lcd_buf_cls();
TEST_ASSERT_TRUE(LCD_UPDATE_EVENT);
}
Expand Down Expand Up @@ -196,7 +196,7 @@ TEST(lcd_hd44780_buffering, GivenLcdBufferingOnAndLcdInitWhenUse_LcdInt_24_2_rig
define_expected_buffer_value_for_cls();
expected_lcd_buf[LINE_1][C1] = '2';
expected_lcd_buf[LINE_1][C2] = '4';
lcd_buf_int(24,2,right);
lcd_buf_int(24, 2, right);
lcd_update();
TEST_ASSERT_EQUAL_UINT8_ARRAY(expected_lcd_buf, lcd_buffer, (LCD_X * LCD_Y));
}
Expand All @@ -208,7 +208,7 @@ TEST(lcd_hd44780_buffering, GivenLcdBufferingOnAndLcdInitWhenUse_LcdInt_2444_2_r
expected_lcd_buf[LINE_1][C2] = '4';
expected_lcd_buf[LINE_1][C3] = '4';
expected_lcd_buf[LINE_1][C4] = '4';
lcd_buf_int(2444,2,right);
lcd_buf_int(2444, 2, right);
lcd_update();
TEST_ASSERT_EQUAL_UINT8_ARRAY(expected_lcd_buf, lcd_buffer, (LCD_X * LCD_Y));
}
Expand All @@ -221,8 +221,8 @@ TEST(lcd_hd44780_buffering, GivenLcdBufferingOnAndLcdInitWhenUse_LcdInt_16_4_rig
expected_lcd_buf[LINE_1][C3] = '1';
expected_lcd_buf[LINE_1][C4] = '6';
lcd_buf_str("1234");
lcd_buf_locate(LINE_1,C1);
lcd_buf_int(16,4,right);
lcd_buf_locate(LINE_1, C1);
lcd_buf_int(16, 4, right);
lcd_update();
TEST_ASSERT_EQUAL_UINT8_ARRAY(expected_lcd_buf, lcd_buffer, (LCD_X * LCD_Y));
}
Expand All @@ -239,20 +239,20 @@ TEST(lcd_hd44780_buffering, GivenLcdBufferingOnAndLcdInitWhenUse_LcdInt_61045_8_
expected_lcd_buf[LINE_1][C7] = ' ';
expected_lcd_buf[LINE_1][C8] = ' ';
lcd_buf_str("99999999");
lcd_buf_locate(LINE_1,C1);
lcd_buf_int(61045,8,left);
lcd_buf_locate(LINE_1, C1);
lcd_buf_int(61045, 8, left);
lcd_update();
TEST_ASSERT_EQUAL_UINT8_ARRAY(expected_lcd_buf, lcd_buffer, (LCD_X * LCD_Y));
}
#endif
#if USE_LCD_BUF_HEX== ON
#if USE_LCD_BUF_HEX == ON
TEST(lcd_hd44780_buffering, GivenLcdBufferingOnAndLcdInitWhenUse_lcd_hex_10_1_left_ThenLcdBufferContain0xaAsString)
{
define_expected_buffer_value_for_cls();
expected_lcd_buf[LINE_1][C1] = '0';
expected_lcd_buf[LINE_1][C2] = 'x';
expected_lcd_buf[LINE_1][C3] = 'a';
lcd_buf_hex(10,1,left);
lcd_buf_hex(10, 1, left);
lcd_update();
TEST_ASSERT_EQUAL_UINT8_ARRAY(expected_lcd_buf, lcd_buffer, (LCD_X * LCD_Y));
}
Expand All @@ -266,8 +266,8 @@ TEST(lcd_hd44780_buffering, GivenLcdBufferingOnAndLcdInitWhenUse_lcd_hex_255_6_r
expected_lcd_buf[LINE_1][C5] = 'f';
expected_lcd_buf[LINE_1][C6] = 'f';
lcd_buf_str("123456");
lcd_buf_locate(LINE_1,C1);
lcd_buf_hex(255,6,right);
lcd_buf_locate(LINE_1, C1);
lcd_buf_hex(255, 6, right);
lcd_update();
TEST_ASSERT_EQUAL_UINT8_ARRAY(expected_lcd_buf, lcd_buffer, (LCD_X * LCD_Y));
}
Expand All @@ -281,8 +281,8 @@ TEST(lcd_hd44780_buffering, GivenLcdBufferingOnAndLcdInitWhenUse_lcd_hex_20_5_ri
expected_lcd_buf[LINE_1][C4] = '1';
expected_lcd_buf[LINE_1][C5] = '4';
lcd_buf_str("12345");
lcd_buf_locate(LINE_1,C1);
lcd_buf_hex(20,5,right);
lcd_buf_locate(LINE_1, C1);
lcd_buf_hex(20, 5, right);
lcd_update();
TEST_ASSERT_EQUAL_UINT8_ARRAY(expected_lcd_buf, lcd_buffer, (LCD_X * LCD_Y));
}
Expand All @@ -295,13 +295,13 @@ TEST(lcd_hd44780_buffering, GivenLcdBufferingOnAndLcdInitWhenUse_lcd_hex_20_1_ri
expected_lcd_buf[LINE_1][C3] = '1';
expected_lcd_buf[LINE_1][C4] = '4';
lcd_buf_str("1234");
lcd_buf_locate(LINE_1,C1);
lcd_buf_hex(20,1,right);
lcd_buf_locate(LINE_1, C1);
lcd_buf_hex(20, 1, right);
lcd_update();
TEST_ASSERT_EQUAL_UINT8_ARRAY(expected_lcd_buf, lcd_buffer, (LCD_X * LCD_Y));
}

TEST( lcd_hd44780_buffering, GivenLcdBufferingOnAndLcdInitWhenUse_lcd_hex_20_6_left_ThenLcdBufferContainInt_0x14AsString)
TEST(lcd_hd44780_buffering, GivenLcdBufferingOnAndLcdInitWhenUse_lcd_hex_20_6_left_ThenLcdBufferContainInt_0x14AsString)
{
define_expected_buffer_value_for_cls();
expected_lcd_buf[LINE_1][C1] = '0';
Expand All @@ -311,8 +311,8 @@ TEST( lcd_hd44780_buffering, GivenLcdBufferingOnAndLcdInitWhenUse_lcd_hex_20_6_l
expected_lcd_buf[LINE_1][C5] = ' ';
expected_lcd_buf[LINE_1][C6] = ' ';
lcd_buf_str("123456");
lcd_buf_locate(LINE_1,C1);
lcd_buf_hex(20,6,left);
lcd_buf_locate(LINE_1, C1);
lcd_buf_hex(20, 6, left);
lcd_update();
TEST_ASSERT_EQUAL_UINT8_ARRAY(expected_lcd_buf, lcd_buffer, (LCD_X * LCD_Y));
}
Expand All @@ -328,8 +328,8 @@ TEST(lcd_hd44780_buffering, GivenLcdBufferingOnAndLcdInitWhenUse_lcd_bin_5_6_The
expected_lcd_buf[LINE_1][C5] = '0';
expected_lcd_buf[LINE_1][C6] = '1';
lcd_buf_str("123456");
lcd_buf_locate(LINE_1,C1);
lcd_buf_bin(5,6);
lcd_buf_locate(LINE_1, C1);
lcd_buf_bin(5, 6);
lcd_update();
TEST_ASSERT_EQUAL_UINT8_ARRAY(expected_lcd_buf, lcd_buffer, (LCD_X * LCD_Y));
}
Expand All @@ -343,20 +343,13 @@ TEST(lcd_hd44780_buffering, GivenLcdBufferingOnAndLcdInitWhenUse_lcd_bin_5_1_The
expected_lcd_buf[LINE_1][C4] = '0';
expected_lcd_buf[LINE_1][C5] = '1';
lcd_buf_str("12345");
lcd_buf_locate(LINE_1,C1);
lcd_buf_bin(5,1);
lcd_buf_locate(LINE_1, C1);
lcd_buf_bin(5, 1);
lcd_update();
TEST_ASSERT_EQUAL_UINT8_ARRAY(expected_lcd_buf, lcd_buffer, (LCD_X * LCD_Y));
}
#endif








// TEST(lcd_hd44780_buffering, )
// {
// TEST_FAIL_MESSAGE("Added test")
Expand Down
17 changes: 7 additions & 10 deletions test/lcd_hd44780/lcd_hd44780_test_runner.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ TEST_GROUP_RUNNER(lcd_hd44780_basic_functions)
// RUN_TEST_CASE(lcd_hd44780_basic_functions, );
}


TEST_GROUP_RUNNER(lcd_hd44780_buffering)
{
/* Test cases to run */
Expand All @@ -84,24 +83,22 @@ TEST_GROUP_RUNNER(lcd_hd44780_buffering)
RUN_TEST_CASE(lcd_hd44780_buffering, GivenLcdBufferingOnAndLcdInitAndLcdBufStrWhenLcdUpdateThenLcdCurrentScreenBufferIsEqualToLcdBuffer);
RUN_TEST_CASE(lcd_hd44780_buffering, GivenLcdBufferingOnAndLcdInitWhenLcdBufStrThenLcdCurrentScreenBufferStillContainSpaces);
RUN_TEST_CASE(lcd_hd44780_buffering, GivenLcdBufferingOnAndLcdInitAndSetLcdLocateLastLineLastCharacterAndLcdBufStrTestWhenUpdateLcdScrThenSignalSequenceForUpdateLcdScrIsCorrect);
#if USE_LCD_BUF_INT == ON
#if USE_LCD_BUF_INT == ON
RUN_TEST_CASE(lcd_hd44780_buffering, GivenLcdBufferingOnAndLcdInitWhenUse_LcdInt_24_2_right_ThenLcdBufferContainInt24AsString);
RUN_TEST_CASE(lcd_hd44780_buffering, GivenLcdBufferingOnAndLcdInitWhenUse_LcdInt_2444_2_right_ThenLcdBufferContainInt2444AsString);
RUN_TEST_CASE(lcd_hd44780_buffering, GivenLcdBufferingOnAndLcdInitWhenUse_LcdInt_16_4_right_ThenLcdBufferContainInt__16AsString);
RUN_TEST_CASE(lcd_hd44780_buffering, GivenLcdBufferingOnAndLcdInitWhenUse_LcdInt_61045_8_left_ThenLcdBufferContainInt61045___AsString);
#endif
#if USE_LCD_BUF_HEX == ON
#endif
#if USE_LCD_BUF_HEX == ON
RUN_TEST_CASE(lcd_hd44780_buffering, GivenLcdBufferingOnAndLcdInitWhenUse_lcd_hex_10_1_left_ThenLcdBufferContain0xaAsString);
RUN_TEST_CASE(lcd_hd44780_buffering, GivenLcdBufferingOnAndLcdInitWhenUse_lcd_hex_255_6_right_ThenLcdBufferContain__0xFFAsString);
RUN_TEST_CASE(lcd_hd44780_buffering, GivenLcdBufferingOnAndLcdInitWhenUse_lcd_hex_20_5_right_ThenLcdBufferContainInt_0x14AsString);
RUN_TEST_CASE(lcd_hd44780_buffering, GivenLcdBufferingOnAndLcdInitWhenUse_lcd_hex_20_1_right_ThenLcdBufferContainInt0x14AsString);
RUN_TEST_CASE(lcd_hd44780_buffering, GivenLcdBufferingOnAndLcdInitWhenUse_lcd_hex_20_6_left_ThenLcdBufferContainInt_0x14AsString);
#endif
#if USE_LCD_BUF_BIN == ON
#endif
#if USE_LCD_BUF_BIN == ON
RUN_TEST_CASE(lcd_hd44780_buffering, GivenLcdBufferingOnAndLcdInitWhenUse_lcd_bin_5_6_ThenLcdBufferContainInt0b0101AsString);
RUN_TEST_CASE(lcd_hd44780_buffering, GivenLcdBufferingOnAndLcdInitWhenUse_lcd_bin_5_1_ThenLcdBufferContainInt0b101AsString);
#endif
#endif

#endif
#endif
}

0 comments on commit 73691c6

Please sign in to comment.