Closed paengpd closed 4 years ago
I want to use timer of 1Mhz ~ 8Mhz. So I made code for below.
static stm32l0_timer_t stm32l0_clk;
byte led = 0;
static void clk_event_callback(void *context, uint32_t events) { (void)context; (void)events;
if(led) led = 0; else led = 1; digitalWrite(13, led);
}
void setup () { pinMode(13, OUTPUT);
stm32l0_timer_create(&stm32l0_clk, STM32L0_TIMER_INSTANCE_TIM22, STM32L0_TONE_IRQ_PRIORITY, 0); stm32l0_timer_enable(&stm32l0_clk, 2 -1, STM32L0_TIMER_OPTION_COUNT_PRELOAD, clk_event_callback, NULL, STM32L0_TIMER_EVENT_PERIOD); stm32l0_timer_start(&stm32l0_clk, 2 - 1, false);
I chagned prescaler and period, but timer is not changed that fast over 238khz. Give me some advice.
analogWrite(); function + TIMxx regiser hard cording.
I want to use timer of 1Mhz ~ 8Mhz. So I made code for below.
include "wiring_private.h"
static stm32l0_timer_t stm32l0_clk;
byte led = 0;
static void clk_event_callback(void *context, uint32_t events) { (void)context; (void)events;
}
void setup () { pinMode(13, OUTPUT);
}
void loop () { }
I chagned prescaler and period, but timer is not changed that fast over 238khz. Give me some advice.