20#ifndef FLASH_UTILS_ARCH_H
21#define FLASH_UTILS_ARCH_H
25#include <avr/pgmspace.h>
35#define FLASH_ATTR __flash
37#define TO_FLASH(x) __extension__({static FLASH_ATTR const char __c[] = (x); &__c[0];})
41 return strcmp_P(ram, (
const char *)flash);
46 return strncmp_P(ram, (
const char *)flash, n);
51 return strlen_P((
const char *)flash);
56 return strcpy_P(ram, (
const char *)flash);
61 return strncpy_P(ram, (
const char *)flash, n);
69 return vfprintf_P(stdout, (
const char *)flash, args);
75 return vfprintf_P(stream, (
const char *)flash, args);
81 return vsnprintf_P(buf, buf_len, (
const char *)flash, args);
86 puts_P((
const char *)flash);
92 return memcpy_P(dest, (
const void *)src, n);
int flash_snprintf(char *buf, size_t buf_len, FLASH_ATTR const char *flash,...)
Like snprintf(), but the format string resides in flash.
int flash_vfprintf(FILE *stream, FLASH_ATTR const char *flash, va_list args)
Like vfprintf(), but the format string resides in flash.
char * flash_strcpy(char *ram, FLASH_ATTR const char *flash)
Like strcpy(), but the source flash resides in flash.
int flash_strncmp(const char *ram, FLASH_ATTR const char *flash, size_t n)
Like strncmp(), but the first string resides in flash.
#define FLASH_ATTR
C type qualifier required to place a variable in flash.
int flash_strcmp(const char *ram, FLASH_ATTR const char *flash)
Like strcmp(), but the second string resides in flash.
int flash_vprintf(FLASH_ATTR const char *flash, va_list args)
Like vprintf(), but the format string resides in flash.
int flash_fprintf(FILE *stream, FLASH_ATTR const char *flash,...)
Like fprintf(), but the format string resides in flash.
int flash_printf(FLASH_ATTR const char *flash,...)
Like printf(), but the format string resides in flash.
char * flash_strncpy(char *ram, FLASH_ATTR const char *flash, size_t n)
Like strncpy(), but the source flash resides in flash.
int flash_vsnprintf(char *buf, size_t buf_len, FLASH_ATTR const char *flash, va_list args)
Like vsnprintf(), but the format string resides in flash.
size_t flash_strlen(FLASH_ATTR const char *flash)
Like strlen(), but the string resides in flash.
void flash_puts(FLASH_ATTR const char *flash)
Like puts(), but the string resides in flash.
void * flash_memcpy(void *dest, FLASH_ATTR const void *src, size_t n)
Like memcpy(), but src resides in flash.
stdio wrapper to extend the C libs stdio