28 lines
595 B
C
28 lines
595 B
C
#include "adc.h"
|
|
#include "derivative.h"
|
|
#include "uart.h"
|
|
|
|
uint32_t CORCLK = CORCLK_DEFAULT;
|
|
uint32_t BUSCLK = BUSCLK_DEFAULT;
|
|
|
|
volatile uint32_t ticks_100us;
|
|
|
|
void SysTick_Handler(void) {
|
|
ticks_100us++;
|
|
if (fADC) {
|
|
adc_buf[pADC] = adc0_TR_DATA() - 1550;
|
|
pADC = (pADC + 1) % ADC_M;
|
|
cADC++;
|
|
}
|
|
}
|
|
|
|
void UART1_IRQHandler(void) {
|
|
if (UART1->S1 & UART_S1_RDRF_MASK) {
|
|
char buf[64];
|
|
size_t len = uart_getline(UART1, buf);
|
|
uart_printf(UART_MSG, "%d: ", len);
|
|
uart_write_buf(UART_MSG, buf, len);
|
|
buf[0] = UART1->D;
|
|
}
|
|
}
|