volatile uint32_t *gpio_enable_reg = (volatile uint32_t *)GPIO_ENABLE_REG;
volatile uint32_t *io_mux_7_reg = (volatile uint32_t *)IO_MUX_GPIO7_REG;
volatile uint32_t *gpio_func7_out_sel_cfg_reg = (volatile uint32_t *)GPIO_FUNC7_OUT_SEL_CFG_REG;
volatile uint32_t *gpio_enable_w1ts_reg = (volatile uint32_t *)GPIO_ENABLE_W1TS_REG;
volatile uint32_t *gpio_out_reg = (volatile uint32_t *)GPIO_OUT_REG;
volatile uint32_t *ledc_conf_reg = (volatile uint32_t *)0x600190D0;
volatile uint32_t *ledc_ch0_conf0_reg = (volatile uint32_t *)0x60019000;
volatile uint32_t *ledc_ch0_conf1_reg = (volatile uint32_t *)0x6001900C;
volatile uint32_t *ledc_ch0_hpoint_reg = (volatile uint32_t *)0x60019004;
volatile uint32_t *ledc_ch0_duty_reg = (volatile uint32_t *)0x60019008;
volatile uint32_t *ledc_timer0_conf_reg = (volatile uint32_t *)0x600190A0;
volatile uint32_t *ledc_timer0_value_reg = (volatile uint32_t *)0x600190A4;
volatile uint32_t *gpiosd_sigmadelta_misc_reg = (volatile uint32_t *)0x60004F24;
volatile uint32_t *gpiosd_sigmadelta0_reg = (volatile uint32_t *)0x60004F00;
volatile uint32_t *gpio_pin7_reg = (volatile uint32_t *)GPIO_PIN7_REG;
//volatile uint32_t *gpio_out_reg = (volatile uint32_t *)GPIO_OUT_REG;
//volatile uint32_t *gpio_out_reg = (volatile uint32_t *)GPIO_OUT_REG;
//volatile uint32_t *gpio_out_reg = (volatile uint32_t *)GPIO_OUT_REG;
//volatile uint32_t *gpio_out_reg = (volatile uint32_t *)GPIO_OUT_REG;
void setup() {
Serial.begin(115200);
// Enable GPIO Pins
*gpio_enable_reg |= (1 << 7);
*gpio_pin7_reg |= (1 << 2); // open drain output
*gpio_func7_out_sel_cfg_reg |= (1 << 10); // enable output
*io_mux_7_reg |= (1 << 12); // function auf 1
// PWM
/*
*ledc_conf_reg |= 1;
*ledc_timer0_conf_reg |= 8; // change duty cycle of timer 2^value -1 | 10 = 1024
*ledc_timer0_conf_reg |= (1 << 25); // update timer conf
*ledc_timer0_conf_reg |= (1 << 24); // set bit to 1
*ledc_timer0_conf_reg |= (0b111111111111111111 << 4); // set bit to 1
*ledc_timer0_conf_reg &= ~(1 << 23); // set bit to 0
*ledc_ch0_conf0_reg &= ~(1 << 0); // change timer to timer0
*ledc_ch0_conf0_reg |= (1 << 2); // enable signal output
*/
*gpio_func7_out_sel_cfg_reg |= 100;
*gpiosd_sigmadelta_misc_reg |= (1 << 30); // enable pwm clk
*gpiosd_sigmadelta0_reg |= (10 << 8); // prescaler auf 5 weil 20 MHZ und ich will 2MHZ-
}
void loop() {
*gpiosd_sigmadelta0_reg |= 127; // duty cycle auf 100%
Serial.println((int8_t)(*gpiosd_sigmadelta0_reg & 0xFF));
for (int i = -127; i<127;i++){
*gpiosd_sigmadelta0_reg |= i;
}
delay(1000);
for(int i = 127; i>-127;i++){
*gpiosd_sigmadelta0_reg |= i;
}
delay(1000);
}