weAutSys' basic common types and helper functions
This file contains the definitions for weAutSys' common types and helper macros or functions. They are utilised in more than one application field respectively application or system module as well as in the serial bootloader.
This file is part of weAutSys <weinert-automation.de>
It is also used for the serial bootloader.
Copyright © 2013 Albrecht Weinert, Bochum
Data Structures | |
struct | u16div_t |
Two unsigned words intended for quotient and remainder. More... | |
struct | u8div_t |
Two unsigned bytes intended for quotient and remainder. More... | |
union | ucnt16_t |
A medium (16 bit) value in different resolutions. More... | |
union | ucnt32_t |
A big (32 bit) value in different resolutions. More... | |
Defines | |
#define | ADDR_T |
flash address is 16 bit for this µController | |
#define | ADDR_U |
flash address is 16 bit for this µController | |
#define | addr_v |
flash address is 16 bit for this µController | |
#define | andAP(mask) |
Unset (boolean and operation) port bits. | |
#define | andBP(mask) |
Unset (boolean and operation) port bits. | |
#define | andCP(mask) |
Unset (boolean and operation) port bits. | |
#define | andDP(mask) |
Unset (boolean and operation) port bits. | |
#define | andOrBP(andMask, orMask) |
Unset and set port B bits. | |
#define | andOrCP(andMask, orMask) |
Unset and set port C bits. | |
#define | andPort(port, mask) |
Unset (boolean and operation) port-bits. | |
#define | APP_END |
The end of the application flash area (as byte address + 1) | |
#define | BEL |
The bell code. | |
#define | BOOTL_BEG |
The start address of the bootloader (area) | |
#define | BOOTSIZE 4096 |
The (maximum) boot size in bytes. | |
#define | BS |
The back space code. | |
#define | CR |
The carriage return code. | |
#define | dirPort(port) |
Direction port (by letter) | |
#define | EEP_SIZE (E2END + 1) |
The EEPROM size in byte. | |
#define | ESC |
The Escape code. | |
#define | FCPU_S |
The CPU clock frequency (as string) | |
#define | FF |
The form feed code. | |
#define | fromPort(port) |
Re-read output from a port (by letter) | |
#define | HBYTE(x) |
Get the high byte (of a 16 bit value) | |
#define | HT |
The horizontal tab code. | |
#define | inPort(port) |
Input port (by letter) | |
#define | inpPins(port, mask) |
Set port pins as input. | |
#define | LARGE_MEMORY 0 |
The flash memory byte address type. | |
#define | LBYTE(x) |
Get the low byte (of a 16 bit value) | |
#define | LF |
The linefeed code. | |
#define | OFF |
A boolean false respectively off. | |
#define | ON |
A boolean true respectively on. | |
#define | orAP(mask) |
Set (boolean or operation) port-bits. | |
#define | orBP(mask) |
Set (boolean or operation) port-bits. | |
#define | orCP(mask) |
Set (boolean or operation) port-bits. | |
#define | orDP(mask) |
Set (boolean or operation) port-bits. | |
#define | orPort(port, mask) |
Set (boolean or operation) port-bits. | |
#define | outPins(port, mask) |
Set port pins as output. | |
#define | PLATFORM_S |
The platform name (as string) | |
#define | setPort(port, value) |
Set all port-bits. | |
#define | SYST_AUT "Albrecht Weinert <a-weinert.de> " |
The runtime's author. | |
#define | SYST_BLD |
The runtime's system build and time. | |
#define | SYST_COP |
The runtime's copyright notice. | |
#define | TOKENPASTE(x, y) |
Concatenation helper macro x ## y. | |
#define | toPort(port, mask) |
Output to a port (by letter) | |
#define | VT |
The vertical tab code. | |
#define | xorPort(port, mask) |
Toggle (boolean xor operation) port-bits. | |
Defines due to tools | |
#define | INFLASH(decl) |
Alternative declaration for flash memory. | |
#define | INEEPROM(decl) |
Declaration for EEPROM memory. | |
#define | STR(leMac) |
A macro value as string. | |
Functions | |
uint32_t | uartBaud (uint16_t uartPrescal, uint8_t x2) |
Calculate the true baudrate for a prescaler setting. | |
uint16_t | uartPrescaler (uint32_t baudRate, uint8_t x2) |
Calculate the prescaler setting for a desired baudrate. | |
Optimised Divide functions (optionally in bootloader) | |
uint16_t | div16 (uint16_t *rem, uint16_t dividend, uint16_t divisor) |
Unsigned 16 bit divide. | |
uint32_t | div24 (uint32_t *rem, uint32_t dividend, uint32_t divisor) |
Unsigned 24 bit divide. | |
uint32_t | div32 (uint32_t *rem, uint32_t dividend, uint32_t divisor) |
Unsigned 32 bit divide. | |
uint32_t | div32by24 (uint32_t *rem, uint32_t dividend, uint32_t divisor) |
Unsigned 32 bit divide by 24 bit. | |
uint32_t | div32by16 (uint16_t *rem, uint32_t dividend, uint16_t divisor) |
Unsigned 32 bit divide by 16 bit. |