diff options
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 19 |
1 files changed, 17 insertions, 2 deletions
@@ -1,10 +1,10 @@ #include <math.h> #include <stdint.h> #include <stdio.h> -#include "string.h" #include "byte_math.h" #include "ch573/gpio.h" +#include "ch573/pfic.h" #include "ch573/pwr.h" #include "ch573/uart.h" #include "clock.h" @@ -13,8 +13,12 @@ #include "string.h" #include "sysled.h" #include "system.h" +#include "systick.h" #include "ws2812b.h" +#define PFIC_I CH573_PFIC__PFIC_T_INTF +#define PFIC ch573_pfic__pfic + #define GPIO_PORT_A ch573_gpio__gpio_port_a #define GPIO_PORT_B ch573_gpio__gpio_port_b #define GPIO_PORT CH573_GPIO__GPIO_PORT_T_INTF @@ -203,14 +207,25 @@ int main(void) { char buf[N_LEDS * TOTAL_BYTES_PER_LED]; + PFIC_I.vector_table_control.set(PFIC, 1); + PFIC->interrupt_priority_threshold = 0x10; + PFIC->interrupt_enable |= IRQ_SysTick; + + printf( + "PFIC enable status 1: %08x\n", + (uint32_t)(PFIC->interrupt_enable_status)); + set_system_clock_60Mhz(); + + set_systick(250000); + enable_sysled(); enable_spi(); size_t n = sizeof(buf); struct ws2812b_buf ws_buf; make_wsb2812b(&ws_buf, buf, n); - ws_buf.byte_order = BYTE_ORDER_RGB; + ws_buf.byte_order = BYTE_ORDER_GRB; rgb_t color; uint32_t time = 0; |