123456789101112131415161718192021222324252627282930313233343536373839404142 |
- #include "board.h"
- #include "gpio.h"
- #include "main.h"
- extern "C" void SystemClock_Config(void);
- extern "C" int64_t get_current_time(void);
- void Board::init_start() {
- /* Reset of all peripherals, Initializes the Flash interface and the Systick.
- */
- LL_APB4_GRP1_EnableClock(LL_APB4_GRP1_PERIPH_SYSCFG);
- /* System interrupt init*/
- NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4);
- /* Update the time base */
- /* Configure the system clock */
- SystemClock_Config();
- MX_GPIO_Init();
- /* Enable I-Cache---------------------------------------------------------*/
- SCB_EnableICache();
- /* Enable D-Cache---------------------------------------------------------*/
- SCB_EnableDCache();
- }
- void Board::enable_interrupts() {}
- void Board::enable_timer() { SysTick_Config(SystemCoreClock / 1000); }
- rl::TimePoint Board::get_now() { return get_current_time(); }
- void Board::toggle_led() { LL_GPIO_TogglePin(LD1_GPIO_Port, LD1_Pin); }
- void Board::delay() {
- auto end = get_current_time() + 1000;
- while (get_current_time() < end);
- }
|