WIP: Added debug and delay code.
This commit is contained in:
10
third_party/mfrc522_integration/CMakeLists.txt
vendored
10
third_party/mfrc522_integration/CMakeLists.txt
vendored
@@ -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})
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user