Hanna
Sourcecode Batteriemanagementsystem
Makrodefinitionen
Atmel part identification macros
Zusammengehörigkeiten von Atmel part identification macros:

Makrodefinitionen

#define __always_inline   inline __attribute__((__always_inline__))
 The function should always be inlined. Mehr ...
 
#define nop()   do { __asm__ __volatile__ ("nop"); } while (0)
 

Convenience macros for part checking

#define AVR8_PART_IS_DEFINED(part)   (defined(__ ## part ## __) || defined(__AVR_ ## part ## __))
 

AVR XMEGA AU series

#define XMEGA_A3U
 
#define XMEGA_A3BU
 

AVR XMEGA families

#define XMEGA_AU   (XMEGA_A1U || XMEGA_A3U || XMEGA_A3BU || XMEGA_A4U)
 
#define XMEGA   (XMEGA_A || XMEGA_AU || XMEGA_B || XMEGA_C || XMEGA_D || XMEGA_E)
 

Usual Constants

#define DISABLE   0
 
#define ENABLE   1
 
#define false   0
 
#define true   1
 
#define PASS   0
 
#define FAIL   1
 
#define LOW   0
 
#define HIGH   1
 

Optimisation Control

#define __always_optimize   __attribute__((optimize(3)))
 The function should always be optimized. Mehr ...
 

Mathematics

Compiler optimization for non-constant expressions, only for abs under WinAVR

#define Abs(a)    (((a) < 0 ) ? -(a) : (a))
 Takes the absolute value of a. Mehr ...
 
#define Min(a, b)    (((a) < (b)) ? (a) : (b))
 Takes the minimal value of a and b. Mehr ...
 
#define min(a, b)    Min(a, b)
 
#define Max(a, b)    (((a) > (b)) ? (a) : (b))
 Takes the maximal value of a and b. Mehr ...
 
#define max(a, b)    Max(a, b)
 

MCU Endianism Handling

xmega is a MCU little endianism.

#define MSB(u16)    (((uint8_t* )&u16)[1])
 
#define LSB(u16)    (((uint8_t* )&u16)[0])
 
#define Swap16(u16)   ((uint16_t)(((uint16_t)(u16) >> 8) | ((uint16_t)(u16) << 8)))
 Toggles the endianism of u16 (by swapping its bytes). Mehr ...
 

Ausführliche Beschreibung

This collection of macros identify which series and families that the various Atmel parts belong to. These can be used to select part-dependent sections of code at compile time.

Makro-Dokumentation

#define __always_inline   inline __attribute__((__always_inline__))

The function should always be inlined.

This annotation instructs the compiler to ignore its inlining heuristics and inline the function no matter how big it thinks it becomes.

Definiert in Zeile 127 der Datei compiler.h.

#define __always_optimize   __attribute__((optimize(3)))

The function should always be optimized.

This annotation instructs the compiler to ignore global optimization settings and always compile the function with a high level of optimization.

Definiert in Zeile 140 der Datei compiler.h.

#define Abs (   a)    (((a) < 0 ) ? -(a) : (a))

Takes the absolute value of a.

Parameter
aInput value.
Rückgabe
Absolute value of a.
Zu beachten
More optimized if only used with values known at compile time.

Definiert in Zeile 158 der Datei compiler.h.

#define Max (   a,
 
)    (((a) > (b)) ? (a) : (b))

Takes the maximal value of a and b.

Parameter
aInput value.
bInput value.
Rückgabe
Maximal value of a and b.
Zu beachten
More optimized if only used with values known at compile time.

Definiert in Zeile 181 der Datei compiler.h.

#define Min (   a,
 
)    (((a) < (b)) ? (a) : (b))

Takes the minimal value of a and b.

Parameter
aInput value.
bInput value.
Rückgabe
Minimal value of a and b.
Zu beachten
More optimized if only used with values known at compile time.

Definiert in Zeile 169 der Datei compiler.h.

#define Swap16 (   u16)    ((uint16_t)(((uint16_t)(u16) >> 8) | ((uint16_t)(u16) << 8)))

Toggles the endianism of u16 (by swapping its bytes).

Parameter
u16U16 of which to toggle the endianism.
Rückgabe
Value resulting from u16 with toggled endianism.
Zu beachten
More optimized if only used with values known at compile time.

Definiert in Zeile 201 der Datei compiler.h.

#define XMEGA   (XMEGA_A || XMEGA_AU || XMEGA_B || XMEGA_C || XMEGA_D || XMEGA_E)

AVR XMEGA product line

Definiert in Zeile 94 der Datei compiler.h.

#define XMEGA_A3BU
Wert:
( \
AVR8_PART_IS_DEFINED(ATxmega256A3BU) \
)

Definiert in Zeile 80 der Datei compiler.h.

#define XMEGA_A3U
Wert:
( \
AVR8_PART_IS_DEFINED(ATxmega64A3U) || \
AVR8_PART_IS_DEFINED(ATxmega128A3U) || \
AVR8_PART_IS_DEFINED(ATxmega192A3U) || \
AVR8_PART_IS_DEFINED(ATxmega256A3U) \
)

Definiert in Zeile 73 der Datei compiler.h.

#define XMEGA_AU   (XMEGA_A1U || XMEGA_A3U || XMEGA_A3BU || XMEGA_A4U)

AVR XMEGA AU family

Definiert in Zeile 91 der Datei compiler.h.