Home2L - C/C++ API v1.4-0-g38cc (2024-05-25)
Smart Tools for a Private Home
base.h File Reference

Description

This file contains basic definitions for the Brownie firmware.

Definition in file base.h.

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

Go to the source code of this file.

Macros

Basic Helpers ...
#define INIT(NAME, VAL)   if ((VAL) != 0) NAME = (VAL);
 Variable assignment for '*Init()' functions which are only called once on startup. More...
 
#define LO(X)   ((X) & 0xff)
 Get low byte of a 16-bit word-.
 
#define HI(X)   ((X) >> 8)
 Get high byte of a 16-bit word.
 
#define HILO(H, L)   ((((uint16_t) (H)) << 8) | (L))
 Compose a 16-bit word from high and low byte.
 
#define SHIFT_OF_MASK(X)
 Get the number of shifts to obtain a certain byte mask (inverse of '1 << N').
 
MCU Port Access Macros ...
#define P_A0   0x0001
 
#define P_A1   0x0002
 
#define P_A2   0x0004
 
#define P_A3   0x0008
 
#define P_A4   0x0010
 
#define P_A5   0x0020
 
#define P_A6   0x0040
 
#define P_A7   0x0080
 
#define P_B0   0x0100
 
#define P_B1   0x0200
 
#define P_B2   0x0400
 
#define P_B3   0x0800
 
#define P_B4   0x1000
 
#define P_B5   0x2000
 
#define P_B6   0x4000
 
#define P_B7   0x8000
 
#define P_IN(P)   (LO(P) ? (PINA & LO(P)) : HI(P) ? (PINB & HI(P)) : 0)
 Read a single pin; result is either 0 or non-zero, depending on whether the pin is set.
 
#define P_IN_MULTI(MASK)   ((LO(MASK) ? (PINA & LO(MASK)) : 0) | (HI(MASK) ? ((uint16_t) (PINB & HI(MASK))) << 8 : 0))
 Read multiple pins, selected by PMASK; result is 16-bit vector.
 
#define P_OUT_0(P)   do { if (LO(P)) PORTA &= ~LO(P); if (HI(P)) PORTB &= ~HI(P); } while(0)
 
#define P_OUT_1(P)   do { if (LO(P)) PORTA |= LO(P); if (HI(P)) PORTB |= HI(P); } while(0)
 Set/reset pin(s). Usually, only a single bit should be passed here to make the compiler generate 'sbi' and 'cbi' instructions.
 
#define P_OUT_MULTI(MASK, P)
 Set multiple pins, selected by 'MASK', to 'P'.
 
#define P_DDR_IN(P)   do { if (LO(P)) DDRA &= ~LO(P); if (HI(P)) DDRB &= ~HI(P); } while(0)
 Set port(s) as input.
 
#define P_DDR_OUT(P)   do { if (LO(P)) DDRA |= LO(P); if (HI(P)) DDRB |= HI(P); } while(0)
 Set port(s) as output.
 
MCU Types ...
#define MCU_TYPE
 MCU type compiled for; is set to any 'BR_MCU_*' value (see BR_MCU_NONE and friends).