Skip to content

Commit

Permalink
Fix pgm_read_byte/word() definitions (#871)
Browse files Browse the repository at this point in the history
* make other pgm_read_* macros complaint with unified API

Corresponding to #864, this completes compliance with the unified ArduinoCore-API about 

- `pgm_read_word()`
- `pgm_read_byte()`

see https://github.com/arduino/ArduinoCore-API/blob/e26862e453c1234e1c23506d1839bfa68999d911/api/deprecated-avr-comp/avr/pgmspace.h#L102-L103

* add some boards to the Arduino & PIO CI

* run clang-format on changed files


fix param name

* install arduino-pico core in arduino CI

install cpp-linter from PyPI

keep installing AVR, megaAVR, MBED, SAM, & SAMD platforms in addition to arduino-pico
  • Loading branch information
2bndy5 authored Sep 18, 2022
1 parent 8ad2886 commit fa6a075
Show file tree
Hide file tree
Showing 13 changed files with 37 additions and 22 deletions.
15 changes: 14 additions & 1 deletion .github/workflows/build_arduino.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
# with:
# version: 12
- name: Install linter python package
run: python3 -m pip install git+https://github.com/cpp-linter/cpp-linter-action@v1
run: python3 -m pip install cpp-linter
- name: run linter as a python package
id: linter
run: |
Expand Down Expand Up @@ -78,6 +78,10 @@ jobs:
- "arduino:avr:one"
- "arduino:avr:unowifi"
- "arduino:mbed:nano33ble"
- "arduino:mbed:nanorp2040connect"
- "rp2040:rp2040:rpipico"
- "rp2040:rp2040:rpipicow"
- "rp2040:rp2040:adafruit_feather"
- "arduino:samd:mkr1000" # InterruptConfigure.ino uses pin 2
- "arduino:samd:mkrwifi1010" # InterruptConfigure.ino uses pin 2
- "arduino:samd:nano_33_iot"
Expand Down Expand Up @@ -134,6 +138,15 @@ jobs:
fqbn: ${{ matrix.fqbn }}
enable-deltas-report: ${{ matrix.enable-deltas-report }}
sketches-report-path: ${{ env.SKETCHES_REPORTS }}
# install earlphilhower's arduino-pico platform index
platforms: |
- name: rp2040:rp2040
source-url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
- name: arduino:avr
- name: arduino:megaavr
- name: arduino:sam
- name: arduino:samd
- name: arduino:mbed
# This step is needed to pass the size data to the report job
- name: Upload sketches report to workflow artifact
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
# with:
# version: 12
- name: Install linter python package
run: python3 -m pip install git+https://github.com/cpp-linter/cpp-linter-action@v1
run: python3 -m pip install cpp-linter
- name: run linter as a python package
id: linter
run: |
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/build_platformIO.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
# with:
# version: 12
- name: Install linter python package
run: python3 -m pip install git+https://github.com/cpp-linter/cpp-linter-action@v1
run: python3 -m pip install cpp-linter
- name: run linter as a python package
id: linter
run: |
Expand Down Expand Up @@ -112,6 +112,8 @@ jobs:
- "teensy40"
- "teensy41"
- "teensylc"
- "genericSTM32F411CE"
- "blackpill_f103c8"

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion RF24_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ typedef uint16_t prog_uint16_t;
#define PROGMEM
#endif
#ifndef pgm_read_word
#define pgm_read_word(p) (*(p))
#define pgm_read_word(p) (*(const unsigned short*)(p))
#endif
#if !defined pgm_read_ptr || defined ARDUINO_ARCH_MBED
#define pgm_read_ptr(p) (*(void* const*)(p))
Expand Down
4 changes: 2 additions & 2 deletions utility/ATXMegaD3/RF24_arch_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ typedef uint16_t prog_uint16_t;
//#define printf_P printf
//#define strlen_P strlen
//#define PROGMEM
//#define pgm_read_word(p) (*(p))
//#define pgm_read_word(p) (*(const unsigned short *)(p))
#define PRIPSTR "%s"
//#define pgm_read_byte(p) (*(p))
//#define pgm_read_byte(p) (*(const unsigned char *)(p))

// Function, constant map as a result of migrating from Arduino
#define LOW GPIO::OUTPUT_LOW
Expand Down
4 changes: 2 additions & 2 deletions utility/LittleWire/RF24_arch_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ extern LittleWireSPI _SPI;

// GCC a Arduino Missing
#define _BV(x) (1 << (x))
#define pgm_read_word(p) (*(p))
#define pgm_read_byte(p) (*(p))
#define pgm_read_word(p) (*(const unsigned short*)(p))
#define pgm_read_byte(p) (*(const unsigned char*)(p))
#define pgm_read_ptr(p) (*(void* const*)(p))

//typedef uint16_t prog_uint16_t;
Expand Down
4 changes: 2 additions & 2 deletions utility/MRAA/RF24_arch_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
#define HIGH 1
#define LOW 0
#define _BV(x) (1 << (x))
#define pgm_read_word(p) (*(p))
#define pgm_read_byte(p) (*(p))
#define pgm_read_word(p) (*(const unsigned short*)(p))
#define pgm_read_byte(p) (*(const unsigned char*)(p))
#define pgm_read_ptr(p) (*(void* const*)(p))
#define _SPI spi

Expand Down
4 changes: 2 additions & 2 deletions utility/RPi/RF24_arch_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@

// GCC a Arduino Missing
#define _BV(x) (1 << (x))
#define pgm_read_word(p) (*(p))
#define pgm_read_byte(p) (*(p))
#define pgm_read_word(p) (*(const unsigned short*)(p))
#define pgm_read_byte(p) (*(const unsigned char*)(p))
#define pgm_read_ptr(p) (*(void* const*)(p))

//typedef uint16_t prog_uint16_t;
Expand Down
4 changes: 2 additions & 2 deletions utility/SPIDEV/RF24_arch_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ typedef uint16_t prog_uint16_t;
#define printf_P printf
#define strlen_P strlen
#define PROGMEM
#define pgm_read_word(p) (*(p))
#define pgm_read_word(p) (*(const unsigned short*)(p))
#define PRIPSTR "%s"
#define pgm_read_byte(p) (*(p))
#define pgm_read_byte(p) (*(const unsigned char*)(p))
#define pgm_read_ptr(p) (*(void* const*)(p))

// Function, constant map as a result of migrating from Arduino
Expand Down
4 changes: 2 additions & 2 deletions utility/Template/RF24_arch_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ typedef uint16_t prog_uint16_t;
#define printf_P printf
#define strlen_P strlen
#define PROGMEM
#define pgm_read_word(p) (*(p))
#define pgm_read_word(p) (*(const unsigned short*)(p))
#define PRIPSTR "%s"
#define pgm_read_byte(p) (*(p))
#define pgm_read_byte(p) (*(const unsigned char*)(p))

// Function, constant map as a result of migrating from Arduino
#define LOW GPIO::OUTPUT_LOW
Expand Down
4 changes: 2 additions & 2 deletions utility/pigpio/RF24_arch_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ typedef uint16_t prog_uint16_t;
#define printf_P printf
#define strlen_P strlen
#define PROGMEM
#define pgm_read_word(p) (*(p))
#define pgm_read_word(p) (*(const unsigned short*)(p))
#define PRIPSTR "%s"
#define pgm_read_byte(p) (*(p))
#define pgm_read_byte(p) (*(const unsigned char*)(p))
#define pgm_read_ptr(p) (*(void* const*)(p))

// Function, constant map as a result of migrating from Arduino
Expand Down
4 changes: 2 additions & 2 deletions utility/rp2/RF24_arch_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ typedef uint16_t prog_uint16_t;
#define printf_P printf
#define strlen_P strlen
#define PROGMEM
#define pgm_read_word(p) (*(p))
#define pgm_read_word(p) (*(const unsigned short*)(p))
#define PRIPSTR "%s"
#define pgm_read_byte(p) (*(p))
#define pgm_read_byte(p) (*(const unsigned char*)(p))

#define pgm_read_ptr(p) (*(void* const*)(p))

Expand Down
4 changes: 2 additions & 2 deletions utility/wiringPi/RF24_arch_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ typedef uint16_t prog_uint16_t;
#define printf_P printf
#define strlen_P strlen
#define PROGMEM
#define pgm_read_word(p) (*(p))
#define pgm_read_word(p) (*(const unsigned short*)(p))
#define PRIPSTR "%s"
#define pgm_read_byte(p) (*(p))
#define pgm_read_byte(p) (*(const unsigned char*)(p))
#define pgm_read_ptr(p) (*(void* const*)(p))

#endif // RF24_UTILITY_WIRINGPI_RF24_ARCH_CONFIG_H_

0 comments on commit fa6a075

Please sign in to comment.