FastArduino  v1.7
C++ library to build fast but small Arduino/AVR projects
defines.h File Reference

Useful defines GCC specific attributes. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define NOP()   __asm__ __volatile__("nop")
 Utility to produce a nop instruction in generated code, as a way to debug (and optimize) generated assembly code from C++ source.
 
#define UNUSED   __attribute__((unused))
 Specific GCC attribute to declare an argument or variable unused, so that the compiler does not emit any warning. More...
 
#define INLINE   __attribute__((always_inline))
 Specific GCC attribute to force the compiler to always inline code of a given function. More...
 
#define SIGNAL   __attribute__ ((signal))
 Specific GCC attribute for AVR target, declaring a function as a signal handler (aka ISR, or Interrupt Service Routine). More...
 
#define NAKED_SIGNAL   __attribute__((signal, naked, __INTR_ATTRS))
 Specific GCC attribute for AVR target, declaring a signal handler (aka ISR, or Interrupt Service Routine) as an empty function. More...
 
#define WEAK   __attribute__((weak))
 Specific GCC attribute to declare a function as weakly linked, which makes it a default implementation that can be overwritten by simply redefining it without that attribute. More...
 

Detailed Description

Useful defines GCC specific attributes.

Definition in file defines.h.

Macro Definition Documentation

◆ UNUSED

#define UNUSED   __attribute__((unused))

Specific GCC attribute to declare an argument or variable unused, so that the compiler does not emit any warning.

static void set_mode(UNUSED PinMode mode, UNUSED bool value = false) {}
FastPin(PinMode mode UNUSED, bool value UNUSED = false) INLINE {}
static void constraints(T* p)
{
UNUSED B* pb = p;
}

Definition at line 45 of file defines.h.

◆ INLINE

#define INLINE   __attribute__((always_inline))

Specific GCC attribute to force the compiler to always inline code of a given function.

void set_PORT(uint8_t port) INLINE {...}
LinkedListImpl() INLINE = default;

Definition at line 57 of file defines.h.

◆ SIGNAL

#define SIGNAL   __attribute__ ((signal))

Specific GCC attribute for AVR target, declaring a function as a signal handler (aka ISR, or Interrupt Service Routine).

You will never need to use it in your programs as all ISR for a target are declared by FastArduino in header files in fastarduino/board directory and get automatically included as soon as you use FastArduino in your project.

extern "C" {
void INT0_vect(void) SIGNAL;
}

Definition at line 78 of file defines.h.

◆ NAKED_SIGNAL

#define NAKED_SIGNAL   __attribute__((signal, naked, __INTR_ATTRS))

Specific GCC attribute for AVR target, declaring a signal handler (aka ISR, or Interrupt Service Routine) as an empty function.

This is used when enabling an interrupt only to awaken the MCU but with no further processing of the interrupt; this ensures more compact code generation.

You will normally never need to use it in your programs as FastArduino provides regsitration macros for empty ISR. You just have to call the proper macro(s) once in your program.

See also
REGISTER_INT_ISR_EMPTY(INT_NUM, PIN)
REGISTER_PCI_ISR_EMPTY(PCI_NUM, PIN, ...)
REGISTER_TIMER_COMPARE_ISR_EMPTY(TIMER_NUM)
REGISTER_TIMER_OVERFLOW_ISR_EMPTY(TIMER_NUM)
REGISTER_TIMER_CAPTURE_ISR_EMPTY(TIMER_NUM)

Definition at line 96 of file defines.h.

◆ WEAK

#define WEAK   __attribute__((weak))

Specific GCC attribute to declare a function as weakly linked, which makes it a default implementation that can be overwritten by simply redefining it without that attribute.

// In FastArduino main.cpp
int main() WEAK;
int main()
{
return 0;
}
// In another source file: this code will replace the default code defined in main.cpp
int main()
{
// Actual stuff...
}

Definition at line 118 of file defines.h.

WEAK
#define WEAK
Specific GCC attribute to declare a function as weakly linked, which makes it a default implementatio...
Definition: defines.h:118
SIGNAL
#define SIGNAL
Specific GCC attribute for AVR target, declaring a function as a signal handler (aka ISR,...
Definition: defines.h:78
UNUSED
#define UNUSED
Specific GCC attribute to declare an argument or variable unused, so that the compiler does not emit ...
Definition: defines.h:45
gpio::PinMode
PinMode
Defines the configurable mode of a digital IO pin.
Definition: gpio.h:60
INLINE
#define INLINE
Specific GCC attribute to force the compiler to always inline code of a given function.
Definition: defines.h:57