#include <autoconf.h>
#include <avr/interrupt.h>
#include <avr/io.h>
#include <aversive/types.h>
#include <aversive/errno.h>
#include <aversive/irq_lock.h>
#include <avr/signal.h>
Go to the source code of this file.
Data Structures | |
struct | extract32 |
struct | extract16 |
Defines | |
#define | __AVR_LIBC_VERSION__ 0UL |
#define | F_CPU ((unsigned long)CONFIG_QUARTZ) |
#define | Hz 1l |
#define | KHz 1000l |
#define | MHz 1000000l |
#define | S_MAX(to_saturate, value_max) |
#define | U_MAX(to_saturate, value_max) |
#define | MAX(to_saturate, value_max) |
#define | MIN(to_saturate, value_min) |
#define | ABS(val) ( ((val) < 0) ? -(val) : (val) ) |
#define | extr32_08_0(i) ({ struct extract32 __x; __x.u.u32 = i; __x.u.u8.u8_0; }) |
#define | extr32_08_1(i) ({ struct extract32 __x; __x.u.u32 = i; __x.u.u8.u8_1; }) |
#define | extr32_08_2(i) ({ struct extract32 __x; __x.u.u32 = i; __x.u.u8.u8_2; }) |
#define | extr32_08_3(i) ({ struct extract32 __x; __x.u.u32 = i; __x.u.u8.u8_3; }) |
#define | extr32_16_0(i) ({ struct extract32 __x; __x.u.u32 = i; __x.u.u16.u16_0; }) |
#define | extr32_16_1(i) ({ struct extract32 __x; __x.u.u32 = i; __x.u.u16.u16_1; }) |
#define | extr32_16_mid(i) ({ struct extract32 __x; __x.u.u32 = i; __x.u.u16_b.u16_mid; }) |
#define | extr16_08_0(i) ({ struct extract16 __x; __x.u.u16 = i; __x.u.u8.u8_0; }) |
#define | extr16_08_1(i) ({ struct extract16 __x; __x.u.u16 = i; __x.u.u8.u8_1; }) |
#define | nop() __asm__ __volatile__ ("NOP\n") |
#define | nothing() __asm__ __volatile__ (" \n") |
#define | cli() __asm__ __volatile__ ("CLI\n") |
#define | sei() __asm__ __volatile__ ("SEI\n") |
#define | reset() |
#define | BIT_TOGGLE(port, bit) |
#define | FALSE 0 |
#define | TRUE 1 |
#define | False FALSE |
#define | false FALSE |
#define | True TRUE |
#define | true TRUE |
#define | DDR(port) (*(&(port) -1)) |
#define | PIN(port) (*(&(port) -2)) |
#define | OPEN_CO_INIT(port, bit) sbi(port,bit) |
#define | OPEN_CO_HIGH(port, bit) cbi(DDR(port),bit) |
#define | OPEN_CO_LOW(port, bit) cbi(DDR(port),bit) |
#define | cbi(sfr, bit) ( sfr &= ~ _BV(bit)) |
#define | sbi(sfr, bit) ( sfr |= _BV(bit)) |
Variables | |
struct extract32 | packed |
#define __AVR_LIBC_VERSION__ 0UL |
here are some cute little macros, and other stuff, microcontroller related !
Definition at line 44 of file aversive.h.
#define ABS | ( | val | ) | ( ((val) < 0) ? -(val) : (val) ) |
absolute while the abs() function in the libc works only with int type this macro works with every numerical type including floats
Definition at line 110 of file aversive.h.
Referenced by bd_manage_from_speed_cmd(), pts2line(), and quadramp_derivate_do_filter().
#define BIT_TOGGLE | ( | port, | |||
bit | ) |
Value:
little bit toggeling macrochange pin state usage : BIT_TOGGLE(PORTB,2) to make the pin 2 of PORTB toggle
Definition at line 229 of file aversive.h.
#define cbi | ( | sfr, | |||
bit | ) | ( sfr &= ~ _BV(bit)) |
deprecated macros in libc, but they're almost used, so we implement them again ;)
Definition at line 257 of file aversive.h.
Referenced by adc_get_value(), adc_init(), adc_launch(), init_ports(), initial_8_bit_write(), mf2_client_init(), mf2_server_init(), multiservo_del(), multiservo_init(), SIGNAL(), and uart_send_next_char().
#define cli | ( | ) | __asm__ __volatile__ ("CLI\n") |
#define DDR | ( | port | ) | (*(&(port) -1)) |
DDR and PINS from port adress
Definition at line 247 of file aversive.h.
Referenced by cc2420_init(), encoders_microb_init(), lcd_init(), multiservo_add(), multiservo_del(), pwm_ng_init(), and spi_init().
Definition at line 185 of file aversive.h.
Definition at line 186 of file aversive.h.
Definition at line 160 of file aversive.h.
Definition at line 161 of file aversive.h.
Definition at line 163 of file aversive.h.
Definition at line 165 of file aversive.h.
Definition at line 166 of file aversive.h.
#define F_CPU ((unsigned long)CONFIG_QUARTZ) |
#define false FALSE |
Definition at line 241 of file aversive.h.
#define False FALSE |
Definition at line 240 of file aversive.h.
#define FALSE 0 |
booleans
Definition at line 238 of file aversive.h.
Referenced by dialog_checklist(), dialog_menu(), dialog_textbox(), spi_init(), and spi_slave_deselect().
#define Hz 1l |
Definition at line 55 of file aversive.h.
#define KHz 1000l |
Definition at line 56 of file aversive.h.
#define MAX | ( | to_saturate, | |||
value_max | ) |
Value:
do { \ if (to_saturate > value_max) \ to_saturate = value_max; \ } while(0)
Definition at line 90 of file aversive.h.
#define MHz 1000000l |
Definition at line 57 of file aversive.h.
#define MIN | ( | to_saturate, | |||
value_min | ) |
Value:
do { \ if (to_saturate < value_min) \ to_saturate = value_min; \ } while(0)
Definition at line 99 of file aversive.h.
#define nop | ( | ) | __asm__ __volatile__ ("NOP\n") |
Definition at line 194 of file aversive.h.
#define nothing | ( | ) | __asm__ __volatile__ (" \n") |
Definition at line 197 of file aversive.h.
#define OPEN_CO_HIGH | ( | port, | |||
bit | ) | cbi(DDR(port),bit) |
Definition at line 252 of file aversive.h.
#define OPEN_CO_INIT | ( | port, | |||
bit | ) | sbi(port,bit) |
open collector simulation macros
Definition at line 251 of file aversive.h.
#define OPEN_CO_LOW | ( | port, | |||
bit | ) | cbi(DDR(port),bit) |
Definition at line 253 of file aversive.h.
#define PIN | ( | port | ) | (*(&(port) -2)) |
#define reset | ( | ) |
Value:
do { \ __asm__ __volatile__ ("ldi r30,0\n"); \ __asm__ __volatile__ ("ldi r31,0\n"); \ __asm__ __volatile__ ("ijmp\n"); \ } while(0)
Definition at line 207 of file aversive.h.
#define S_MAX | ( | to_saturate, | |||
value_max | ) |
Value:
do { \ if (to_saturate > value_max) \ to_saturate = value_max; \ else if (to_saturate < -value_max) \ to_saturate = -value_max; \ } while(0)
Definition at line 68 of file aversive.h.
Referenced by pid_do_filter(), and pwm_set().
#define sbi | ( | sfr, | |||
bit | ) | ( sfr |= _BV(bit)) |
Definition at line 260 of file aversive.h.
Referenced by adc_get_value(), adc_launch(), adc_shutdown(), brushless_init(), encoders_microb_init(), i2c_init(), lcd_init(), main(), multiservo_add(), multiservo_init(), SIGNAL(), uart_send_9bits_nowait(), uart_send_next_char(), and uart_send_nowait().
#define sei | ( | ) | __asm__ __volatile__ ("SEI\n") |
Definition at line 203 of file aversive.h.
Referenced by main(), scheduler_interrupt(), and SIGNAL().
#define true TRUE |
Definition at line 243 of file aversive.h.
#define True TRUE |
Definition at line 242 of file aversive.h.
#define TRUE 1 |
Definition at line 239 of file aversive.h.
Referenced by dialog_checklist(), dialog_inputbox(), dialog_menu(), dialog_msgbox(), dialog_textbox(), dialog_yesno(), init_dialog(), ISR(), and spi_slave_select().
#define U_MAX | ( | to_saturate, | |||
value_max | ) |
Value:
do { \ if (to_saturate > value_max) \ to_saturate = value_max; \ else if (to_saturate < 0) \ to_saturate = 0; \ } while(0)
Definition at line 79 of file aversive.h.