2023-04-17 21:56:42 +08:00
|
|
|
#pragma once
|
|
|
|
|
2023-04-23 21:25:56 +08:00
|
|
|
#include "CMSIS/MKL25Z4.h"
|
2023-04-28 14:45:46 +08:00
|
|
|
#include <inttypes.h>
|
|
|
|
|
|
|
|
#define q15_t int16_t
|
|
|
|
#define q31_t int32_t
|
|
|
|
#define float32_t float
|
|
|
|
typedef unsigned char uchar;
|
2023-04-17 21:56:42 +08:00
|
|
|
|
|
|
|
// Define Clock Settings
|
|
|
|
#define CORCLK_DEFAULT 20970000u // Default Core clock, 20.97 Mhz
|
|
|
|
#define BUSCLK_DEFAULT 10500000u // Default Bus Rate clock, 10.5 Mhz, half of CORCLK
|
|
|
|
|
|
|
|
#define CPU_XTAL_CLK_HZ 8000000u // Value of the external crystal or oscillator clock frequency in Hz
|
|
|
|
#define CPU_INT_SLOW_CLK_HZ 32768u // Value of the slow internal oscillator clock frequency in Hz
|
|
|
|
#define CPU_INT_FAST_CLK_HZ 4000000u // Value of the fast internal oscillator clock frequency in Hz
|
|
|
|
|
|
|
|
#define UART_MSG UART1
|
|
|
|
|
|
|
|
#define PI 3.1415926
|
|
|
|
#define BIT(x) (1UL << (x))
|
2023-04-27 01:30:27 +08:00
|
|
|
#define GPIO_OUT(port, pin, mode) \
|
|
|
|
{ \
|
|
|
|
GPIO##port->PDDR |= BIT(pin); \
|
|
|
|
PORT##port->PCR[pin] |= PORT_PCR_MUX(mode); \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define GPIO_IN(port, pin, mode) \
|
|
|
|
{ \
|
|
|
|
GPIO##port->PDDR &= ~BIT(pin); \
|
|
|
|
PORT##port->PCR[pin] |= PORT_PCR_MUX(mode); \
|
|
|
|
PORT##port->PCR[pin] |= PORT_PCR_PE(0x1); \
|
|
|
|
}
|
2023-04-17 21:56:42 +08:00
|
|
|
|
2023-04-28 18:11:09 +08:00
|
|
|
#define ticks_ms (uint32_t)(ticks_100us / 10)
|
2023-04-27 14:43:03 +08:00
|
|
|
|
2023-04-17 21:56:42 +08:00
|
|
|
extern uint32_t CORCLK;
|
|
|
|
extern uint32_t BUSCLK;
|
2023-04-28 18:11:09 +08:00
|
|
|
extern volatile uint32_t ticks_100us;
|
2023-04-19 18:15:42 +08:00
|
|
|
extern void SysTick_Handler(void);
|
|
|
|
extern void UART1_IRQHandler(void);
|