Hanna
Sourcecode Batteriemanagementsystem |
Commonly used includes, types and macros. Mehr ...
#include <avr/io.h>
#include <avr/builtins.h>
#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>
#include <stdlib.h>
#include <util/delay.h>
#include <pmic.h>
#include <avr/pgmspace.h>
gehe zum Quellcode dieser Datei
Makrodefinitionen | |
#define | __always_inline inline __attribute__((__always_inline__)) |
The function should always be inlined. Mehr ... | |
#define | Assert(expr) ((void) 0) |
This macro is used to test fatal errors. Mehr ... | |
#define | barrier() asm volatile("" ::: "memory") |
Memory barrier. | |
#define | delay_ms(t) _delay_ms(t) |
#define | delay_s(t) _delay_ms( t * 1000 ) |
#define | delay_us(t) _delay_us(t) |
#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 ... | |
Program memory | |
Macros for locating and accessing data in program memory. | |
#define | PROGMEM_LOCATION(type, name, loc) type name __attribute__((section (#loc))) |
#define | PROGMEM_DECLARE(type, name) const type name __attribute__((__progmem__)) |
#define | PROGMEM_STRING(x) PSTR(x) |
#define | PROGMEM_STRING_T PGM_P |
#define | PROGMEM_T const |
#define | PROGMEM_PTR_T const * |
#define | PROGMEM_BYTE_ARRAY_T uint8_t* |
#define | PROGMEM_WORD_ARRAY_T uint16_t* |
#define | PROGMEM_READ_BYTE(x) pgm_read_byte(x) |
#define | PROGMEM_READ_WORD(x) pgm_read_word(x) |
Commonly used includes, types and macros.
Definiert in Datei compiler.h.