![]() |
Home2L - C/C++ API v1.4-2-g83f4c (2025-08-23)
Smart Tools for a Private Home
|
This file contains basic definitions for the Brownie firmware.
Definition in file base.h.
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. | |
#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. | |
MCU Port Access Macros ... | |
#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_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_DDR_IN(P) do { if (LO(P)) DDRA &= ~LO(P); if (HI(P)) DDRB &= ~HI(P); } while(0) |
< | |
#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). | |