Initial public release of SystemK.
This commit is contained in:
parent
387f57cdda
commit
6f51f5b006
129 changed files with 11654 additions and 2 deletions
29
Logging/KLog.c
Executable file
29
Logging/KLog.c
Executable file
|
@ -0,0 +1,29 @@
|
|||
|
||||
/*
|
||||
* This program source code file is part of SystemK, a library in the KTag project.
|
||||
*
|
||||
* 🛡️ <https://ktag.clubk.club> 🃞
|
||||
*
|
||||
* Copyright © 2016-2025 Joseph P. Kearney and the KTag developers.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License as published by the Free
|
||||
* Software Foundation, either version 3 of the License, or (at your option) any
|
||||
* later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* There should be a copy of the GNU Affero General Public License in the LICENSE
|
||||
* file in the root of this repository. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "SystemK.h"
|
||||
|
||||
#ifdef PSOC_PLATFORM
|
||||
char8 KLog_Buffer[MAX_KLOG_STRING_LENGTH];
|
||||
#endif // PSOC_PLATFORM
|
95
Logging/KLog.h
Executable file
95
Logging/KLog.h
Executable file
|
@ -0,0 +1,95 @@
|
|||
|
||||
/*
|
||||
* This program source code file is part of SystemK, a library in the KTag project.
|
||||
*
|
||||
* 🛡️ <https://ktag.clubk.club> 🃞
|
||||
*
|
||||
* Copyright © 2016-2025 Joseph P. Kearney and the KTag developers.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Affero General Public License as published by the Free
|
||||
* Software Foundation, either version 3 of the License, or (at your option) any
|
||||
* later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
* details.
|
||||
*
|
||||
* There should be a copy of the GNU Affero General Public License in the LICENSE
|
||||
* file in the root of this repository. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifdef ESP_PLATFORM
|
||||
|
||||
#include <esp_log.h>
|
||||
|
||||
#define KLOG_ERROR(tag, format, ...) ESP_LOGE(tag, format, ##__VA_ARGS__)
|
||||
#define KLOG_WARN(tag, format, ...) ESP_LOGW(tag, format, ##__VA_ARGS__)
|
||||
#define KLOG_INFO(tag, format, ...) ESP_LOGI(tag, format, ##__VA_ARGS__)
|
||||
#define KLOG_DEBUG(tag, format, ...) ESP_LOGD(tag, format, ##__VA_ARGS__)
|
||||
#define KLOG_TRACE(tag, format, ...) ESP_LOGV(tag, format, ##__VA_ARGS__)
|
||||
|
||||
#endif // ESP_PLATFORM
|
||||
|
||||
#ifdef PSOC_PLATFORM
|
||||
|
||||
/* Include PSoC system and component APIs and defines */
|
||||
#include <project.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define MAX_KLOG_STRING_LENGTH (255)
|
||||
extern char8 KLog_Buffer[MAX_KLOG_STRING_LENGTH];
|
||||
|
||||
#define KLOG_ERROR(tag, format, ...) \
|
||||
do \
|
||||
{ \
|
||||
UART_Console_PutString("ERROR ["); \
|
||||
UART_Console_PutString(tag); \
|
||||
UART_Console_PutString("] "); \
|
||||
sprintf((char8 *)KLog_Buffer, format, ##__VA_ARGS__); \
|
||||
UART_Console_PutString((const char8 *)KLog_Buffer); \
|
||||
UART_Console_PutString("\n"); \
|
||||
} while (false)
|
||||
#define KLOG_WARN(tag, format, ...) \
|
||||
do \
|
||||
{ \
|
||||
UART_Console_PutString("WARN ["); \
|
||||
UART_Console_PutString(tag); \
|
||||
UART_Console_PutString("] "); \
|
||||
sprintf((char8 *)KLog_Buffer, format, ##__VA_ARGS__); \
|
||||
UART_Console_PutString((const char8 *)KLog_Buffer); \
|
||||
UART_Console_PutString("\n"); \
|
||||
} while (false)
|
||||
#define KLOG_INFO(tag, format, ...) \
|
||||
do \
|
||||
{ \
|
||||
UART_Console_PutString("INFO ["); \
|
||||
UART_Console_PutString(tag); \
|
||||
UART_Console_PutString("] "); \
|
||||
sprintf((char8 *)KLog_Buffer, format, ##__VA_ARGS__); \
|
||||
UART_Console_PutString((const char8 *)KLog_Buffer); \
|
||||
UART_Console_PutString("\n"); \
|
||||
} while (false)
|
||||
#define KLOG_DEBUG(tag, format, ...) \
|
||||
do \
|
||||
{ \
|
||||
UART_Console_PutString("DEBUG ["); \
|
||||
UART_Console_PutString(tag); \
|
||||
UART_Console_PutString("] "); \
|
||||
sprintf((char8 *)KLog_Buffer, format, ##__VA_ARGS__); \
|
||||
UART_Console_PutString((const char8 *)KLog_Buffer); \
|
||||
UART_Console_PutString("\n"); \
|
||||
} while (false)
|
||||
#define KLOG_TRACE(tag, format, ...) \
|
||||
do \
|
||||
{ \
|
||||
UART_Console_PutString("TRACE ["); \
|
||||
UART_Console_PutString(tag); \
|
||||
UART_Console_PutString("] "); \
|
||||
sprintf((char8 *)KLog_Buffer, format, ##__VA_ARGS__); \
|
||||
UART_Console_PutString((const char8 *)KLog_Buffer); \
|
||||
UART_Console_PutString("\n"); \
|
||||
} while (false)
|
||||
|
||||
#endif // PSOC_PLATFORM
|
Loading…
Add table
Add a link
Reference in a new issue