Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Quality gates and release management #4

Merged
merged 38 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
0522279
ci: Initialize CI pipelines
XavierBrassoud Feb 16, 2024
6720edb
Add Arduino, C++ and PR title linters
XavierBrassoud Feb 16, 2024
3cd1eed
Test c++ linter
XavierBrassoud Feb 16, 2024
afa8edd
Remove matrix
XavierBrassoud Feb 16, 2024
828c962
Fix cpp lint style
XavierBrassoud Feb 16, 2024
4b44221
Define .clang-format style
XavierBrassoud Feb 17, 2024
542ff89
Clang format
XavierBrassoud Feb 17, 2024
24ca8df
Refactor: clang-tidy compliant
XavierBrassoud Mar 7, 2024
5918bb3
ci: cpp-linter adaptations
XavierBrassoud Mar 7, 2024
596a8ef
Provide action permissions
XavierBrassoud Mar 7, 2024
6acfe07
Move permissions
XavierBrassoud Mar 7, 2024
5eec3a6
test permissions #2
XavierBrassoud Mar 7, 2024
426eef2
Test permissions #3
XavierBrassoud Mar 7, 2024
d11ddb3
Test permissions #4
XavierBrassoud Mar 7, 2024
fad6b8d
Ignore extras from quality
XavierBrassoud Mar 7, 2024
e5b2141
Update clang-tidy version
XavierBrassoud Mar 7, 2024
f278625
Install Arduino CLI
XavierBrassoud Mar 7, 2024
d1240c6
Switch to PIO checks for consistency
XavierBrassoud Mar 7, 2024
256c769
Fix clang-tidy
XavierBrassoud Mar 7, 2024
18af6cb
Add clang-format
XavierBrassoud Mar 7, 2024
c0cfae0
Add voluntary format error
XavierBrassoud Mar 7, 2024
0592129
clang-format
XavierBrassoud Mar 7, 2024
fe32e8e
Fix release-please
XavierBrassoud Apr 30, 2024
9f1f3bb
Fix release-please missing files
XavierBrassoud May 2, 2024
0a1bc55
Remove testing branch from release
XavierBrassoud May 2, 2024
0e02bff
Fix duplicate launched action: Quality Gates
XavierBrassoud May 2, 2024
2630256
Enhance PIO build process
XavierBrassoud May 2, 2024
951ffd4
Fix cast issues
XavierBrassoud May 2, 2024
6c64204
Allow all architectures
XavierBrassoud May 2, 2024
e14c808
Update example section
XavierBrassoud May 2, 2024
cd57dab
Add arduino-lint
XavierBrassoud May 2, 2024
5ce17b5
Add CONTRIBUTING.md
XavierBrassoud May 2, 2024
8d92432
Publish to PlatformIO Library manager
XavierBrassoud May 2, 2024
9e5ef7d
Switch Arduino lint to submit
XavierBrassoud May 2, 2024
a03fe25
Rename scripts folder to pio-tools
XavierBrassoud May 2, 2024
93fa518
Set lib_deps per example
XavierBrassoud May 2, 2024
186feb9
Add sponsorship program
XavierBrassoud May 2, 2024
7e2c731
Shortened sentence in "using display" section
XavierBrassoud May 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
BasedOnStyle: Microsoft
32 changes: 32 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
Checks: "
-*,
clang-diagnostic-*,
clang-analyzer-*,
bugprone-*,
cert-*-c,
misc-*,
performance-*,
portability-*,
readability-*,
modernize-*,
-modernize-use-trailing-return-type
"
WarningsAsErrors: ''
AnalyzeTemporaryDtors: false
FormatStyle: file

CheckOptions:
- { key: readability-identifier-naming.NamespaceCase, value: lower_case }
- { key: readability-identifier-naming.ClassCase, value: CamelCase }
- { key: readability-identifier-naming.StructCase, value: CamelCase }
- { key: readability-identifier-naming.UnionCase, value: CamelCase }
- { key: readability-identifier-naming.TemplateParameterCase, value: CamelCase }
- { key: readability-identifier-naming.FunctionCase, value: camelBack }
- { key: readability-identifier-naming.VariableCase, value: camelBack }
- { key: readability-identifier-naming.PrivateMemberSuffix, value: _ }
- { key: readability-identifier-naming.ProtectedMemberSuffix, value: _ }
- { key: readability-identifier-naming.MacroDefinitionCase, value: UPPER_CASE }
- { key: readability-identifier-naming.ConstantCase, value: UPPER_CASE }
- { key: readability-identifier-naming.PointerParameterCase, value: CamelCase }
- { key: readability-identifier-naming.PointerParameterPrefix, value: p }
20 changes: 20 additions & 0 deletions .github/workflows/lint_git.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: "Lint PR"

on:
pull_request_target:
types:
- opened
- edited
- synchronize

permissions:
pull-requests: read

jobs:
lint-git:
name: Validate PR title
runs-on: ubuntu-22.04
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37 changes: 37 additions & 0 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
name: Quality Gates

on:
push:
pull_request:
workflow_dispatch: # Allows to trigger the workflow manually in GitHub UI

permissions:
contents: write
pull-requests: write

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Arduino CLI
uses: arduino/setup-arduino-cli@v1

# - name: arduino-lint
# uses: arduino/arduino-lint-action@v1
# with:
# library-manager: update
# compliance: strict

- uses: cpp-linter/cpp-linter-action@v2
with:
style: 'file' # Use .clang-format config file
tidy-checks: '' # Use .clang-tidy config file
tidy-review: true # Enable clang suggestions in PRs
files-changed-only: false
version: 19
ignore: extras
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23 changes: 23 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
on:
push:
branches:
- main
- ci/init

permissions:
contents: write
pull-requests: write

name: release-please

jobs:

release-please:
runs-on: ubuntu-22.04
steps:
# Add packages to update into release-please-config.json
- name: Write new version to packages
uses: google-github-actions/release-please-action@v4
with:
command: manifest
token: ${{ secrets.MAINTAINER_PAT }}
78 changes: 41 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Library to repurposing the control panel (PNL CE02) of EPSON XP 520/530/540 prin
- [Let's play!](#lets-play)
- [Using display](#using-display)
- [Library documentation](#library-documentation)
- [Epson\_PNL\_CE02\_Pinout Struct](#epson_pnl_ce02_pinout-struct)
- [Epson\_PNL\_CE02 Class](#epson_pnl_ce02-class)
- [Constructor](#constructor)
- [Functions](#functions)
Expand Down Expand Up @@ -81,20 +82,19 @@ Happy hacking!
``` c++
#include <Epson_PNL_CE02.h>

enum
{
Epson_PNL_CE02_Pinout pinout = {
/* Control panel to Arduino pinout */
EXTENDER_OE = 45, // FFC 1
SERIAL_OUT = 50, // SPI MISO / FFC 2
POWER_BUTTON = 46, // FFC 4
LCD_RESET = 47, // FFC 6
CLOCK = 52, // SPI SCK / FFC 9
SERIAL_IN = 51, // SPI MOSI / FFC 10
LATCH = 48, // FFC 11
LCD_WRITE = 49, // FFC 13
.EXTENDER_OE = 45, // FFC 1
.SERIAL_OUT = 50, // SPI MISO / FFC 2
.POWER_BUTTON = 46, // FFC 4
.LCD_RESET = 47, // FFC 6
.CLOCK = 52, // SPI SCK / FFC 9
.SERIAL_IN = 51, // SPI MOSI / FFC 10
.LATCH = 48, // FFC 11
.LCD_WRITE = 49, // FFC 13
};

Epson_PNL_CE02 controlPanel(EXTENDER_OE, SERIAL_OUT, POWER_BUTTON, LCD_RESET, CLOCK, SERIAL_IN, LATCH, LCD_WRITE);
Epson_PNL_CE02 controlPanel(&pinout);

void setup()
{
Expand All @@ -106,11 +106,11 @@ void loop()
{
switch (controlPanel.readButtons())
{
case OK:
case ButtonMask::OK:
Serial.println("Button OK pressed!");
break;
case OK | HOME:
Serial.println("Button OK and button LEFT pressed!");
case ButtonMask::OK | ButtonMask::HOME:
Serial.println("Button OK and button HOME pressed!");
break;
}

Expand Down Expand Up @@ -161,20 +161,19 @@ Here is an adaptation using [MCUFRIEND_kbv](https://github.com/prenticedavid/MCU
#include <Adafruit_GFX.h>
#include <MCUFRIEND_kbv.h>

enum
{
Epson_PNL_CE02_Pinout pinout = {
/* Control panel to Arduino pinout */
EXTENDER_OE = 45, // FFC 1
SERIAL_OUT = 50, // SPI MISO / FFC 2
POWER_BUTTON = 46, // FFC 4
LCD_RESET = 47, // FFC 6
CLOCK = 52, // SPI SCK / FFC 9
SERIAL_IN = 51, // SPI MOSI / FFC 10
LATCH = 48, // FFC 11
LCD_WRITE = 49, // FFC 13
.EXTENDER_OE = 45, // FFC 1
.SERIAL_OUT = 50, // SPI MISO / FFC 2
.POWER_BUTTON = 46, // FFC 4
.LCD_RESET = 47, // FFC 6
.CLOCK = 52, // SPI SCK / FFC 9
.SERIAL_IN = 51, // SPI MOSI / FFC 10
.LATCH = 48, // FFC 11
.LCD_WRITE = 49, // FFC 13
};

Epson_PNL_CE02 controlPanel(EXTENDER_OE, SERIAL_OUT, POWER_BUTTON, LCD_RESET, CLOCK, SERIAL_IN, LATCH, LCD_WRITE);
Epson_PNL_CE02 controlPanel(&pinout);

MCUFRIEND_kbv tft;

Expand All @@ -183,10 +182,10 @@ void setup()
controlPanel.begin();

// STEP 1: Turn display ON
controlPanel.extenderWrite(LCD_BACKLIGHT, HIGH);
controlPanel.extenderWrite(ExtenderPin::LCD_BACKLIGHT, HIGH);

// STEP 2: INIT display
tft.begin(0x9163); // ILI9163C
tft.begin(0x9163); // Force ILI9163C as the control panel wired the display in write-only mode

// STEP 3: Use display
tft.fillScreen(TFT_RED);
Expand All @@ -204,21 +203,26 @@ void loop()

## Library documentation

### Epson_PNL_CE02_Pinout Struct

| Member | Pin | Description |
| ---------------- | --- | ---------------------------------------------------------------------- |
| `EXTENDER_OE` | #1 | Extender output enable pin. Unused. |
| `SERIAL_OUT` | #2 | Serial output pin. Read value for buttons. (SPI MISO) |
| `POWER_BUTTON` | #4 | Dedicated pin for the power button. |
| `LCD_RESET` | #6 | Display reset pin. Refer to ["Using display"](#using-display) section. |
| `CLOCK` | #9 | Shared clock pin for extender, buttons and display. (SPI SCK) |
| `SERIAL_IN` | #10 | Serial input pin. Write value in extender. (SPI MOSI) |
| `LATCH` | #11 | Write extender selector. |
| `LCD_WRITE` | #13 | Display write pin. Refer to ["Using display"](#using-display) section. |

### Epson_PNL_CE02 Class

#### Constructor

| Parameter | Description |
| ---------------- | ------------------------------------------------------------- |
| `oePin` | Extender output enable pin. Unused. |
| `serOutPin` | Serial output pin. Read value for buttons. (SPI MISO) |
| `powerButtonPin` | Dedicated pin for the power button. |
| `lcdResetPin` | Display reset pin. |
| `clockPin` | Shared clock pin for extender, buttons and display. (SPI SCK) |
| `serInPin` | Serial input pin. Write value in extender. (SPI MOSI) |
| `latchPin` | Write extender selector. |
| `lcdWritePin` | Display write pin. |
| Parameter | Description |
| ---------------- | ---------------------------------------------------------------------- |
| `pPinout` | Reference to [`Epson_PNL_CE02_Pinout`](#epson_pnl_ce02_pinout-struct). |

#### Functions

Expand Down
2 changes: 1 addition & 1 deletion REVERSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ We can identify 3 components, from left to right:

## Identifying display

This was the hard part of this project. The only reference was GIANTPLUS printed on the flex ribbon cable of the screen. After hours of searching, I can't identify this screen.
This was the hard part of this project. The only reference was "307328101 GIANTPLUS 1526" printed on the flex ribbon cable of the screen. After hours of searching, I can't identify this screen.

The deducted information was:
* the 8-bit parallel interface wired through the VHC164
Expand Down
Binary file modified docs/pcb_layers.xcf
Binary file not shown.
28 changes: 13 additions & 15 deletions examples/blink/blink.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* @author Xavier BRASSOUD ([email protected])
* @brief Blinks the power LED using the Epson_PNL_CE02 library.
* @version 1.0
* @date 2023-12-27
*
* @copyright MIT license
*
Expand All @@ -23,27 +22,26 @@
* | 12 | GND | - |
* | 13 | LCD write (+3.3V !) | 49 ⚡ |
* | 14 | GND | - |
*
*
* ⚡ Require a 3.3v level-shifter, screen makes shadows and may be destroyed after long use.
* 🔺 Require a 10k pull-up resistor wired between 3.3V and Arduino pin
*/

#include <Epson_PNL_CE02.h>

enum
{
Epson_PNL_CE02_Pinout pinout = {
/* Control panel to Arduino pinout */
EXTENDER_OE = 45, // FFC 1
SERIAL_OUT = 50, // SPI MISO / FFC 2
POWER_BUTTON = 46, // FFC 4
LCD_RESET = 47, // FFC 6
CLOCK = 52, // SPI SCK / FFC 9
SERIAL_IN = 51, // SPI MOSI / FFC 10
LATCH = 48, // FFC 11
LCD_WRITE = 49, // FFC 13
.EXTENDER_OE = 45, // FFC 1
.SERIAL_OUT = 50, // SPI MISO / FFC 2
.POWER_BUTTON = 46, // FFC 4
.LCD_RESET = 47, // FFC 6
.CLOCK = 52, // SPI SCK / FFC 9
.SERIAL_IN = 51, // SPI MOSI / FFC 10
.LATCH = 48, // FFC 11
.LCD_WRITE = 49, // FFC 13
};

Epson_PNL_CE02 controlPanel(EXTENDER_OE, SERIAL_OUT, POWER_BUTTON, LCD_RESET, CLOCK, SERIAL_IN, LATCH, LCD_WRITE);
Epson_PNL_CE02 controlPanel(&pinout);

void setup()
{
Expand All @@ -53,12 +51,12 @@ void setup()
void loop()
{
// turns ON power LED (active LOW)
controlPanel.extenderWrite(POWER_LED, LOW);
controlPanel.extenderWrite(ExtenderPin::POWER_LED, LOW);

delay(1000);

// turns OFF power LED
controlPanel.extenderWrite(POWER_LED, HIGH);
controlPanel.extenderWrite(ExtenderPin::POWER_LED, HIGH);

delay(1000);
}
32 changes: 15 additions & 17 deletions examples/buttons/buttons.ino
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
* @brief A basic buttons playground using Epson_PNL_CE02 library.
* Get an advanced usage of buttons in the OneButton sketch.
* @version 1.0
* @date 2023-12-22
*
* @copyright MIT license
*
Expand All @@ -24,33 +23,32 @@
* | 12 | GND | - |
* | 13 | LCD write (+3.3V !) | 49 ⚡ |
* | 14 | GND | - |
*
*
* ⚡ Require a 3.3v level-shifter, screen makes shadows and may be destroyed after long use.
* 🔺 Require a 10k pull-up resistor wired between 3.3V and Arduino pin
*/

#if defined(ARDUINO_ARCH_AVR)
#define BAUD_RATE 115200
#define BAUD_RATE 115200
#else
#define BAUD_RATE 9600
#define BAUD_RATE 9600
#endif

#include <Epson_PNL_CE02.h>

enum
{
Epson_PNL_CE02_Pinout pinout = {
/* Control panel to Arduino pinout */
EXTENDER_OE = 45, // FFC 1
SERIAL_OUT = 50, // SPI MISO / FFC 2
POWER_BUTTON = 46, // FFC 4
LCD_RESET = 47, // FFC 6
CLOCK = 52, // SPI SCK / FFC 9
SERIAL_IN = 51, // SPI MOSI / FFC 10
LATCH = 48, // FFC 11
LCD_WRITE = 49, // FFC 13
.EXTENDER_OE = 45, // FFC 1
.SERIAL_OUT = 50, // SPI MISO / FFC 2
.POWER_BUTTON = 46, // FFC 4
.LCD_RESET = 47, // FFC 6
.CLOCK = 52, // SPI SCK / FFC 9
.SERIAL_IN = 51, // SPI MOSI / FFC 10
.LATCH = 48, // FFC 11
.LCD_WRITE = 49, // FFC 13
};

Epson_PNL_CE02 controlPanel(EXTENDER_OE, SERIAL_OUT, POWER_BUTTON, LCD_RESET, CLOCK, SERIAL_IN, LATCH, LCD_WRITE);
Epson_PNL_CE02 controlPanel(&pinout);

void setup()
{
Expand All @@ -62,10 +60,10 @@ void loop()
{
switch (controlPanel.readButtons())
{
case OK:
case ButtonMask::OK:
Serial.println("Button OK pressed!");
break;
case OK | HOME:
case ButtonMask::OK | ButtonMask::HOME:
Serial.println("Button OK and button HOME pressed!");
break;
}
Expand Down
Loading
Loading