Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions cpu/src/api/freetribe.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,12 @@ under the terms of the GNU Affero General Public License as published by

/*----- Includes -----------------------------------------------------*/

#define TINYPRINTF_DEFINE_TFP_PRINTF 0
#define TINYPRINTF_OVERRIDE_LIBC 0
#include "utils/tinyprintf.h"
#include "freetribe.h"
#include <stdint.h>
#include <stdarg.h>

/*----- Macros -------------------------------------------------------*/

Expand Down Expand Up @@ -133,6 +137,20 @@ void ft_register_print_callback(void (*callback)(char *)) {
*/
void ft_print(char *text) { svc_midi_send_string(text); }

/**
* @brief Literally printf girl
*/
void ft_printf(const char *format, ...)
{
va_list ap;
static char str[256];

va_start(ap, format);
tfp_vsprintf(str, format, ap);
svc_midi_send_string(str);
va_end(ap);
}

// Panel API
//
/**
Expand Down
1 change: 1 addition & 0 deletions cpu/src/api/freetribe.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ int8_t ft_fill_frame(uint16_t x_start, uint16_t y_start, uint16_t x_end,

void ft_register_print_callback(void (*callback)(char *));
void ft_print(char *text);
void ft_printf(const char *format, ...);

void ft_register_midi_callback(event_type event,
t_midi_event_callback callback);
Expand Down
Loading