42 const unsigned char value = (
unsigned char)c;
66 for (i = 0; i <
sizeof(newLine) - 1; ++i) {
214 all_entries_of_enum_Lz_SerialStopBits_must_be_set_in_setStopBits
229 if (stopBits <= __LZ_SERIAL_STOP_BITS_ENUM_BEGIN ||
230 stopBits >= __LZ_SERIAL_STOP_BITS_ENUM_END) {
284 all_entries_of_enum_Lz_SerialParityBit_must_be_set_in_setParityBit
299 if (parityBit <= __LZ_SERIAL_PARITY_BIT_ENUM_BEGIN ||
300 parityBit >= __LZ_SERIAL_PARITY_BIT_ENUM_END) {
368 all_entries_of_enum_Lz_SerialSize_must_be_set_in_setSize
383 if (size <= __LZ_SERIAL_SIZE_ENUM_BEGIN ||
384 size >= __LZ_SERIAL_SIZE_ENUM_END) {
411 all_entries_of_enum_Lz_SerialSpeed_must_be_set_in_serialSpeedRegisterValue
426 if (speed <= __LZ_SERIAL_SPEED_ENUM_BEGIN ||
427 speed >= __LZ_SERIAL_SPEED_ENUM_END) {
volatile uint8_t ucsr0c
USART Control and Status Register C.
uint8_t InterruptsStatus
Define the type used to store interrupts status.
volatile uint8_t ucsr0b
USART Control and Status Register B.
#define STATIC_ASSERT(C, M)
Perform an assertion at compile time.
Enable serial transmission.
enum Lz_SerialStopBits stopBits
The number of stop bits.
volatile uint8_t ubrr0l
USART Baud Rate Register low.
enum Lz_SerialSize size
The size of the character.
Use 6-bit character size on serial line.
#define LO8(X)
Take the low byte of a 16-bit value.
static void SetParityBitEven(void)
Set even parity bit.
int putchar(int c)
Transmit a single character on the serial line.
Use a 4800 baud rate on the serial line.
enum Lz_SerialEnableFlags enableFlags
The enable/disable Tx/Rx options.
static void SetSize5(void)
Set character size to 5 bits.
Kernel symbols definition.
static void SetStopBits1(void)
Set USART to use 1 stop bit.
static enum Lz_SerialEnableFlags GetEnablingStatus(void)
Retrieve the enabling status of the serial line.
Describes the memory mapping for the USART.
enum Lz_SerialParityBit parityBit
The kind of parity bit.
static Usart *const usart
A constant pointer to the memory mapped Usart structure.
static void SetParityBitNone(void)
Set no parity bit.
static void SetSize7(void)
Set character size to 7 bits.
static void(*const setSize[])(void)
Jump table to functions setting character sizes of the serial line.
Include appropriate config file.
void Arch_InitSerial(void)
Initialize serial line with default configuration at system startup.
#define EOF
Defines the End-Of-File constant.
static enum Lz_SerialStopBits GetStopBits(void)
Retrieve the number of stop bits currently used by the serial line.
#define ELEMENTS_COUNT(X)
Get the number of elements in a statically initialized array.
enum Lz_SerialSpeed speed
The baud rate.
static void SetStopBits(const enum Lz_SerialStopBits stopBits)
Set the number of stop bits of the serial line.
USART Data Register Empty.
static void SetSpeed(const enum Lz_SerialSpeed speed)
Set the baud rate of the serial line.
Macro aliases on compiler facilities.
static void SetSize6(void)
Set character size to 6 bits.
InterruptsStatus Arch_DisableInterruptsGetStatus(void)
Disable all interrupts and return the previous interrupts status.
void Arch_RestoreInterruptsStatus(const InterruptsStatus interruptsStatus)
Restore a previously saved interrupts status.
Use 8-bit character size on serial line.
Disable both serial transmission and reception.
unsigned int uint16_t
Represents a unsigned integer type with width of exactly 16 bits.
volatile uint8_t ubrr0h
USART Baud Rate Register high.
uint16_t Arch_LoadU16FromProgmem(const void *source)
Return a double-byte word stored in program memory.
static void SetStopBits2(void)
Set USART to use 2 stop bits.
static void SetParityBit(const enum Lz_SerialParityBit parityBit)
Set the kind of parity bit of the serial line.
static void(*const setStopBits[])(void)
Jump table to functions setting the number of stop bits of the serial line.
volatile uint8_t ucsr0a
USART Control and Status Register A.
Use 5-bit character size on serial line.
Lz_SerialSize
Define the size of the character used on serial line.
void(*)(void) Arch_LoadFunctionPointerFromProgmem(const void *source)
Return a function pointer stored in program memory.
Serial port configuration interface.
#define UCSR0A
USART Control and Status Register A.
void Kernel_Panic(void)
Kernel panic.
static enum Lz_SerialSize GetSize(void)
Retrieve the character size currently used by the serial line.
#define LZ_CONFIG_SERIAL_NEWLINE
The sequence to use for new lines on the serial line.
Lz_SerialParityBit
Define the kind of parity bit to use on serial line.
Lz_SerialEnableFlags
Define flags for enabling/disabling serial transmission/reception.
unsigned char uint8_t
Represents a unsigned integer type with width of exactly 8 bits.
Use 7-bit character size on serial line.
#define HI8(X)
Take the high byte of a 16-bit value.
static void SetSize(const enum Lz_SerialSize size)
Set the character size of the serial line.
USART API for the ATmega328P.
#define NULL
NULL pointer.
Lz_SerialSpeed
Define the baud rate of the serial line.
int puts(const char *s)
Transmit the NUL-terminated string s followed by a trailing newline on the serial line...
static void SetParityBitOdd(void)
Set odd parity bit.
stdio standard header file.
volatile uint8_t udr0
USART I/O Data Register.
static const uint16_t serialSpeedRegisterValue[]
Jump table containing the setting values of UBRR0L and UBRR0H registers for baud rates defined in Lz_...
Represents the configuration of a serial interface.
#define CLEAR_BITS(V, T, X)
Clear the corresponding bits of X in the value V of type T.
const bool LZ_CONFIG_CHECK_WRONG_ENUM_ENTRIES_IN_SERIAL
When 1, check for enum parameters that are over the admissible values defined by the enum...
Lz_SerialStopBits
Define the number of stop bits to use on serial line.
static enum Lz_SerialParityBit GetParityBit(void)
Retrieve the kind of parity currently used by the serial line.
Basic type definitions and useful macros.
void Arch_SetSerialConfiguration(const Lz_SerialConfiguration *const configuration)
Configure the seria line according to the parameter.
Architecture Abstraction API.
static void SetSize8(void)
Set character size to 8 bits.
static void(*const setParityBit[])(void)
Jump table to functions setting the kind of parity of the serial line.
void Arch_GetSerialConfiguration(Lz_SerialConfiguration *const configuration)
Retrieve the current configuration of the serial line.
const bool LZ_CONFIG_SERIAL_USE_INTERRUPTS
When 1, serial input and output will use interrupt blocking.
static enum Lz_SerialSpeed currentSerialSpeed
The current serial baud rate.
static void SetEnablingStatus(const enum Lz_SerialEnableFlags flags)
Set the enabling/disabling of Tx/Rx of the serial line.