Compare commits
5 commits
c9c1189e9d
...
510c733482
| Author | SHA1 | Date | |
|---|---|---|---|
| 510c733482 | |||
| 1b6f7d2f23 | |||
| f023b14f61 | |||
| f0f1f50ca5 | |||
| 5fefdd428c |
3 changed files with 22 additions and 3 deletions
6
.github/workflows/githubci.yml
vendored
6
.github/workflows/githubci.yml
vendored
|
|
@ -12,11 +12,11 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/setup-python@v1
|
- uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: '3.8'
|
python-version: '3.8'
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
repository: adafruit/ci-arduino
|
repository: adafruit/ci-arduino
|
||||||
path: ci
|
path: ci
|
||||||
|
|
|
||||||
|
|
@ -71,8 +71,14 @@ IRAM_ATTR static void _PM_esp32timerCallback(void) {
|
||||||
// Set timer period, initialize count value to zero, enable timer.
|
// Set timer period, initialize count value to zero, enable timer.
|
||||||
IRAM_ATTR inline void _PM_timerStart(Protomatter_core *core, uint32_t period) {
|
IRAM_ATTR inline void _PM_timerStart(Protomatter_core *core, uint32_t period) {
|
||||||
hw_timer_t *timer = (hw_timer_t *)core->timer;
|
hw_timer_t *timer = (hw_timer_t *)core->timer;
|
||||||
|
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0)
|
||||||
timerAlarmWrite(timer, period, true);
|
timerAlarmWrite(timer, period, true);
|
||||||
timerAlarmEnable(timer);
|
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);
|
timerStart(timer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -89,9 +95,21 @@ IRAM_ATTR uint32_t _PM_timerStop(Protomatter_core *core) {
|
||||||
void _PM_esp32commonTimerInit(Protomatter_core *core) {
|
void _PM_esp32commonTimerInit(Protomatter_core *core) {
|
||||||
hw_timer_t *timer = (hw_timer_t *)core->timer; // pointer-to-pointer
|
hw_timer_t *timer = (hw_timer_t *)core->timer; // pointer-to-pointer
|
||||||
if (timer == _PM_TIMER_DEFAULT) {
|
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
|
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);
|
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 --------------------
|
#elif defined(CIRCUITPY) // COMPILING FOR CIRCUITPYTHON --------------------
|
||||||
|
|
|
||||||
|
|
@ -90,6 +90,7 @@ IRAM_ATTR inline uint32_t _PM_timerGetCount(Protomatter_core *core) {
|
||||||
#else
|
#else
|
||||||
#include <driver/periph_ctrl.h>
|
#include <driver/periph_ctrl.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include <driver/gpio.h>
|
||||||
#include <esp_private/gdma.h>
|
#include <esp_private/gdma.h>
|
||||||
#include <esp_rom_gpio.h>
|
#include <esp_rom_gpio.h>
|
||||||
#include <hal/dma_types.h>
|
#include <hal/dma_types.h>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue