mqtt client release v1.1.0 ...
This commit is contained in:
@@ -2,14 +2,14 @@
|
||||
* @Author: jiejie
|
||||
* @Github: https://github.com/jiejieTop
|
||||
* @Date: 2019-12-27 23:10:36
|
||||
* @LastEditTime : 2020-01-16 00:37:56
|
||||
* @Description: the code belongs to jiejie, please keep the author information and source code according to the license.
|
||||
* @LastEditTime: 2020-06-17 15:22:56
|
||||
* @Description: the code belongs to jiejie, please keep the author insalof_formation and source code according to the license.
|
||||
*/
|
||||
/** synchronous asynchronous log output framework */
|
||||
|
||||
#include "salof.h"
|
||||
|
||||
#ifdef USE_LOG
|
||||
#ifdef SALOF_USING_LOG
|
||||
|
||||
#ifndef SALOF_BUFF_SIZE
|
||||
#define SALOF_BUFF_SIZE (1024U)
|
||||
@@ -20,13 +20,13 @@
|
||||
|
||||
static int salof_out(char *buf, int len);
|
||||
|
||||
#if USE_SALOF
|
||||
#if SALOF_USING_SALOF
|
||||
#include <string.h>
|
||||
static fifo_t _salof_fifo = NULL;
|
||||
static salof_fifo_t _salof_fifo = NULL;
|
||||
static int _len;
|
||||
static char _out_buff[SALOF_BUFF_SIZE];
|
||||
|
||||
#if !USE_IDLE_HOOK
|
||||
#if !SALOF_USING_IDLE_HOOK
|
||||
static salof_tcb _salof_task;
|
||||
void salof_task(void *parm);
|
||||
#else
|
||||
@@ -38,16 +38,16 @@ void salof_task(void *parm);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static char _format_buff[SALOF_BUFF_SIZE];
|
||||
static char _salof_format_buff[SALOF_BUFF_SIZE];
|
||||
|
||||
int salof_init(void)
|
||||
{
|
||||
#if USE_SALOF
|
||||
_salof_fifo = fifo_create(SALOF_FIFO_SIZE);
|
||||
#if SALOF_USING_SALOF
|
||||
_salof_fifo = salof_fifo_create(SALOF_FIFO_SIZE);
|
||||
if(_salof_fifo == NULL)
|
||||
return -1;
|
||||
|
||||
#if !USE_IDLE_HOOK
|
||||
#if !SALOF_USING_IDLE_HOOK
|
||||
_salof_task = salof_task_create("salof_task", salof_task, NULL, SALOF_TASK_STACK_SIZE, SALOF_TASK_PRIO, SALOF_TASK_TICK);
|
||||
if(_salof_task == NULL)
|
||||
return -1;
|
||||
@@ -63,15 +63,15 @@ void salof(const char *fmt, ...)
|
||||
int len;
|
||||
va_start(args, fmt);
|
||||
|
||||
len = format_nstr(_format_buff, SALOF_BUFF_SIZE - 1, fmt, args);
|
||||
len = salof_format_nstr(_salof_format_buff, SALOF_BUFF_SIZE - 1, fmt, args);
|
||||
|
||||
if(len > SALOF_BUFF_SIZE)
|
||||
len = SALOF_BUFF_SIZE - 1;
|
||||
|
||||
#if USE_SALOF
|
||||
fifo_write(_salof_fifo, _format_buff, len, 100);
|
||||
#if SALOF_USING_SALOF
|
||||
salof_fifo_write(_salof_fifo, _salof_format_buff, len, 100);
|
||||
#else
|
||||
salof_out(_format_buff, len);
|
||||
salof_out(_salof_format_buff, len);
|
||||
#endif
|
||||
|
||||
va_end(args);
|
||||
@@ -82,10 +82,10 @@ static int salof_out(char *buf, int len)
|
||||
return send_buff(buf, len);
|
||||
}
|
||||
|
||||
#if USE_SALOF
|
||||
#if SALOF_USING_SALOF
|
||||
void salof_handler( void )
|
||||
{
|
||||
_len = fifo_read(_salof_fifo, _out_buff, sizeof(_out_buff), 0);
|
||||
_len = salof_fifo_read(_salof_fifo, _out_buff, sizeof(_out_buff), 0);
|
||||
if(_len > 0) {
|
||||
salof_out((char *)_out_buff, _len);
|
||||
memset(_out_buff, 0, _len);
|
||||
@@ -93,13 +93,13 @@ void salof_handler( void )
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !USE_IDLE_HOOK
|
||||
#if !SALOF_USING_IDLE_HOOK
|
||||
void salof_task(void *parm)
|
||||
{
|
||||
(void)parm;
|
||||
while(1)
|
||||
{
|
||||
#if USE_SALOF
|
||||
#if SALOF_USING_SALOF
|
||||
salof_handler();
|
||||
#endif
|
||||
}
|
||||
|
Reference in New Issue
Block a user