mirror of
https://github.com/esphome/esphome.git
synced 2024-11-10 01:07:45 +01:00
Fix RMT timing clock base (#6101)
This commit is contained in:
parent
e35cab018a
commit
ea03058ace
1 changed files with 3 additions and 1 deletions
|
@ -13,6 +13,8 @@ namespace esp32_rmt_led_strip {
|
||||||
|
|
||||||
static const char *const TAG = "esp32_rmt_led_strip";
|
static const char *const TAG = "esp32_rmt_led_strip";
|
||||||
|
|
||||||
|
static const uint32_t RMT_CLK_FREQ = 80000000;
|
||||||
|
|
||||||
static const uint8_t RMT_CLK_DIV = 2;
|
static const uint8_t RMT_CLK_DIV = 2;
|
||||||
|
|
||||||
void ESP32RMTLEDStripLightOutput::setup() {
|
void ESP32RMTLEDStripLightOutput::setup() {
|
||||||
|
@ -65,7 +67,7 @@ void ESP32RMTLEDStripLightOutput::setup() {
|
||||||
|
|
||||||
void ESP32RMTLEDStripLightOutput::set_led_params(uint32_t bit0_high, uint32_t bit0_low, uint32_t bit1_high,
|
void ESP32RMTLEDStripLightOutput::set_led_params(uint32_t bit0_high, uint32_t bit0_low, uint32_t bit1_high,
|
||||||
uint32_t bit1_low) {
|
uint32_t bit1_low) {
|
||||||
float ratio = (float) APB_CLK_FREQ / RMT_CLK_DIV / 1e09f;
|
float ratio = (float) RMT_CLK_FREQ / RMT_CLK_DIV / 1e09f;
|
||||||
|
|
||||||
// 0-bit
|
// 0-bit
|
||||||
this->bit0_.duration0 = (uint32_t) (ratio * bit0_high);
|
this->bit0_.duration0 = (uint32_t) (ratio * bit0_high);
|
||||||
|
|
Loading…
Reference in a new issue