CodeBrick/user/platform.c
2020-07-11 12:34:26 +08:00

54 lines
1.2 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/******************************************************************************
* @brief ƽ̨<C6BD><CCA8><EFBFBD>س<EFBFBD>ʼ<EFBFBD><CABC>
*
* Copyright (c) 2020, <master_roger@sina.com>
*
* SPDX-License-Identifier: Apache-2.0
*
******************************************************************************/
#include "module.h"
#include "public.h"
#include "config.h"
#include "platform.h"
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
#include "tty.h"
/*
* @brief ϵͳ<CFB5>δ<EFBFBD><CEB4>ж<EFBFBD>
* @param[in] none
* @return none
*/
void SysTick_Handler(void)
{
systick_increase(SYS_TICK_INTERVAL);
}
/*
* @brief <20>ض<EFBFBD><D8B6><EFBFBD>printf
*/
int putchar(int c)
{
unsigned char byte = c;
tty.write(&byte, 1);
//tty.write(&c, 1);
while (tty.tx_isfull()) {} //<2F><>ֹ<EFBFBD><D6B9>LOG
return c;
}
/*
* @brief Ӳ<><D3B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>
* @param[in] none
* @return none
*/
static void bsp_init(void)
{
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
tty.init(115200);
SystemCoreClockUpdate();
SysTick_Config(SystemCoreClock / (1000 / SYS_TICK_INTERVAL)); //<2F><><EFBFBD><EFBFBD>ϵͳʱ<CDB3><CAB1>
NVIC_SetPriority(SysTick_IRQn, 0);
}system_init("bsp", bsp_init);