format codes

pull/91/head
Meco Man 5 years ago
parent 9bacff022c
commit befe7c1034

@ -36,9 +36,9 @@
static void test_elog(void); static void test_elog(void);
int main(void){ int main(void){
BSP_Init(); BSP_Init();
/* initialize EasyLogger */ /* initialize EasyLogger */
elog_init(); elog_init();
/* set EasyLogger log format */ /* set EasyLogger log format */
@ -50,7 +50,7 @@ int main(void){
elog_set_fmt(ELOG_LVL_VERBOSE, ELOG_FMT_ALL & ~(ELOG_FMT_FUNC | ELOG_FMT_T_INFO | ELOG_FMT_P_INFO)); elog_set_fmt(ELOG_LVL_VERBOSE, ELOG_FMT_ALL & ~(ELOG_FMT_FUNC | ELOG_FMT_T_INFO | ELOG_FMT_P_INFO));
/* start EasyLogger */ /* start EasyLogger */
elog_start(); elog_start();
/* dynamic set enable or disable for output logs (true or false) */ /* dynamic set enable or disable for output logs (true or false) */
// elog_set_output_enabled(false); // elog_set_output_enabled(false);
/* dynamic set output logs's level (from ELOG_LVL_ASSERT to ELOG_LVL_VERBOSE) */ /* dynamic set output logs's level (from ELOG_LVL_ASSERT to ELOG_LVL_VERBOSE) */
@ -68,9 +68,9 @@ int main(void){
LED_RUN_ON; LED_RUN_ON;
delay(10000000); delay(10000000);
LED_RUN_OFF; LED_RUN_OFF;
delay(10000000); delay(10000000);
} }
return 0; return 0;
} }

@ -32,20 +32,20 @@
*/ */
static void RCC_Configuration(void) static void RCC_Configuration(void)
{ {
//下面是给各模块开启时钟 //下面是给各模块开启时钟
//启动GPIO //启动GPIO
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | \ RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | \
RCC_APB2Periph_GPIOC | RCC_APB2Periph_GPIOD | \ RCC_APB2Periph_GPIOC | RCC_APB2Periph_GPIOD | \
RCC_APB2Periph_GPIOE | RCC_APB2Periph_GPIOG, RCC_APB2Periph_GPIOE | RCC_APB2Periph_GPIOG,
ENABLE); ENABLE);
//启动AFIO //启动AFIO
RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE); RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);
//启动USART1时钟 //启动USART1时钟
RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE); RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE);
//启动USART2时钟 //启动USART2时钟
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2, ENABLE); RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2, ENABLE);
//启动DMA时钟 //启动DMA时钟
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA1, ENABLE); RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA1, ENABLE);
/* Enable ADC1 and GPIOC clock */ /* Enable ADC1 and GPIOC clock */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, ENABLE); RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, ENABLE);
@ -95,13 +95,13 @@ static void GPIO_Configuration(void)
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOB, &GPIO_InitStructure); GPIO_Init(GPIOB, &GPIO_InitStructure);
/* USART1_TX */ /* USART1_TX */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9; GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_Init(GPIOA, &GPIO_InitStructure); GPIO_Init(GPIOA, &GPIO_InitStructure);
/* USART1_RX */ /* USART1_RX */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10; GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
@ -118,7 +118,7 @@ static void GPIO_Configuration(void)
void USART1_Configuration(void) void USART1_Configuration(void)
{ {
USART_InitTypeDef USART_InitStructure; USART_InitTypeDef USART_InitStructure;
USART_InitStructure.USART_BaudRate = 115200; USART_InitStructure.USART_BaudRate = 115200;
USART_InitStructure.USART_WordLength = USART_WordLength_8b; USART_InitStructure.USART_WordLength = USART_WordLength_8b;
USART_InitStructure.USART_StopBits = USART_StopBits_1; USART_InitStructure.USART_StopBits = USART_StopBits_1;
@ -126,14 +126,14 @@ void USART1_Configuration(void)
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None; USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_InitStructure.USART_Mode = USART_Mode_Tx | USART_Mode_Rx; USART_InitStructure.USART_Mode = USART_Mode_Tx | USART_Mode_Rx;
USART_Init(USART1, &USART_InitStructure); USART_Init(USART1, &USART_InitStructure);
USART_Cmd(USART1, ENABLE); USART_Cmd(USART1, ENABLE);
} }
/** /**
* IWDG_Configuration * IWDG_Configuration
*/ */
static void IWDG_Configuration(void) static void IWDG_Configuration(void)
{ {
IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable); IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable);
IWDG_SetPrescaler(IWDG_Prescaler_64); IWDG_SetPrescaler(IWDG_Prescaler_64);
@ -161,12 +161,12 @@ int fputc(int ch, FILE *f)
int fgetc(FILE *f) int fgetc(FILE *f)
{ {
while(!(USART_GetFlagStatus(USART1, USART_FLAG_RXNE) == SET)) while(!(USART_GetFlagStatus(USART1, USART_FLAG_RXNE) == SET))
{ {
} }
return (USART_ReceiveData(USART1)); return (USART_ReceiveData(USART1));
} }

@ -26,38 +26,38 @@
*/ */
/* board configuration */ /* board configuration */
// <o> SDCard Driver <1=>SDIO sdcard <0=>SPI MMC card // <o> SDCard Driver <1=>SDIO sdcard <0=>SPI MMC card
// <i>Default: 1 // <i>Default: 1
#define STM32_USE_SDIO 0 #define STM32_USE_SDIO 0
/* whether use board external SRAM memory */ /* whether use board external SRAM memory */
// <e>Use external SRAM memory on the board // <e>Use external SRAM memory on the board
// <i>Enable External SRAM memory // <i>Enable External SRAM memory
#define STM32_EXT_SRAM 0 #define STM32_EXT_SRAM 0
// <o>Begin Address of External SRAM // <o>Begin Address of External SRAM
// <i>Default: 0x68000000 // <i>Default: 0x68000000
#define STM32_EXT_SRAM_BEGIN 0x68000000 /* the begining address of external SRAM */ #define STM32_EXT_SRAM_BEGIN 0x68000000 /* the begining address of external SRAM */
// <o>End Address of External SRAM // <o>End Address of External SRAM
// <i>Default: 0x68080000 // <i>Default: 0x68080000
#define STM32_EXT_SRAM_END 0x68080000 /* the end address of external SRAM */ #define STM32_EXT_SRAM_END 0x68080000 /* the end address of external SRAM */
// </e> // </e>
// <o> Internal SRAM memory size[Kbytes] <8-64> // <o> Internal SRAM memory size[Kbytes] <8-64>
// <i>Default: 64 // <i>Default: 64
#define STM32_SRAM_SIZE 64 #define STM32_SRAM_SIZE 64
#define STM32_SRAM_END (SRAM_BASE + STM32_SRAM_SIZE * 1024) #define STM32_SRAM_END (SRAM_BASE + STM32_SRAM_SIZE * 1024)
#define VECT_TAB_FLASH /* use Flash to store vector table */ #define VECT_TAB_FLASH /* use Flash to store vector table */
#define LED_RUN_ON GPIO_SetBits (GPIOB,GPIO_Pin_5) //RUN #define LED_RUN_ON GPIO_SetBits (GPIOB,GPIO_Pin_5) //RUN
#define LED_RUN_OFF GPIO_ResetBits(GPIOB,GPIO_Pin_5) //RUN #define LED_RUN_OFF GPIO_ResetBits(GPIOB,GPIO_Pin_5) //RUN
/*********************************************************************************************************/ /*********************************************************************************************************/
/** MACRO'S */ /** MACRO'S */
/***********************************************************************************************************/ /***********************************************************************************************************/
/***********************************************************************************************************/ /***********************************************************************************************************/
/* DATA TYPES */ /* DATA TYPES */
/***********************************************************************************************************/ /***********************************************************************************************************/

@ -7,15 +7,15 @@
typedef int bool_t; /**< boolean type */ typedef int bool_t; /**< boolean type */
#ifndef TRUE #ifndef TRUE
#define TRUE 1 #define TRUE 1
#endif #endif
#ifndef FALSE #ifndef FALSE
#define FALSE 0 #define FALSE 0
#endif #endif
#ifndef NULL #ifndef NULL
#define NULL 0 #define NULL 0
#endif #endif
#define success 0 #define success 0

@ -95,7 +95,7 @@ void elog_file_port_deinit(void)
} }
/** /**
* initialize the lock * initialize the lock
*/ */
static void lock_init(void) static void lock_init(void)
{ {
@ -129,7 +129,7 @@ __exit:
} }
/** /**
* gets the lock * gets the lock
*/ */
static int lock_open(void) static int lock_open(void)
{ {
@ -163,7 +163,7 @@ err:
} }
/** /**
* deinitialize the lock * deinitialize the lock
*/ */
static void lock_deinit(void) static void lock_deinit(void)
{ {

@ -82,7 +82,7 @@ void elog_port_output(const char *log, size_t size) {
#ifdef ELOG_FILE_ENABLE #ifdef ELOG_FILE_ENABLE
/* write the file */ /* write the file */
elog_file_write(log, size); elog_file_write(log, size);
#endif #endif
} }
/** /**

@ -4,7 +4,7 @@
#ifndef APP_TASK_H #ifndef APP_TASK_H
#define APP_TASK_H #define APP_TASK_H
#include <rthw.h> #include <rthw.h>
#include <rtthread.h> #include <rtthread.h>
#include <stm32f10x_conf.h> #include <stm32f10x_conf.h>

@ -4,29 +4,29 @@
#include"rtconfig.h" #include"rtconfig.h"
#if RT_TICK_PER_SECOND == 1 #if RT_TICK_PER_SECOND == 1
#define DELAY_1S (RT_TICK_PER_SECOND) #define DELAY_1S (RT_TICK_PER_SECOND)
#define DELAY_S(X) (X*DELAY_1S) #define DELAY_S(X) (X*DELAY_1S)
#elif RT_TICK_PER_SECOND == 10 #elif RT_TICK_PER_SECOND == 10
#define DELAY_100MS(X) (X) #define DELAY_100MS(X) (X)
#define DELAY_S(X) (X*10) #define DELAY_S(X) (X*10)
#elif RT_TICK_PER_SECOND == 100 #elif RT_TICK_PER_SECOND == 100
#define DELAY_10MS(X) (X) #define DELAY_10MS(X) (X)
#define DELAY_100MS(X) (X*10) #define DELAY_100MS(X) (X*10)
#define DELAY_S(X) (X*100) #define DELAY_S(X) (X*100)
#elif (RT_TICK_PER_SECOND == 1000) #elif (RT_TICK_PER_SECOND == 1000)
#define DELAY_1MS (RT_TICK_PER_SECOND/1000) #define DELAY_1MS (RT_TICK_PER_SECOND/1000)
#define DELAY_MS(X) (X*DELAY_1MS) #define DELAY_MS(X) (X*DELAY_1MS)
#define DELAY_S(X) (X*1000*DELAY_1MS) #define DELAY_S(X) (X*1000*DELAY_1MS)
#elif (RT_TICK_PER_SECOND == 10000) #elif (RT_TICK_PER_SECOND == 10000)
#define DELAY_100US(X) (X*RT_TICK_PER_SECOND/10000) #define DELAY_100US(X) (X*RT_TICK_PER_SECOND/10000)
#define DELAY_1MS (RT_TICK_PER_SECOND/1000) #define DELAY_1MS (RT_TICK_PER_SECOND/1000)
#define DELAY_MS(X) (X*DELAY_1MS) #define DELAY_MS(X) (X*DELAY_1MS)
#define DELAY_S(X) (X*1000*DELAY_1MS) #define DELAY_S(X) (X*1000*DELAY_1MS)
#endif #endif
@ -37,5 +37,5 @@
#define DELAY_SYS_FAULT_LED_ON DELAY_MS(50) #define DELAY_SYS_FAULT_LED_ON DELAY_MS(50)
#define DELAY_SYS_FAULT_LED_OFF DELAY_MS(950) #define DELAY_SYS_FAULT_LED_OFF DELAY_MS(950)
#endif #endif

@ -3,16 +3,16 @@
#define __RTTHREAD_CFG_H__ #define __RTTHREAD_CFG_H__
/* RT_NAME_MAX*/ /* RT_NAME_MAX*/
#define RT_NAME_MAX 24 #define RT_NAME_MAX 24
/* RT_ALIGN_SIZE*/ /* RT_ALIGN_SIZE*/
#define RT_ALIGN_SIZE 8 #define RT_ALIGN_SIZE 8
/* PRIORITY_MAX */ /* PRIORITY_MAX */
#define RT_THREAD_PRIORITY_MAX 32 #define RT_THREAD_PRIORITY_MAX 32
/* Tick per Second */ /* Tick per Second */
#define RT_TICK_PER_SECOND 10000 //0.1ms #define RT_TICK_PER_SECOND 10000 //0.1ms
/* SECTION: RT_DEBUG */ /* SECTION: RT_DEBUG */
/* Thread Debug */ /* Thread Debug */
@ -26,9 +26,9 @@
/* Using Software Timer */ /* Using Software Timer */
/* #define RT_USING_TIMER_SOFT */ /* #define RT_USING_TIMER_SOFT */
#define RT_TIMER_THREAD_PRIO 4 #define RT_TIMER_THREAD_PRIO 4
#define RT_TIMER_THREAD_STACK_SIZE 512 #define RT_TIMER_THREAD_STACK_SIZE 512
#define RT_TIMER_TICK_PER_SECOND 1000 #define RT_TIMER_TICK_PER_SECOND 1000
/* SECTION: IPC */ /* SECTION: IPC */
/* Using Semaphore*/ /* Using Semaphore*/
@ -60,11 +60,11 @@
/* Using Device System */ /* Using Device System */
#define RT_USING_CONSOLE #define RT_USING_CONSOLE
// <string name="RT_CONSOLE_DEVICE_NAME" description="The device name for console" default="uart1" /> // <string name="RT_CONSOLE_DEVICE_NAME" description="The device name for console" default="uart1" />
#define RT_CONSOLE_DEVICE_NAME "uart1" #define RT_CONSOLE_DEVICE_NAME "uart1"
/* SECTION: Console options */ /* SECTION: Console options */
/* the buffer size of console*/ /* the buffer size of console*/
#define RT_CONSOLEBUF_SIZE 512 #define RT_CONSOLEBUF_SIZE 512
/* SECTION: finsh, a C-Express shell */ /* SECTION: finsh, a C-Express shell */
#define RT_USING_FINSH #define RT_USING_FINSH

@ -1,13 +1,13 @@
#include "app_task.h" #include "app_task.h"
int main(void){ int main(void){
/* disable interrupt first */ /* disable interrupt first */
rt_hw_interrupt_disable(); rt_hw_interrupt_disable();
/* startup RT-Thread RTOS */ /* startup RT-Thread RTOS */
rtthread_startup(); rtthread_startup();
return 0; return 0;
} }

@ -82,7 +82,7 @@ static void test_elog(void) {
* @param parameter parameter * @param parameter parameter
*/ */
void sys_init_thread(void* parameter){ void sys_init_thread(void* parameter){
set_system_status(SYSTEM_STATUS_INIT); set_system_status(SYSTEM_STATUS_INIT);
/* initialize EasyFlash and EasyLogger */ /* initialize EasyFlash and EasyLogger */
if ((easyflash_init() == EF_NO_ERR)&&(elog_init() == ELOG_NO_ERR)) { if ((easyflash_init() == EF_NO_ERR)&&(elog_init() == ELOG_NO_ERR)) {

@ -53,7 +53,7 @@ static struct rt_semaphore env_cache_lock;
*/ */
EfErrCode ef_port_init(ef_env const **default_env, size_t *default_env_size) { EfErrCode ef_port_init(ef_env const **default_env, size_t *default_env_size) {
EfErrCode result = EF_NO_ERR; EfErrCode result = EF_NO_ERR;
*default_env = default_env_set; *default_env = default_env_set;
*default_env_size = sizeof(default_env_set) / sizeof(default_env_set[0]); *default_env_size = sizeof(default_env_set) / sizeof(default_env_set[0]);
@ -99,10 +99,10 @@ EfErrCode ef_port_erase(uint32_t addr, size_t size) {
EfErrCode result = EF_NO_ERR; EfErrCode result = EF_NO_ERR;
FLASH_Status flash_status; FLASH_Status flash_status;
size_t erase_pages, i; size_t erase_pages, i;
/* make sure the start address is a multiple of FLASH_ERASE_MIN_SIZE */ /* make sure the start address is a multiple of FLASH_ERASE_MIN_SIZE */
EF_ASSERT(addr % EF_ERASE_MIN_SIZE == 0); EF_ASSERT(addr % EF_ERASE_MIN_SIZE == 0);
/* calculate pages */ /* calculate pages */
erase_pages = size / PAGE_SIZE; erase_pages = size / PAGE_SIZE;
if (size % PAGE_SIZE != 0) { if (size % PAGE_SIZE != 0) {

@ -48,10 +48,10 @@ ElogErrCode elog_port_init(void) {
ElogErrCode result = ELOG_NO_ERR; ElogErrCode result = ELOG_NO_ERR;
rt_sem_init(&output_lock, "elog lock", 1, RT_IPC_FLAG_PRIO); rt_sem_init(&output_lock, "elog lock", 1, RT_IPC_FLAG_PRIO);
#ifdef ELOG_ASYNC_OUTPUT_ENABLE #ifdef ELOG_ASYNC_OUTPUT_ENABLE
rt_thread_t async_thread = NULL; rt_thread_t async_thread = NULL;
rt_sem_init(&output_notice, "elog async", 0, RT_IPC_FLAG_PRIO); rt_sem_init(&output_notice, "elog async", 0, RT_IPC_FLAG_PRIO);
async_thread = rt_thread_create("elog_async", async_output, NULL, 1024, RT_THREAD_PRIORITY_MAX - 1, 10); async_thread = rt_thread_create("elog_async", async_output, NULL, 1024, RT_THREAD_PRIORITY_MAX - 1, 10);

@ -39,20 +39,20 @@ void rt_hw_board_init()
*/ */
static void RCC_Configuration(void) static void RCC_Configuration(void)
{ {
//下面是给各模块开启时钟 //下面是给各模块开启时钟
//启动GPIO //启动GPIO
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | \ RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | \
RCC_APB2Periph_GPIOC | RCC_APB2Periph_GPIOD | \ RCC_APB2Periph_GPIOC | RCC_APB2Periph_GPIOD | \
RCC_APB2Periph_GPIOE | RCC_APB2Periph_GPIOG, RCC_APB2Periph_GPIOE | RCC_APB2Periph_GPIOG,
ENABLE); ENABLE);
//启动AFIO //启动AFIO
RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE); RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);
//启动USART1时钟 //启动USART1时钟
RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE); RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE);
//启动USART2时钟 //启动USART2时钟
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2, ENABLE); RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2, ENABLE);
//启动DMA时钟 //启动DMA时钟
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA1, ENABLE); RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA1, ENABLE);
/* Enable ADC1 and GPIOC clock */ /* Enable ADC1 and GPIOC clock */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, ENABLE); RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, ENABLE);
@ -108,7 +108,7 @@ static void GPIO_Configuration(void)
/** /**
* IWDG_Configuration * IWDG_Configuration
*/ */
static void IWDG_Configuration(void) static void IWDG_Configuration(void)
{ {
IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable); IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable);
IWDG_SetPrescaler(IWDG_Prescaler_64); IWDG_SetPrescaler(IWDG_Prescaler_64);

@ -29,23 +29,23 @@
*/ */
/* board configuration */ /* board configuration */
// <o> SDCard Driver <1=>SDIO sdcard <0=>SPI MMC card // <o> SDCard Driver <1=>SDIO sdcard <0=>SPI MMC card
// <i>Default: 1 // <i>Default: 1
#define STM32_USE_SDIO 0 #define STM32_USE_SDIO 0
/* whether use board external SRAM memory */ /* whether use board external SRAM memory */
// <e>Use external SRAM memory on the board // <e>Use external SRAM memory on the board
// <i>Enable External SRAM memory // <i>Enable External SRAM memory
#define STM32_EXT_SRAM 0 #define STM32_EXT_SRAM 0
// <o>Begin Address of External SRAM // <o>Begin Address of External SRAM
// <i>Default: 0x68000000 // <i>Default: 0x68000000
#define STM32_EXT_SRAM_BEGIN 0x68000000 /* the begining address of external SRAM */ #define STM32_EXT_SRAM_BEGIN 0x68000000 /* the begining address of external SRAM */
// <o>End Address of External SRAM // <o>End Address of External SRAM
// <i>Default: 0x68080000 // <i>Default: 0x68080000
#define STM32_EXT_SRAM_END 0x68080000 /* the end address of external SRAM */ #define STM32_EXT_SRAM_END 0x68080000 /* the end address of external SRAM */
// </e> // </e>
// <o> Internal SRAM memory size[Kbytes] <8-64> // <o> Internal SRAM memory size[Kbytes] <8-64>
// <i>Default: 64 // <i>Default: 64
#define STM32_SRAM_SIZE 64 #define STM32_SRAM_SIZE 64
#define STM32_SRAM_END (SRAM_BASE + STM32_SRAM_SIZE * 1024) #define STM32_SRAM_END (SRAM_BASE + STM32_SRAM_SIZE * 1024)
@ -53,18 +53,18 @@
/* RT_USING_UART */ /* RT_USING_UART */
#define RT_USING_UART1 #define RT_USING_UART1
#define RT_UART_RX_BUFFER_SIZE 64 #define RT_UART_RX_BUFFER_SIZE 64
#define LED_RUN_ON GPIO_SetBits (GPIOA,GPIO_Pin_10) //RUN #define LED_RUN_ON GPIO_SetBits (GPIOA,GPIO_Pin_10) //RUN
#define LED_RUN_OFF GPIO_ResetBits(GPIOA,GPIO_Pin_10) //RUN #define LED_RUN_OFF GPIO_ResetBits(GPIOA,GPIO_Pin_10) //RUN
/*********************************************************************************************************/ /*********************************************************************************************************/
/** MACRO'S */ /** MACRO'S */
/***********************************************************************************************************/ /***********************************************************************************************************/
/***********************************************************************************************************/ /***********************************************************************************************************/
/* DATA TYPES */ /* DATA TYPES */
/***********************************************************************************************************/ /***********************************************************************************************************/

@ -7,15 +7,15 @@
typedef int bool_t; /**< boolean type */ typedef int bool_t; /**< boolean type */
#ifndef TRUE #ifndef TRUE
#define TRUE 1 #define TRUE 1
#endif #endif
#ifndef FALSE #ifndef FALSE
#define FALSE 0 #define FALSE 0
#endif #endif
#ifndef NULL #ifndef NULL
#define NULL 0 #define NULL 0
#endif #endif
#define success 0 #define success 0

@ -1,7 +1,7 @@
/* /*
* File : usart.c * File : usart.c
* This file is part of RT-Thread RTOS * This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006-2013, RT-Thread Development Team * COPYRIGHT (C) 2006-2021, RT-Thread Development Team
* *
* The license and distribution terms for this file may be * The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at * found in the file LICENSE in this distribution or at
@ -155,18 +155,18 @@ static rt_err_t stm32_control(struct rt_serial_device *serial, int cmd, void *ar
if (irq_type == RT_DEVICE_FLAG_INT_RX) if (irq_type == RT_DEVICE_FLAG_INT_RX)
{ {
/* return rx irq flag */ /* return rx irq flag */
return USART_GetFlagStatus(uart->uart_device, USART_FLAG_RXNE); return USART_GetFlagStatus(uart->uart_device, USART_FLAG_RXNE);
} }
else if (irq_type == RT_DEVICE_FLAG_INT_TX) else if (irq_type == RT_DEVICE_FLAG_INT_TX)
{ {
/* return tx flag */ /* return tx flag */
if (uart->tx_irq_type == USART_IT_TC) if (uart->tx_irq_type == USART_IT_TC)
{ {
return USART_GetFlagStatus(uart->uart_device, USART_FLAG_TC); return USART_GetFlagStatus(uart->uart_device, USART_FLAG_TC);
} }
else if (uart->tx_irq_type == USART_IT_TXE) else if (uart->tx_irq_type == USART_IT_TXE)
{ {
return USART_GetFlagStatus(uart->uart_device, USART_FLAG_TXE); return USART_GetFlagStatus(uart->uart_device, USART_FLAG_TXE);
} }
} }
break; break;

@ -49,7 +49,7 @@ ElogErrCode elog_port_init(void) {
#ifdef ELOG_FILE_ENABLE #ifdef ELOG_FILE_ENABLE
elog_file_init(); elog_file_init();
#endif #endif
return result; return result;
} }
@ -65,7 +65,7 @@ void elog_port_output(const char *log, size_t size) {
#ifdef ELOG_FILE_ENABLE #ifdef ELOG_FILE_ENABLE
/* write the file */ /* write the file */
elog_file_write(log, size); elog_file_write(log, size);
#endif #endif
} }
/** /**

@ -35,7 +35,7 @@
*/ */
ElogErrCode elog_flash_port_init(void) { ElogErrCode elog_flash_port_init(void) {
ElogErrCode result = ELOG_NO_ERR; ElogErrCode result = ELOG_NO_ERR;
/* add your code here */ /* add your code here */
return result; return result;
@ -48,25 +48,25 @@ ElogErrCode elog_flash_port_init(void) {
* @param size log size * @param size log size
*/ */
void elog_flash_port_output(const char *log, size_t size) { void elog_flash_port_output(const char *log, size_t size) {
/* add your code here */ /* add your code here */
} }
/** /**
* flash log lock * flash log lock
*/ */
void elog_flash_port_lock(void) { void elog_flash_port_lock(void) {
/* add your code here */ /* add your code here */
} }
/** /**
* flash log unlock * flash log unlock
*/ */
void elog_flash_port_unlock(void) { void elog_flash_port_unlock(void) {
/* add your code here */ /* add your code here */
} }

@ -25,7 +25,7 @@
* Function: Portable interface for each platform. * Function: Portable interface for each platform.
* Created on: 2015-04-28 * Created on: 2015-04-28
*/ */
#include <elog.h> #include <elog.h>
/** /**
@ -37,7 +37,7 @@ ElogErrCode elog_port_init(void) {
ElogErrCode result = ELOG_NO_ERR; ElogErrCode result = ELOG_NO_ERR;
/* add your code here */ /* add your code here */
return result; return result;
} }
@ -58,27 +58,27 @@ void elog_port_deinit(void) {
* @param size log size * @param size log size
*/ */
void elog_port_output(const char *log, size_t size) { void elog_port_output(const char *log, size_t size) {
/* add your code here */ /* add your code here */
} }
/** /**
* output lock * output lock
*/ */
void elog_port_output_lock(void) { void elog_port_output_lock(void) {
/* add your code here */ /* add your code here */
} }
/** /**
* output unlock * output unlock
*/ */
void elog_port_output_unlock(void) { void elog_port_output_unlock(void) {
/* add your code here */ /* add your code here */
} }
/** /**
@ -87,9 +87,9 @@ void elog_port_output_unlock(void) {
* @return current time * @return current time
*/ */
const char *elog_port_get_time(void) { const char *elog_port_get_time(void) {
/* add your code here */ /* add your code here */
} }
/** /**
@ -98,9 +98,9 @@ const char *elog_port_get_time(void) {
* @return current process name * @return current process name
*/ */
const char *elog_port_get_p_info(void) { const char *elog_port_get_p_info(void) {
/* add your code here */ /* add your code here */
} }
/** /**
@ -109,7 +109,7 @@ const char *elog_port_get_p_info(void) {
* @return current thread name * @return current thread name
*/ */
const char *elog_port_get_t_info(void) { const char *elog_port_get_t_info(void) {
/* add your code here */ /* add your code here */
} }

@ -211,7 +211,7 @@ void elog_deinit(void) {
if (!elog.init_ok) { if (!elog.init_ok) {
return ; return ;
} }
#ifdef ELOG_ASYNC_OUTPUT_ENABLE #ifdef ELOG_ASYNC_OUTPUT_ENABLE
elog_async_deinit(); elog_async_deinit();
#endif #endif
@ -230,7 +230,7 @@ void elog_start(void) {
if (!elog.init_ok) { if (!elog.init_ok) {
return ; return ;
} }
/* enable output */ /* enable output */
elog_set_output_enabled(true); elog_set_output_enabled(true);
@ -280,7 +280,7 @@ void elog_set_output_enabled(bool enabled) {
#ifdef ELOG_COLOR_ENABLE #ifdef ELOG_COLOR_ENABLE
/** /**
* set log text color enable or disable * set log text color enable or disable
* *
* @param enabled TRUE: enable FALSE:disable * @param enabled TRUE: enable FALSE:disable
*/ */
void elog_set_text_color_enabled(bool enabled) { void elog_set_text_color_enabled(bool enabled) {
@ -363,7 +363,7 @@ void elog_set_filter_kw(const char *keyword) {
} }
/** /**
* lock output * lock output
*/ */
void elog_output_lock(void) { void elog_output_lock(void) {
if (elog.output_lock_enabled) { if (elog.output_lock_enabled) {

@ -374,7 +374,7 @@ void elog_async_deinit(void) {
elog_async_output_notice(); elog_async_output_notice();
pthread_join(async_output_thread, NULL); pthread_join(async_output_thread, NULL);
sem_destroy(&output_notice); sem_destroy(&output_notice);
#endif #endif

Loading…
Cancel
Save