Improvements:

- HAL re-organized
- FreeRTOS running stable
- UART finished
- SPI1 & SPI3 finished and functional
- Display driver added (functional)


git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@172 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
mmi
2017-09-20 06:51:53 +00:00
parent f5dd9e0f09
commit c9562e8bfd
313 changed files with 8279 additions and 50216 deletions

View File

@@ -0,0 +1,136 @@
// -----------------------------------------------------------------------------
/// @file Logger.h
/// @brief File description
// -----------------------------------------------------------------------------
// Micro-Key bv
// Industrieweg 28, 9804 TG Noordhorn
// Postbus 92, 9800 AB Zuidhorn
// The Netherlands
// Tel: +31 594 503020
// Fax: +31 594 505825
// Email: support@microkey.nl
// Web: www.microkey.nl
// -----------------------------------------------------------------------------
/// $Revision: 167 $
/// $Author: mmi $
/// $Date: 2017-09-12 13:09:10 +0200 (di, 12 sep 2017) $
// (c) 2017 Micro-Key bv
// -----------------------------------------------------------------------------
/// @defgroup {group_name} {group_description}
/// Description
/// @file Logger.h
/// @ingroup {group_name}
#ifndef _LOGGER_H_
#define _LOGGER_H_
// -----------------------------------------------------------------------------
// Include files
// -----------------------------------------------------------------------------
#include "stm32f10x.h"
// -----------------------------------------------------------------------------
// Constant and macro definitions
// -----------------------------------------------------------------------------
/**
* Logs an error
* \memberof Logger
*/
#define LOGGER_ERROR(...) \
Logger_log(__FILE__, __func__, __LINE__, LOGTYPE_ERROR, ##__VA_ARGS__)
#define LOGGER_WARNING(...) \
Logger_log(__FILE__, __func__, __LINE__, LOGTYPE_WARNING, ##__VA_ARGS__)
#define LOGGER_INFO(...) \
Logger_log(__FILE__, __func__, __LINE__, LOGTYPE_INFO, ##__VA_ARGS__)
#define LOGGER_DEBUG(...) \
Logger_log(__FILE__, __func__, __LINE__, LOGTYPE_DEBUG, ##__VA_ARGS__)
#define LOGGER_PRINT(...) \
Logger_log("", "", 0, LOGTYPE_PRINT, ##__VA_ARGS__)
#define LOGGER_ERROR_ISR(...) \
Logger_logISR(__FILE__, __func__, __LINE__, LOGTYPE_ERROR, ##__VA_ARGS__)
#define LOGGER_WARNING_ISR(...) \
Logger_logISR(__FILE__, __func__, __LINE__, LOGTYPE_WARNING, ##__VA_ARGS__)
#define LOGGER_INFO_ISR(...) \
Logger_logISR(__FILE__, __func__, __LINE__, LOGTYPE_INFO, ##__VA_ARGS__)
#define LOGGER_DEBUG_ISR(...) \
Logger_logISR(__FILE__, __func__, __LINE__, LOGTYPE_DEBUG, ##__VA_ARGS__)
#define LOGGER_PRINT_ISR(...) \
Logger_logISR("", "", 0, LOGTYPE_PRINT, ##__VA_ARGS__)
// -----------------------------------------------------------------------------
// Type definitions.
// -----------------------------------------------------------------------------
typedef enum
{
LOGTYPE_PRINT, /**< Raw print */
LOGTYPE_DEBUG, /**< Debug information only; will not be stored on SD-card */
LOGTYPE_INFO, /**< Informational messages of important events */
LOGTYPE_WARNING, /**< Recoverable fault */
LOGTYPE_ERROR /**< Unrecoverable fault */
} LogType;
typedef enum
{
FATALCODE_STACKOVERFLOW = 0x11,
FATALCODE_MALLOCFAILED = 0x12,
FATALCODE_USBCOMQUEUE = 0x13,
FATALCODE_LOGGERINITFAILED = 0x14,
FATALCODE_LOGGERQUEUEFAILED = 0x15,
FATALCODE_ADCOVERFLOW = 0x16,
FATALCODE_HIDQUEUETIMEOUT = 0x17,
FATALCODE_OUTPUTACTIONSQUEUETIMEOUT = 0x18,
FATALCODE_RNETQUEUEFAILED = 0x19,
FATALCODE_TEST2 = 0xFE,
FATALCODE_TEST = 0xFF
} FatalCode;
struct LogQueueItem
{
char fileName[32];
char functionName[32];
char context[128];
int lineNumber;
LogType logType;
};
// -----------------------------------------------------------------------------
// Function declarations
// -----------------------------------------------------------------------------
void Logger_initialize(void* const interface);
void Logger_terminate(void);
void Logger_logISR(const char* fileName, const char* functionName, int lineNumber, LogType logType, const char* context);
void Logger_fatal(FatalCode code);
ErrorStatus Logger_addCommandHandlers(void);
ErrorStatus Logger_logModuleInfo(void);
/**
* Logs a string.
* Use the Logging macros instead
* \memberof Logger
* \private
* \param fileName File name to be logged
* \param functionName Function name to be logged
* \param lineNumber Line number to be logged
* \param logType Type of logging
* \param format printf-type formatting string
* \param ... Variable arguments according to the formatting string
*/
void Logger_log(const char* fileName, const char* functionName, int lineNumber, LogType logType, const char* format, ...) __attribute__((format(printf, 5, 6)));
#endif