Skip to content

Commit 2dc5c99

Browse files
Merge pull request #9 from suikan4github/develop
Merge develop branch as v1.0.0
2 parents e94060e + fd51000 commit 2dc5c99

13 files changed

Lines changed: 90 additions & 65 deletions

.github/workflows/ctest.yaml

Lines changed: 26 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This is a basic workflow to help you get started with Actions
22

3-
name: CTest_on_push_and_pull_request
3+
name: Build and Test
44

55
# Controls when the workflow will run
66
on:
@@ -39,51 +39,38 @@ jobs:
3939
submodules: true
4040

4141
# Configuration for GCC
42-
- name: Configuration for gcc
42+
- name: Configuration and build for gcc
4343
if: matrix.compiler == 'gcc'
44-
run: |
45-
echo Runs-on ${{matrix.os}}, Build with ${{matrix.compiler}}
46-
mkdir build
47-
cd build
48-
cmake .. -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc
44+
uses: threeal/cmake-action@v2.0.0
45+
with:
46+
c-compiler: gcc
47+
cxx-compiler: g++
48+
build-args: --config ${{ matrix.build }}
4949

5050
# Configuration for Clang
51-
- name: Configuration for clang
51+
- name: Configuration for and build clang
5252
if: matrix.compiler == 'clang'
53-
run: |
54-
echo Runs-on ${{matrix.os}}, Build with ${{matrix.compiler}}
55-
mkdir build
56-
cd build
57-
cmake .. -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang
53+
uses: threeal/cmake-action@v2.0.0
54+
with:
55+
c-compiler: clang
56+
cxx-compiler: clang++
57+
build-args: --config ${{ matrix.build }}
5858

5959
# Configuration for MSVC
60-
- name: Configuration for msvc
60+
- name: Configuration for and build msvc
6161
if: matrix.compiler == 'msvc'
62-
run: |
63-
echo "Runs-on ${{matrix.os}}, Build with ${{matrix.compiler}}"
64-
mkdir build
65-
cd build
66-
cmake .. -DCMAKE_CXX_COMPILER=cl -DCMAKE_C_COMPILER=cl
67-
68-
# Build for Linux
69-
- name: Build for Linux
70-
if: matrix.os == 'ubuntu-latest'
71-
run: |
72-
echo Runs-on ${{matrix.os}}, ${{matrix.build}} build
73-
cd build
74-
cmake --build . --target all --config ${{ matrix.build }} --clean-first -j4
75-
76-
# Build for Windows
77-
- name: Build for Windows
78-
if: matrix.os == 'windows-latest'
79-
run: |
80-
echo "Runs-on ${{matrix.os}}, ${{matrix.build}} build"
81-
cd build
82-
cmake --build . --target all_build --config ${{ matrix.build }} --clean-first -j4
62+
uses: threeal/cmake-action@v2.0.0
63+
with:
64+
c-compiler: cl
65+
cxx-compiler: cl
66+
build-args: --config ${{ matrix.build }}
8367

8468
- name: Test
85-
run: |
86-
cd build
87-
ctest --rerun-failed --output-on-failure -j 4
88-
69+
uses: threeal/ctest-action@v1.1.0
8970

71+
- name: Check Test Coverage
72+
if: ${{matrix.compiler == 'gcc' && matrix.build == 'Debug'}}
73+
uses: threeal/gcovr-action@v1.1.0
74+
with:
75+
coveralls-send: true
76+
excludes: build/* test/*

CHANGELOG.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,33 @@ History of the project development
1010
### Security
1111
### Known Issue
1212

13+
## [v1.0.0] 2024-10-03
14+
### Release note.
15+
First official release of the rpp_driver ( Raspberry Pi Pico Driver) class library. This release contains :
16+
- a limited SDK Wrapper class for the basic operation.
17+
- a basic GPIO class.
18+
- a basic I2C master class.
19+
- a duplex slave I2S class.
20+
- an ADAU1361 audio codec class.
21+
22+
### Added
23+
### Changed
24+
- [Issue #4](https://github.com/suikan4github/rpp_driver/issues/4) Add gcov support for x86 build.
25+
- [Issue #5](https://github.com/suikan4github/rpp_driver/issues/5) Migrate action from hand-made to marketplace.
26+
- [Issue #6](https://github.com/suikan4github/rpp_driver/issues/6) Add comment string to the assertion.
27+
- [Issue #7](https://github.com/suikan4github/rpp_driver/issues/7) Remove default clause of adau1361.cpp and use -Wswitch-enum to detect the coverage error.
28+
- [Issue #8](https://github.com/suikan4github/rpp_driver/issues/8) Remove duplicated assertions in the adau1361lower.cpp.
29+
30+
### Deprecated
31+
### Removed
32+
### Fixed
33+
- [Issue #3](https://github.com/suikan4github/rpp_driver/issues/3) Doxygen warning message.
34+
### Security
35+
### Known Issue
36+
1337
## [v0.9.0] 2024-09-28
1438
Pre-release version.
1539

16-
[Unreleased]: https://github.com/suikan4github/rpp_driver/compare/v0.9.0...develop
40+
[Unreleased]: https://github.com/suikan4github/rpp_driver/compare/v1.0.0...develop
41+
[v1.0.0]: https://github.com/suikan4github/rpp_driver/compare/v0.9.0...v1.0.0
1742
[v0.9.0]: https://github.com/suikan4github/rpp_driver/compare/v0.0.0...v0.9.0

Doxyfile

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -983,12 +983,7 @@ INPUT_FILE_ENCODING =
983983
# provided as doxygen C comment), *.py, *.pyw, *.f90, *.f95, *.f03, *.f08,
984984
# *.f18, *.f, *.for, *.vhd, *.vhdl, *.ucf, *.qsf and *.ice.
985985

986-
FILE_PATTERNS = *.c \
987-
*.cc \
988-
*.cxx \
989-
*.cpp \
990-
*.c++ \
991-
*.java \
986+
FILE_PATTERNS = *.java \
992987
*.ii \
993988
*.ixx \
994989
*.ipp \

src/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ cmake_minimum_required(VERSION 3.13)
55

66
add_library(rpp_driver INTERFACE)
77

8+
# Win/Unix specific option.
9+
if((${WIN32}) OR (${UNIX}))
10+
target_compile_options(rpp_driver
11+
INTERFACE
12+
--coverage
13+
)
14+
endif()
15+
816
add_subdirectory(codec)
917
add_subdirectory(i2c)
1018
add_subdirectory(gpio)

src/codec/adau1361.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
* Author: Seiichi "Suikan" Horie
66
*/
77

8+
// GCC/Clang : Promote the switch-enum warning to error.
9+
// MSVC : ignored.
10+
#pragma GCC diagnostic error "-Wswitch-enum"
11+
812
#include "adau1361.hpp"
913

1014
#include <assert.h>
@@ -94,9 +98,6 @@ void ::rpp_driver::Adau1361::SetGain(CodecChannel channel, float left_gain,
9498
adau1361_lower_.SetHpOutputGain(hp_output_left_gain_,
9599
hp_output_right_gain_, hp_output_mute_);
96100
break;
97-
default:
98-
assert(false);
99-
break;
100101
}
101102
CODEC_SYSLOG("Leave.")
102103
}
@@ -130,9 +131,6 @@ void ::rpp_driver::Adau1361::Mute(CodecChannel channel, bool mute) {
130131
adau1361_lower_.SetHpOutputGain(hp_output_left_gain_,
131132
hp_output_right_gain_, hp_output_mute_);
132133
break;
133-
default:
134-
assert(false);
135-
break;
136134
}
137135
CODEC_SYSLOG("Leave.")
138136
}

src/codec/adau1361lower.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,6 @@ void ::rpp_driver::Adau1361Lower::WaitPllLock(void) {
8686
// Configure PLL and start. Then, initiate the core and set the CODEC Fs.
8787
void ::rpp_driver::Adau1361Lower::ConfigurePll(unsigned int fs,
8888
unsigned int master_clock) {
89-
assert((fs == 24000 || fs == 32000 || fs == 48000 || fs == 96000 ||
90-
fs == 22050 || fs == 44100 || fs == 88200) &&
91-
"Bad Fs");
92-
9389
if (fs == 24000 || fs == 32000 || fs == 48000 || fs == 96000) {
9490
// Configure the PLL. Target PLL out is 49.152MHz = 1024xfs
9591
// Regarding X, R, M, N, check ADAU1361 Datasheet register R1.
@@ -446,7 +442,7 @@ void ::rpp_driver::Adau1361Lower::ConfigurePll(unsigned int fs,
446442
}
447443

448444
} else { // Fs must be checked at the top of this routine.
449-
assert(false && "Wrong parameter validation");
445+
assert(false && "Wrong Fs");
450446
}
451447

452448
} // ConfigurePlll

src/codec/adau1361lower.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,9 @@ class Adau1361Lower {
223223
virtual void SetHpOutputGain(float left_gain, float right_gain, bool mute);
224224

225225
protected:
226+
/// @brief Internal variable to hold the I2C controller variable.
226227
::rpp_driver::I2cMasterInterface& i2c_;
228+
/// @brief Internal variable to hold the I2C device address.
227229
const unsigned int device_addr_;
228230
};
229231

src/gpio/gpiobasic.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,16 @@ class GpioBasic {
3434
public:
3535
/**
3636
* @brief Initialize the given GPIO pin and setup the pins.
37+
* @param sdk Sdk wrapper to inject the dependency.
3738
* @param pin GPIO pin number.
3839
* @details
3940
* Receive the GPIO pin.
40-
* And then, init it by ::rpp_driver::gpio_init().
41+
* And then, init it by SdkWrapper::gpio_init().
4142
*/
4243
GpioBasic(SdkWrapper &sdk, uint pin);
4344
GpioBasic() = delete;
4445
/**
45-
* @brief deinit the GPIO by ::rpp_driver::gpio_deinit();
46+
* @brief deinit the GPIO by SdkWrapper::gpio_deinit();
4647
*/
4748
virtual ~GpioBasic();
4849
/**

src/i2c/i2cmaster.hpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@
1616
#if __has_include(<hardware/i2c.h>)
1717
#include "hardware/i2c.h"
1818
#else
19-
// Alternate definition for unit test.
19+
/// Alternate definition for unit test.
2020
typedef int i2c_inst_t;
21+
/// Alternate definition of the return value on error for Google Test build.
2122
#define PICO_ERROR_GENERIC -1
23+
/// Alternate definition of the return value on error for I2C function number
24+
/// for GPIO.
2225
#define GPIO_FUNC_I2C 11
2326
#endif // __has_include(<hardware/i2c.h>)
2427

@@ -51,14 +54,14 @@ class I2cMaster : public I2cMasterInterface {
5154
* @param sda_pin GPIO pin #
5255
* @details
5356
* Receive the uninitialized I2C hardware by parameter i2c, and initialize
54-
* it by ::rpp_driver::i2c_init().
57+
* it by SdkWrapper::i2c_init().
5558
* And then, set given pins to I2C function, and pull them up.
5659
*/
5760
I2cMaster(SdkWrapper &sdk, i2c_inst_t &i2c, uint clock_freq, uint scl_pin,
5861
uint sda_pin);
5962
I2cMaster() = delete;
6063
/**
61-
* @brief deinit the I2C by ::rpp_driver::i2c_deinit();
64+
* @brief deinit the I2C by SdkWrapper::i2c_deinit();
6265
*/
6366
virtual ~I2cMaster();
6467
/**

src/i2c/i2cmasterinterface.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <stdlib.h>
1717

1818
#if !__has_include(<hardware/i2c.h>)
19+
/// @brief Alternate definition of the uint for Google Test build.
1920
typedef unsigned uint;
2021
#endif
2122

0 commit comments

Comments
 (0)