This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100a101,146 | |
> //// CHANGES TO MAKE ADJTIME EXIST | |
> | |
> static uint64_t get_time_since_boot(); // FIXME: Is there a better way to do this? | |
> | |
> // adjtime_start stores the start time of the slew | |
> // adjtime_total is how many microseconds total to slew | |
> // Maximum is 2^31 microseconds, or about 35 minutes. | |
> // Typically 500,000 microseconds max for NTP | |
> // Rate is the speed at which we add data. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define DMX1_IO (0) | |
#define DMX1_TX (16) | |
#define DMX1_RX (32) | |
#define BUF_SIZE (512) | |
uint8_t data[513]; // This is a global in this case | |
/* | |
So this is an incredibly simple transmit-only DMX task for ESP32 ESP-IDF V4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Per this forum post: https://esp32.com/viewtopic.php?t=6701 | |
The way to calculate max PWM frequency is integer (log 2 (LEDC_APB_CLK / frequency)) | |
With a LEDC_APB_CLK == 80MHz, these are the following maximum values, in Hz: | |
LEDC_TIMER_1_BIT, 40000000 | |
LEDC_TIMER_2_BIT, 20000000 | |
LEDC_TIMER_3_BIT, 10000000 | |
LEDC_TIMER_4_BIT, 5000000 | |
LEDC_TIMER_5_BIT, 2500000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
enable_task outputs a 38.400MHz clock on GPIO 0. | |
Writing 0 into its queue will turn this output off | |
Writing 1 into its queue will turn the output on | |
*/ | |
static void enable_task(void *ignore) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "board.h" | |
#include "ch32v30x.h" | |
#include "dmx.h" | |
#include "debug.h" | |
uint8_t output_buffer[513]; | |
/* | |
dmx_init(); | |
dmx_send_break(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
If systemclock is 144MHz, this generates an interrupt every millisecond | |
*/ | |
void init_millis() { | |
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM6, ENABLE); | |
TIM6->PSC = 2; // 144MHz / (65536 - 48000) / (2+1) = 1 milliseconds per tick | |
TIM6->DMAINTENR = TIM_UIE; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define F_CPU 8000000UL | |
#include <avr/io.h> | |
#include <inttypes.h> | |
#include <util/delay.h> | |
#include <avr/interrupt.h> | |
volatile uint8_t universe[513]; | |
uint16_t i; |