1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-26 17:46:14 +01:00

set RMT clock to microseconds

This commit is contained in:
Harald Barth 2021-11-19 00:03:21 +01:00
parent a69b7ee113
commit 55a789d65a
2 changed files with 5 additions and 3 deletions

View File

@ -87,7 +87,7 @@ RMTPin::RMTPin(byte pin, byte ch, byte plen) {
bzero(&config, sizeof(rmt_config_t));
config.rmt_mode = RMT_MODE_TX;
config.channel = channel = (rmt_channel_t)ch;
config.clk_div = 1; // use 80Mhz clock directly
config.clk_div = RMT_CLOCK_DIVIDER;
config.gpio_num = (gpio_num_t)pin;
config.mem_block_num = 2; // With longest DCC packet 11 inc checksum (future expansion)
// number of bits needed is 22preamble + start +

View File

@ -23,8 +23,10 @@
#include "soc/rmt_reg.h"
#include "soc/rmt_struct.h"
#define DCC_1_HALFPERIOD 4640 // 1 / 80000000 * 4640 = 58us
#define DCC_0_HALFPERIOD 8000
// make calculations easy and set up for microseconds
#define RMT_CLOCK_DIVIDER 80
#define DCC_1_HALFPERIOD 58 //4640 // 1 / 80000000 * 4640 = 58us
#define DCC_0_HALFPERIOD 100 //8000
class RMTPin {
public: