Compare commits

...

5 commits

3 changed files with 22 additions and 3 deletions

View file

@ -12,11 +12,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v1
- uses: actions/setup-python@v5
with:
python-version: '3.8'
- uses: actions/checkout@v2
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: adafruit/ci-arduino
path: ci

View file

@ -71,8 +71,14 @@ IRAM_ATTR static void _PM_esp32timerCallback(void) {
// Set timer period, initialize count value to zero, enable timer.
IRAM_ATTR inline void _PM_timerStart(Protomatter_core *core, uint32_t period) {
hw_timer_t *timer = (hw_timer_t *)core->timer;
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0)
timerAlarmWrite(timer, period, true);
timerAlarmEnable(timer);
#else
timerAlarm(timer, period, true, 0);
// TODO equivalent of timerAlarmEnable (is it enabled by
// gptimer_set_alarm_action? called in timerAlarm?)
#endif
timerStart(timer);
}
@ -89,9 +95,21 @@ IRAM_ATTR uint32_t _PM_timerStop(Protomatter_core *core) {
void _PM_esp32commonTimerInit(Protomatter_core *core) {
hw_timer_t *timer = (hw_timer_t *)core->timer; // pointer-to-pointer
if (timer == _PM_TIMER_DEFAULT) {
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0)
core->timer = timerBegin(_PM_timerNum, 2, true); // 1:2 prescale, count up
#else
core->timer =
timerBegin(40000000); // 40MHz // TODO: old code used divisor of 2
#endif
}
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0)
timerAttachInterrupt(timer, &_PM_esp32timerCallback, true);
#else
timerAttachInterrupt(
timer, &_PM_esp32timerCallback); // TODO only level interrupt supported
// (same in 2.0.x, true is accepted buy
// prints a warning nobody sees)
#endif
}
#elif defined(CIRCUITPY) // COMPILING FOR CIRCUITPYTHON --------------------

View file

@ -90,6 +90,7 @@ IRAM_ATTR inline uint32_t _PM_timerGetCount(Protomatter_core *core) {
#else
#include <driver/periph_ctrl.h>
#endif
#include <driver/gpio.h>
#include <esp_private/gdma.h>
#include <esp_rom_gpio.h>
#include <hal/dma_types.h>