ESP8266 ILI9341 display support code with printf sources, wire-frame viewer and custom fonts  1.0
ESP8266ILI9341DisplayProject
tft_printf.c
Go to the documentation of this file.
1 
23 #include "user_config.h"
24 
25 #include <stdint.h>
26 #include <stdarg.h>
27 #include <string.h>
28 #include <math.h>
29 
30 #include "display/ili9341.h"
31 #include "display/tft_printf.h"
32 #include "printf/mathio.h"
33 
34 static void _putc_win(struct _printf_t *p, char ch)
35 {
36  p->sent++;
37  tft_putch((window *) p->buffer, ch);
38 }
39 
40 static void _putc_win_len(struct _printf_t *p, char ch)
41 {
42  p->sent++;
43  tft_putch((window *) p->buffer, ch);
44 }
45 
52 int tft_printf(window *win, const char *fmt, ... )
53 {
54  _fontc f;
55  printf_t fn;
56 
57  fn.put = _putc_win;
58  fn.sent = 0;
59  fn.buffer = (void *) win;
60 
61  va_list va;
62  va_start(va, fmt);
63 
64  _printf_fn(&fn, fmt, va);
65 
66  va_end(va);
67 
68  return(fn.sent);
69 
70 }
71 
72 
Master include file for project Includes all project includes and defines here.
MEMSPACE void _printf_fn(printf_t *fn, __memx const char *fmt, va_list va)
vsnprintf function
Definition: printf.c:741
static void _putc_win(struct _printf_t *p, char ch)
Definition: tft_printf.c:34
Math IO functions, and verious conversion code with floating point support.
void * buffer
Definition: mathio.h:84
static void _putc_win_len(struct _printf_t *p, char ch)
Definition: tft_printf.c:40
#define MEMSPACE
Definition: cpu.h:25
Definition: ili9341.h:34
ili9341 driver inspired by Adafruit ili9341 code All code in this file has been rewritten by Mike Gor...
int sent
Definition: mathio.h:86
MEMSPACE int tft_printf(window *win, const char *fmt,...)
tft_printf function
Definition: tft_printf.c:52
Definition: font.h:89
void(* put)(struct _printf_t *, char)
Definition: mathio.h:83
printf wrapper for ili9341 drivers
void tft_putch(window *win, int c)
put character in current winoow
Definition: ili9341.c:1643
undefine any potential macro version of these functions
Definition: mathio.h:81