Skip to content

Commit

Permalink
Merge pull request #5 from 107-systems/renesas
Browse files Browse the repository at this point in the history
Add support for ArduinoCore-renesas
  • Loading branch information
aentinger authored Aug 9, 2023
2 parents dbe3ec6 + 9277347 commit 8e0cc9b
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .github/workflows/compile-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ jobs:
platforms: |
- name: adafruit:samd
source-url: https://adafruit.github.io/arduino-board-index/package_adafruit_index.json
- fqbn: arduino:renesas_portenta:portenta_c33
platforms: |
- name: arduino:renesas_portenta
- fqbn: arduino:renesas_uno:minima
platforms: |
- name: arduino:renesas_uno
steps:
- name: Checkout
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ This library works for
* [arduino-esp32](https://github.com/espressif/arduino-esp32): `ESP32 Dev Module`, `ESP32 Wrover Module`, ... :heavy_check_mark:
* [arduino-pico](https://github.com/earlephilhower/arduino-pico): [`Raspberry Pi Pico`](https://www.raspberrypi.org/products/raspberry-pi-pico), `Adafruit Feather RP2040`, ... :heavy_check_mark:
* [adafruit/ArduinoCore-samd](https://github.com/adafruit/ArduinoCore-samd): [`Adafruit Feather M4 CAN Express`](https://www.adafruit.com/product/4759), ... :heavy_check_mark:
* [ArduinoCore-renesas](https://github.com/arduino/ArduinoCore-renesas): [`Portenta C33`](https://store.arduino.cc/products/portenta-c33), [`Uno R4 WiFi`](https://store.arduino.cc/products/uno-r4-wifi), [`Uno R4 Minima`](https://store.arduino.cc/products/uno-r4-minima), ... :heavy_check_mark:

### Example
```C++
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ sentence=Arduino library for providing a consistent critical section interface o
paragraph=
category=Other
url=https://github.com/107-systems/107-Arduino-CriticalSection
architectures=samd,mbed,mbed_nano,mbed_portenta,mbed_edge,esp32,rp2040
architectures=samd,mbed,mbed_nano,mbed_portenta,mbed_edge,esp32,rp2040,renesas_portenta,renesas_uno
includes=107-Arduino-CriticalSection.h
39 changes: 39 additions & 0 deletions src/CritSec-renesas.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* This software is distributed under the terms of the MIT License.
* Copyright (c) 2023 LXRobotics.
* Author: Alexander Entinger <alexander.entinger@lxrobotics.com>
* Contributors: https://github.com/107-systems/107-Arduino-CriticalSection/graphs/contributors.
*/

/**************************************************************************************
* INCLUDE
**************************************************************************************/

#include "CritSec.h"

#if defined(ARDUINO_MINIMA) || defined(ARDUINO_UNOWIFIR4) || defined(ARDUINO_PORTENTA_C33)

#include <Arduino.h>

/**************************************************************************************
* GLOBAL VARIABLES
**************************************************************************************/

static volatile uint32_t interrupt_save = 0;

/**************************************************************************************
* FUNCTION DEFINITION
**************************************************************************************/

extern "C" void crit_sec_enter()
{
interrupt_save = __get_PRIMASK();
__disable_irq();
}

extern "C" void crit_sec_leave()
{
__set_PRIMASK(interrupt_save);
}

#endif /* defined(ARDUINO_MINIMA) || defined(ARDUINO_UNOWIFIR4) || defined(ARDUINO_PORTENTA_C33) */

0 comments on commit 8e0cc9b

Please sign in to comment.