WIP: Added debug and delay code.

This commit is contained in:
2024-05-06 21:01:37 +02:00
parent f389cd5506
commit bf53194a1d
2 changed files with 30 additions and 1 deletions

View File

@@ -5,5 +5,15 @@ add_library(mfrc522 STATIC
mfrc522_rp2040_integration.c
${SRC}/driver_mfrc522.c
)
target_link_libraries(mfrc522
pico_stdlib
pico_time
hardware_gpio
hardware_i2c
hardware_spi
hardware_uart
)
target_include_directories(mfrc522 PUBLIC ${SRC})
target_include_directories(mfrc522 PUBLIC ${INTERFACE})

View File

@@ -34,6 +34,13 @@
* </table>
*/
#include <stdio.h>
#include <pico/stdlib.h>
#ifndef NO_DEBUG
#include <stdarg.h>
#endif
#include "driver_mfrc522_interface.h"
/**
@@ -254,7 +261,7 @@ uint8_t mfrc522_interface_uart_flush(void)
*/
void mfrc522_interface_delay_ms(uint32_t ms)
{
sleep_ms(ms);
}
/**
@@ -264,7 +271,19 @@ void mfrc522_interface_delay_ms(uint32_t ms)
*/
void mfrc522_interface_debug_print(const char *const fmt, ...)
{
#ifndef NO_DEBUG
char str[256];
uint16_t len;
va_list args;
memset((char *)str, 0, sizeof(char) * 256);
va_start(args, fmt);
vsnprintf((char *)str, 255, (char const *)fmt, args);
va_end(args);
len = strlen((char *)str);
(void)printf((uint8_t *)str, len);
#endif
}
/**