-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Pico RP2040 (non-mbed) support (#36)
* Add Pico RP2040 (non-mbed) support * uniforming license * author in license --------- Co-authored-by: Fabiano Riccardi <[email protected]>
- Loading branch information
1 parent
2b92b6e
commit dda54f7
Showing
13 changed files
with
159 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,9 +26,9 @@ jobs: | |
|
||
# define each specific configuration | ||
include: | ||
|
||
# if the current configuration contains the parameter "config-name" and it is equal to "esp8266-v2", | ||
# add the following parameters to this configuration. If board-type is never matched, | ||
# add the following parameters to this configuration. If board-type is never matched, | ||
# a new singular configuration is created | ||
- config-name: esp8266-v2 | ||
platform-url: https://arduino.esp8266.com/stable/package_esp8266com_index.json | ||
|
@@ -65,6 +65,12 @@ jobs: | |
arduino-boards-fqbn: arduino:samd:nano_33_iot | ||
sketches-exclude: 3_dimmable_light_5_light, 5_dimmable_manager_n_lights | ||
|
||
- config-name: rpi-pico | ||
platform-url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json | ||
arduino-platform: rp2040:[email protected] | ||
arduino-boards-fqbn: rp2040:rp2040:rpipico | ||
sketches-exclude: 3_dimmable_light_5_light, 5_dimmable_manager_n_lights | ||
|
||
# Do not cancel all jobs / architectures if one job fails | ||
fail-fast: false | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,7 @@ framework = arduino | |
platform = [email protected] | ||
board = uno | ||
framework = arduino | ||
lib_deps = | ||
lib_deps = | ||
${env.lib_deps} | ||
mike-matera/ArduinoSTL@^1.3.3 | ||
upload_speed = 115200 | ||
|
@@ -40,7 +40,7 @@ upload_speed = 115200 | |
platform = [email protected] | ||
board = megaatmega2560 | ||
framework = arduino | ||
lib_deps = | ||
lib_deps = | ||
${env.lib_deps} | ||
mike-matera/ArduinoSTL@^1.3.3 | ||
upload_speed = 115200 | ||
|
@@ -49,3 +49,9 @@ upload_speed = 115200 | |
platform = [email protected] | ||
board = nano_33_iot | ||
framework = arduino | ||
|
||
[env:rpipico] | ||
platform = https://github.com/maxgerhardt/platform-raspberrypi.git | ||
board = pico | ||
framework = arduino | ||
board_build.core = earlephilhower |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/****************************************************************************** | ||
* This file is part of Dimmable Light for Arduino, a library to control * | ||
* dimmers. * | ||
* * | ||
* Copyright (C) 2018-2023 Fabiano Riccardi * | ||
* * | ||
* Dimmable Light for Arduino is free software; you can redistribute * | ||
* it and/or modify it under the terms of the GNU Lesser General Public * | ||
* License as published by the Free Software Foundation; either * | ||
* version 2.1 of the License, or (at your option) any later version. * | ||
* * | ||
* This library is distributed in the hope that it will be useful, * | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of * | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * | ||
* Lesser General Public License for more details. * | ||
* * | ||
* You should have received a copy of the GNU Lesser General Public License * | ||
* along with this library; if not, see <http://www.gnu.org/licenses/>. * | ||
******************************************************************************/ | ||
|
||
#if defined(ARDUINO_ARCH_RP2040) && !defined(ARDUINO_ARCH_MBED) | ||
|
||
#include "hw_timer_pico.h" | ||
#include <Arduino.h> | ||
|
||
static void (*timer_callback)() = nullptr; | ||
static alarm_id_t alarm_id; | ||
static alarm_pool_t *alarm_pool; | ||
|
||
void timerBegin() { | ||
alarm_pool = alarm_pool_get_default(); | ||
} | ||
|
||
void timerSetCallback(void (*callback)()) { | ||
timer_callback = callback; | ||
} | ||
|
||
void timerStart(uint64_t t) { | ||
if (alarm_id) { | ||
cancel_alarm(alarm_id); | ||
alarm_id = 0; | ||
} | ||
|
||
alarm_id = alarm_pool_add_alarm_in_us( | ||
alarm_pool, t, | ||
[](alarm_id_t, void *) -> int64_t { | ||
if (timer_callback != nullptr) { timer_callback(); } | ||
alarm_id = 0; | ||
return 0; // Do not reschedule alarm | ||
}, | ||
NULL, true); | ||
} | ||
|
||
#endif // END ARDUINO_ARCH_RP2040 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/****************************************************************************** | ||
* This file is part of Dimmable Light for Arduino, a library to control * | ||
* dimmers. * | ||
* * | ||
* Copyright (C) 2023 Adam Hoese * | ||
* * | ||
* Dimmable Light for Arduino is free software; you can redistribute * | ||
* it and/or modify it under the terms of the GNU Lesser General Public * | ||
* License as published by the Free Software Foundation; either * | ||
* version 2.1 of the License, or (at your option) any later version. * | ||
* * | ||
* This library is distributed in the hope that it will be useful, * | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of * | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * | ||
* Lesser General Public License for more details. * | ||
* * | ||
* You should have received a copy of the GNU Lesser General Public License * | ||
* along with this library; if not, see <http://www.gnu.org/licenses/>. * | ||
******************************************************************************/ | ||
|
||
#if defined(ARDUINO_ARCH_RP2040) && !defined(ARDUINO_ARCH_MBED) | ||
|
||
#ifndef HW_TIMER_PICO_H | ||
#define HW_TIMER_PICO_H | ||
|
||
#include <stdint.h> | ||
|
||
/** | ||
* Initialize the timer. | ||
*/ | ||
void timerBegin(); | ||
|
||
/** | ||
* Set callback function on timer triggers | ||
*/ | ||
void timerSetCallback(void (*callback)()); | ||
|
||
/** | ||
* Start the timer to trigger after the specified number of microseconds. | ||
*/ | ||
void timerStart(uint64_t t); | ||
|
||
#endif // HW_TIMER_PICO_H | ||
|
||
#endif // ARDUINO_ARCH_RP2040 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters