2020-10-29 08:46:25 +08:00
|
|
|
|
/*
|
|
|
|
|
*************************************************************************
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>ļ<EFBFBD>
|
|
|
|
|
*************************************************************************
|
|
|
|
|
*/
|
|
|
|
|
/* STM32 <20>̼<EFBFBD><CCBC><EFBFBD>ͷ<EFBFBD>ļ<EFBFBD> */
|
|
|
|
|
#include "stm32f10x.h"
|
|
|
|
|
|
|
|
|
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӳ<EFBFBD><D3B2>bspͷ<70>ļ<EFBFBD> */
|
|
|
|
|
#include "board.h"
|
|
|
|
|
#include "bsp_ili9341_lcd.h"
|
|
|
|
|
#include "bsp_adc.h"
|
|
|
|
|
#include "bsp_TiMbase.h"
|
|
|
|
|
#include "bsp_led.h"
|
|
|
|
|
#include "bsp_usart.h"
|
|
|
|
|
#include "bsp_key_exti.h"
|
|
|
|
|
#include "bsp_PS2.h"
|
|
|
|
|
|
|
|
|
|
/* RT-Thread<61><64><EFBFBD><EFBFBD>ͷ<EFBFBD>ļ<EFBFBD> */
|
|
|
|
|
#include <rthw.h>
|
|
|
|
|
#include <rtthread.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(RT_USING_USER_MAIN) && defined(RT_USING_HEAP)
|
|
|
|
|
#define RT_HEAP_SIZE 1024
|
|
|
|
|
/* <20><><EFBFBD>ڲ<EFBFBD>SRAM<41><4D><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>־<EFBFBD>̬<EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD>Ϊrtt<74>Ķѿռ䣬<D5BC><E4A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ4KB */
|
|
|
|
|
static uint32_t rt_heap[RT_HEAP_SIZE];
|
|
|
|
|
RT_WEAK void *rt_heap_begin_get(void)
|
|
|
|
|
{
|
|
|
|
|
return rt_heap;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RT_WEAK void *rt_heap_end_get(void)
|
|
|
|
|
{
|
|
|
|
|
return rt_heap + RT_HEAP_SIZE;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param <EFBFBD><EFBFBD>
|
|
|
|
|
* @retval <EFBFBD><EFBFBD>
|
|
|
|
|
*
|
|
|
|
|
* @attention
|
|
|
|
|
* RTT<EFBFBD>ѿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>صij<EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͳһ<EFBFBD>ŵ<EFBFBD>board.c<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD>֣<EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD>Ȼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Щ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͳһ<EFBFBD>ŵ<EFBFBD>main.c<EFBFBD>ļ<EFBFBD>Ҳ<EFBFBD>ǿ<EFBFBD><EFBFBD>Եġ<EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
void rt_hw_board_init()
|
|
|
|
|
{
|
|
|
|
|
/* <20><>ʼ<EFBFBD><CABC>SysTick */
|
|
|
|
|
SysTick_Config( SystemCoreClock / RT_TICK_PER_SECOND );
|
|
|
|
|
|
|
|
|
|
/* Ӳ<><D3B2>BSP<53><50>ʼ<EFBFBD><CABC>ͳͳ<CDB3><CDB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFA3AC><EFBFBD><EFBFBD>LED<45><44><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>LCD<43><44> */
|
|
|
|
|
|
|
|
|
|
ILI9341_Init ();//LCD <20><>ʼ<EFBFBD><CABC>
|
|
|
|
|
LED_GPIO_Config();
|
|
|
|
|
USART_Config();
|
|
|
|
|
ADCx_Init();
|
|
|
|
|
EXTI_Key_Config();
|
|
|
|
|
PS2_Key_Config();
|
|
|
|
|
BASIC_TIM_Init();
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>0<EFBFBD><30>3<EFBFBD><33>5<EFBFBD><35>6 ģʽ<C4A3>ʺϴ<CABA><CFB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD>֣<EFBFBD>
|
|
|
|
|
//<2F><><EFBFBD>Ƽ<EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģʽ<C4A3><CABD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD> <09><><EFBFBD><EFBFBD>ģʽ<C4A3><CABD>ʾ<EFBFBD><CABE><EFBFBD>ֻ<EFBFBD><D6BB>о<EFBFBD><D0BE><EFBFBD>Ч<EFBFBD><D0A7>
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD> 6 ģʽΪ<CABD><EFBFBD>Һ<EFBFBD><D2BA><EFBFBD><EFBFBD><EFBFBD>̵<EFBFBD>Ĭ<EFBFBD><C4AC><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
|
|
|
|
|
ILI9341_GramScan ( 3 );
|
|
|
|
|
LCD_SetColors(WHITE, BLACK);
|
|
|
|
|
ILI9341_Clear(0,0,LCD_X_LENGTH,LCD_Y_LENGTH);
|
|
|
|
|
|
|
|
|
|
ILI9341_Clear(200, 0, 320, (((sFONT *)LCD_GetFont())->Height));
|
|
|
|
|
ILI9341_DispString_EN(210, 0,"T: 2ms");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (use INIT_BOARD_EXPORT()) */
|
|
|
|
|
#ifdef RT_USING_COMPONENTS_INIT
|
|
|
|
|
rt_components_board_init();
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if defined(RT_USING_CONSOLE) && defined(RT_USING_DEVICE)
|
|
|
|
|
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if defined(RT_USING_USER_MAIN) && defined(RT_USING_HEAP)
|
|
|
|
|
rt_system_heap_init(rt_heap_begin_get(), rt_heap_end_get());
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief SysTick<EFBFBD>жϷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param <EFBFBD><EFBFBD>
|
|
|
|
|
* @retval <EFBFBD><EFBFBD>
|
|
|
|
|
*
|
|
|
|
|
* @attention
|
|
|
|
|
* SysTick<EFBFBD>жϷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڹ̼<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>stm32f10x_it.c<EFBFBD><EFBFBD>Ҳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD>board.c<EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>Σ<EFBFBD><EFBFBD><EFBFBD>ô<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǿ<EFBFBD><EFBFBD><EFBFBD>stm32f10x_it.c<EFBFBD>е<EFBFBD>ע<EFBFBD>ͻ<EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɡ<EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
void SysTick_Handler(void)
|
|
|
|
|
{
|
|
|
|
|
/* <20><><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD> */
|
|
|
|
|
rt_interrupt_enter();
|
|
|
|
|
|
|
|
|
|
/* <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> */
|
|
|
|
|
rt_tick_increase();
|
|
|
|
|
|
|
|
|
|
/* <20>뿪<EFBFBD>ж<EFBFBD> */
|
|
|
|
|
rt_interrupt_leave();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief <EFBFBD><EFBFBD>ӳ<EFBFBD>䴮<EFBFBD><EFBFBD>DEBUG_USARTx<EFBFBD><EFBFBD>rt_kprintf()<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* Note<EFBFBD><EFBFBD>DEBUG_USARTx<EFBFBD><EFBFBD><EFBFBD><EFBFBD>bsp_usart.h<EFBFBD>ж<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĺ꣬Ĭ<EFBFBD><EFBFBD>ʹ<EFBFBD>ô<EFBFBD><EFBFBD><EFBFBD>1
|
|
|
|
|
* @param str<EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @retval <EFBFBD><EFBFBD>
|
|
|
|
|
*
|
|
|
|
|
* @attention
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
void rt_hw_console_output(const char *str)
|
|
|
|
|
{
|
|
|
|
|
/* <20><><EFBFBD><EFBFBD><EFBFBD>ٽ<EFBFBD><D9BD><EFBFBD> */
|
|
|
|
|
rt_enter_critical();
|
|
|
|
|
|
|
|
|
|
/* ֱ<><D6B1><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|
|
|
|
while (*str!='\0')
|
|
|
|
|
{
|
|
|
|
|
/* <20><><EFBFBD><EFBFBD> */
|
|
|
|
|
if (*str=='\n')
|
|
|
|
|
{
|
|
|
|
|
USART_SendData(DEBUG_USARTx, '\r');
|
|
|
|
|
while (USART_GetFlagStatus(DEBUG_USARTx, USART_FLAG_TXE) == RESET);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
USART_SendData(DEBUG_USARTx, *str++);
|
|
|
|
|
while (USART_GetFlagStatus(DEBUG_USARTx, USART_FLAG_TXE) == RESET);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* <20>˳<EFBFBD><CBB3>ٽ<EFBFBD><D9BD><EFBFBD> */
|
|
|
|
|
rt_exit_critical();
|
|
|
|
|
}
|