microscope-ring-light/firmware/main.c

36 lines
575 B
C
Raw Normal View History

2021-03-12 18:53:53 +01:00
#include <stm32f0xx.h>
2021-03-12 22:28:00 +01:00
#include <cmsis/core_cm0.h>
2021-03-12 18:53:53 +01:00
unsigned int i = 0x12345678;
unsigned char c = 2;
2021-03-12 22:28:00 +01:00
extern void sk6812_send_led(uint32_t rgbw);
volatile uint32_t wait_tick = 0;
static void wait_for_ticks(uint32_t ticks)
{
wait_tick = 0;
while (wait_tick < ticks);
}
int main(void)
{
uint32_t led_val = 0xAAUL;
2021-03-12 22:28:00 +01:00
RCC->AHBENR |= RCC_AHBENR_GPIOAEN;
GPIOA->MODER |= (1<<3*2);
2021-03-12 18:53:53 +01:00
SysTick_Config(800000);
while(1) {
2021-03-12 22:28:00 +01:00
__disable_irq();
sk6812_send_led(led_val);
2021-03-12 22:28:00 +01:00
__enable_irq();
wait_for_ticks(30);
led_val += 20;
2021-03-12 18:53:53 +01:00
}
}
void SysTick_Handler(void) {
2021-03-12 22:28:00 +01:00
wait_tick++;
2021-03-12 18:53:53 +01:00
}