FastArduino v1.10
C++ library to build fast but small Arduino/AVR projects
Loading...
Searching...
No Matches
flash.h File Reference

Flash memory utilities. More...

#include "boards/io.h"
#include <avr/pgmspace.h>
Include dependency graph for flash.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  flash::FlashReader< T >
 Functor reading items from an address in AVR Flash memory (PROGMEM). More...
 

Namespaces

namespace  flash
 Defines API to handle flash memory storage.
 

Macros

#define F(ptr)
 Force string constant to be stored as flash storage. More...
 

Functions

template<typename T = uint8_t>
T * flash::read_flash (uint16_t address, T *buffer, uint8_t size)
 Read flash memory content at given address into buffer. More...
 
template<typename T >
T & flash::read_flash (uint16_t address, T &item)
 Read flash memory content at given address into item. More...
 
template<typename T >
T & flash::read_flash (const T *address, T &item)
 Read flash memory content at given address into item. More...
 

Detailed Description

Flash memory utilities.

Definition in file flash.h.

Macro Definition Documentation

◆ F

#define F (   ptr)
Value:
(__extension__({ \
static const char __c[] PROGMEM = (ptr); \
(const flash::FlashStorage*) &__c[0]; \
}))

Force string constant to be stored as flash storage.

Here is a classical usage here:

char buffer[64];
streams::ostreambuf out{buffer};
out << F("Hello, world!\n");
Output API based on a ring buffer.
Definition: streambuf.h:96
#define F(ptr)
Force string constant to be stored as flash storage.
Definition: flash.h:150
Parameters
ptrthe string to be automatically stored on flash
See also
streams::ostreambuf::sputn(const flash::FlashStorage*)

Definition at line 150 of file flash.h.