Skip to content

Commit

Permalink
Merge pull request #6 from niwciu/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
niwciu authored Dec 13, 2023
2 parents 2fe47cf + dca0d2a commit d64f88b
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 19 deletions.
65 changes: 61 additions & 4 deletions .github/workflows/run_lcd_hd44780_test .yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
pull_request:
branches: [main, develop]
jobs:
template_test_running:
LCD_HD44780_test_running_win:
name: LCD HD44780 Test RUN
runs-on: windows-latest
# strategy:
Expand All @@ -29,14 +29,71 @@ jobs:
cmake -Bout -GNinja
cmake --build out
- name: List files
working-directory: test/lcd_hd44780/out
run: dir
# - name: List files
# working-directory: test/lcd_hd44780/out
# run: dir

- name: Run LCD HD44780 tests
working-directory: test/lcd_hd44780/out
run: ./lcd_hd44780_test.exe -v

LCD_HD44780_AVR_test_running_win:
name: LCD HD44780 AVR Test RUN
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/[email protected]
with:
submodules: recursive

- name: Install Ninja
uses: seanmiddleditch/gha-setup-ninja@v3

- name: Build binary
working-directory: test/lcd_hd44780
run: |
mkdir out_avr
cmake -S ./avr_code_test -B out_avr -GNinja
cmake --build out_avr
# - name: List files
# working-directory: test/lcd_hd44780/out
# run: dir

- name: Run LCD HD44780 tests
working-directory: test/lcd_hd44780/out_avr
run: ./lcd_hd44780_test.exe -v

LCD_HD44780_test_running_ubuntu:
name: LCD HD44780 Test RUN Ubuntu
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/[email protected]
with:
submodules: recursive

- name: Install Ninja
uses: seanmiddleditch/gha-setup-ninja@v3

- name: Build binary
working-directory: test/lcd_hd44780
run: |
mkdir out
cmake -Bout -GNinja
cmake --build out
# - name: List files
# working-directory: test/lcd_hd44780/out
# run: dir

- name: Run LCD HD44780 tests
working-directory: test/lcd_hd44780/out
run: ./lcd_hd44780_test -v




# template_2_test_running:
# name: template_2 Test RUN
# runs-on: windows-latest
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
out/
out_avr/
Release/
Debug/
Build/
Expand Down
5 changes: 3 additions & 2 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,10 @@
"--force" ,
"--inline-suppr",
// "--output-file=reports/cppcheck.out", // this will print out report instead of printing problems in terminal
// "--platform=win64",
"--platform=win64",
"--suppress=missingInclude",
//"--suppress=unusedFunction",
"--suppress=missingIncludeSystem",
"--suppress=unusedFunction",
],
"options": {
"cwd": "${workspaceFolder}"
Expand Down
16 changes: 3 additions & 13 deletions src/lcd_hd44780.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,25 +99,15 @@ static void lcd_hex_AVR(int val, uint8_t width, enum alignment alignment);
static void lcd_bin_AVR(int val, uint8_t width);
#else
static void fill_bin_value_buffer(int val, char *bin_val_buffer);
static void fill_zeros_buffer(char *buffer, uint8_t width, char *zeros_buf);
#endif
#ifdef AVR
static void lcd_put_spaces(uint8_t empty_spaces);
static void lcd_int_AVR(int val, uint8_t width, enum alignment alignment);
static void lcd_hex_AVR(int val, uint8_t width, enum alignment alignment);
static void lcd_bin_AVR(int val, uint8_t width);
#else
static void fill_bin_value_buffer(int val, char *bin_val_buffer);
static void fill_zeros_buffer(char *buffer, uint8_t width, char *zeros_buf);
static void fill_zeros_buffer(const char *buffer, uint8_t width, char *zeros_buf);
#endif

static void register_LCD_IO_driver(void)
{
LCD = LCD_IO_driver_interface_get();
}

static void lcd_set_all_SIG(void)
{
static void lcd_set_all_SIG(void){
LCD->set_SIG(LCD_E);
LCD->set_SIG(LCD_RS);
#if USE_RW_PIN == ON
Expand Down Expand Up @@ -304,7 +294,7 @@ static void fill_bin_value_buffer(int val, char *bin_val_buffer)
bit_mask = bit_mask >> 1;
}
}
static void fill_zeros_buffer(char *buffer, uint8_t width, char *zeros_buf)
static void fill_zeros_buffer(const char *buffer, uint8_t width, char *zeros_buf)
{
if (strlen(buffer) < (width + VAL_PREFIX_LENGHT))
{
Expand Down
43 changes: 43 additions & 0 deletions test/lcd_hd44780/avr_code_test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
cmake_minimum_required(VERSION 3.10)

project(lcd_hd44780_test C)

add_subdirectory(../../unity unity)

set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")

set(INCLUDE_DIRS
../../../src
)

set(TEST_INCLUDE_DIRS
../..
../.
)

set(SRCS
../../../src/lcd_hd44780.c
)

set(TEST_SRCS
../lcd_hd44780_test_main.c
../lcd_hd44780_test_runner.c
../lcd_hd44780_test_init.c
../mock_LCD_IO_driver.c
../lcd_hd44780_test_basic_func.c
../lcd_hd44780_test_common.c
#mock_module.c
)

set(GLOBAL_DEFINES
-DAVR
)

include_directories(${INCLUDE_DIRS} ${TEST_INCLUDE_DIRS})
add_definitions(${GLOBAL_DEFINES})

link_libraries(unity)
add_executable(${PROJECT_NAME} ${SRCS} ${TEST_SRCS})

target_compile_options(${PROJECT_NAME} PRIVATE -fprofile-arcs -ftest-coverage)
target_link_options(${PROJECT_NAME} PRIVATE -fprofile-arcs)

0 comments on commit d64f88b

Please sign in to comment.