/*
 * utils.h
 *
 *  Created on: Apr 10, 2021
 *      Author: xavie
 */

#ifndef INC_UTILS_H_
#define INC_UTILS_H_

#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <stdbool.h>
#include <ctype.h>

#include "stm32_adv_trace.h"

/**
  * @brief  it calls UTIL_ADV_TRACE_VSNPRINTF
  */
void tiny_snprintf_like(char *buf, uint32_t maxsize, const char *strFormat, ...);

int8_t isAnyError();
int8_t addErrorToList( uint16_t code );
void clearErrorList();
int8_t findErrorByNo( uint16_t code );
uint16_t findErrorById( int8_t id );
void deleteErrorByNo( uint16_t code );
void deleteErrorById( int8_t id );

void substring(char s[], char sub[], int startIndex, int endIndex );
int toInt( char in[], int startIndex, int endIndex );
int toIntLen( char in[], int length );
long toLongLen( char in[], int length );
float toFloat( char in[], int startIndex, int endIndex );
bool toBool( char in[], int startIndex );


#endif /* INC_UTILS_H_ */
