mirror of
https://github.com/0xFEEDC0DE64/arduino-esp32.git
synced 2025-06-30 20:40:59 +02:00
Summary This PR is refactoring of SigmaDelta HAL in order to use IDF instead of current Register manipulation approach. Impact Change in API: uint32_t sigmaDeltaSetup(uint8_t channel, uint32_t freq); changed to --> uint32_t sigmaDeltaSetup(uint8_t pin, uint8_t channel, uint32_t freq); void sigmaDeltaAttachPin(uint8_t pin); removed, no longer needed. Pin is attached in sigmaDeltaSetup()
17 lines
317 B
C++
17 lines
317 B
C++
void setup()
|
|
{
|
|
//setup on pin 18, channel 0 with frequency 312500 Hz
|
|
sigmaDeltaSetup(18,0, 312500);
|
|
//initialize channel 0 to off
|
|
sigmaDeltaWrite(0, 0);
|
|
}
|
|
|
|
void loop()
|
|
{
|
|
//slowly ramp-up the value
|
|
//will overflow at 256
|
|
static uint8_t i = 0;
|
|
sigmaDeltaWrite(0, i++);
|
|
delay(100);
|
|
}
|