mirror of
https://github.com/hoglet67/AtomBusMon.git
synced 2025-02-25 15:29:01 +00:00
Firmware: whitespace only
Change-Id: Idfab542255879199ea65f9d92badfd3635d21f85
This commit is contained in:
parent
9d83c99b26
commit
bf8688665e
@ -1,204 +1,204 @@
|
|||||||
/*
|
/*
|
||||||
Status.c
|
Status.c
|
||||||
|
|
||||||
Functions for logging program status to the serial port, to
|
Functions for logging program status to the serial port, to
|
||||||
be used for debugging pruposes etc.
|
be used for debugging pruposes etc.
|
||||||
|
|
||||||
2008-03-21, P.Harvey-Smith.
|
2008-03-21, P.Harvey-Smith.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "terminalcodes.h"
|
#include "terminalcodes.h"
|
||||||
#include "status.h"
|
#include "status.h"
|
||||||
|
|
||||||
static int StdioSerial_TxByte0(char DataByte, FILE *Stream);
|
static int StdioSerial_TxByte0(char DataByte, FILE *Stream);
|
||||||
|
|
||||||
FILE ser0stream = FDEV_SETUP_STREAM(StdioSerial_TxByte0,NULL,_FDEV_SETUP_WRITE);
|
FILE ser0stream = FDEV_SETUP_STREAM(StdioSerial_TxByte0,NULL,_FDEV_SETUP_WRITE);
|
||||||
|
|
||||||
void StdioSerial_TxByte(char DataByte)
|
void StdioSerial_TxByte(char DataByte)
|
||||||
{
|
{
|
||||||
if((DataByte=='\r') || (DataByte=='\n')) {
|
if((DataByte=='\r') || (DataByte=='\n')) {
|
||||||
Serial_TxByte0('\r');
|
Serial_TxByte0('\r');
|
||||||
Serial_TxByte0('\n');
|
Serial_TxByte0('\n');
|
||||||
} else {
|
} else {
|
||||||
Serial_TxByte0(DataByte);
|
Serial_TxByte0(DataByte);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int StdioSerial_TxByte0(char DataByte, FILE *Stream)
|
int StdioSerial_TxByte0(char DataByte, FILE *Stream)
|
||||||
{
|
{
|
||||||
StdioSerial_TxByte(DataByte);
|
StdioSerial_TxByte(DataByte);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cls()
|
void cls()
|
||||||
{
|
{
|
||||||
logs(ESC_ERASE_DISPLAY);
|
logs(ESC_ERASE_DISPLAY);
|
||||||
logs(ESC_CURSOR_POS(0,0));
|
logs(ESC_CURSOR_POS(0,0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void USART_Init0(const uint32_t BaudRate)
|
void USART_Init0(const uint32_t BaudRate)
|
||||||
{
|
{
|
||||||
#ifdef UCSR0A
|
#ifdef UCSR0A
|
||||||
UCSR0A = 0;
|
UCSR0A = 0;
|
||||||
UCSR0B = ((1 << RXEN0) | (1 << TXEN0));
|
UCSR0B = ((1 << RXEN0) | (1 << TXEN0));
|
||||||
UCSR0C = ((1 << UCSZ01) | (1 << UCSZ00));
|
UCSR0C = ((1 << UCSZ01) | (1 << UCSZ00));
|
||||||
|
|
||||||
UBRR0 = SERIAL_UBBRVAL(BaudRate);
|
UBRR0 = SERIAL_UBBRVAL(BaudRate);
|
||||||
#else
|
#else
|
||||||
UCR = ((1 << RXEN) | (1 << TXEN));
|
UCR = ((1 << RXEN) | (1 << TXEN));
|
||||||
|
|
||||||
UBRR = SERIAL_UBBRVAL(BaudRate);
|
UBRR = SERIAL_UBBRVAL(BaudRate);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Transmits a given byte through the USART.
|
/** Transmits a given byte through the USART.
|
||||||
*
|
*
|
||||||
* \param DataByte Byte to transmit through the USART
|
* \param DataByte Byte to transmit through the USART
|
||||||
*/
|
*/
|
||||||
void Serial_TxByte0(const char DataByte)
|
void Serial_TxByte0(const char DataByte)
|
||||||
{
|
{
|
||||||
#ifdef UCSR0A
|
#ifdef UCSR0A
|
||||||
while ( !( UCSR0A & (1<<UDRE0)) ) ;
|
while ( !( UCSR0A & (1<<UDRE0)) ) ;
|
||||||
UDR0=DataByte;
|
UDR0=DataByte;
|
||||||
#else
|
#else
|
||||||
while ( !( USR & (1<<UDRE)) ) ;
|
while ( !( USR & (1<<UDRE)) ) ;
|
||||||
UDR=DataByte;
|
UDR=DataByte;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Receives a byte from the USART.
|
/** Receives a byte from the USART.
|
||||||
*
|
*
|
||||||
* \return Byte received from the USART
|
* \return Byte received from the USART
|
||||||
*/
|
*/
|
||||||
char Serial_RxByte0(void)
|
char Serial_RxByte0(void)
|
||||||
{
|
{
|
||||||
#ifdef UCSR0A
|
#ifdef UCSR0A
|
||||||
while (!(USR & (1 << RXC0))) ;
|
while (!(USR & (1 << RXC0))) ;
|
||||||
return UDR0;
|
return UDR0;
|
||||||
#else
|
#else
|
||||||
while (!(USR & (1<<RXC))) ;
|
while (!(USR & (1<<RXC))) ;
|
||||||
return UDR;
|
return UDR;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t Serial_ByteRecieved0(void)
|
uint8_t Serial_ByteRecieved0(void)
|
||||||
{
|
{
|
||||||
#ifdef UCSR0A
|
#ifdef UCSR0A
|
||||||
return (UCSR0A & (1 << RXC0));
|
return (UCSR0A & (1 << RXC0));
|
||||||
#else
|
#else
|
||||||
return (USR & (1<<RXC));
|
return (USR & (1<<RXC));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Serial_Init(const uint32_t BaudRate0)
|
void Serial_Init(const uint32_t BaudRate0)
|
||||||
{
|
{
|
||||||
if (BaudRate0<=0)
|
if (BaudRate0<=0)
|
||||||
USART_Init0(DefaultBaudRate);
|
USART_Init0(DefaultBaudRate);
|
||||||
else
|
else
|
||||||
USART_Init0(BaudRate0);
|
USART_Init0(BaudRate0);
|
||||||
|
|
||||||
cls();
|
cls();
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************
|
/********************************************************
|
||||||
* Simple string logger, as log0 is expensive
|
* Simple string logger, as log0 is expensive
|
||||||
********************************************************/
|
********************************************************/
|
||||||
|
|
||||||
void logc(char c) {
|
void logc(char c) {
|
||||||
StdioSerial_TxByte(c);
|
StdioSerial_TxByte(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
void logs(const char *s) {
|
void logs(const char *s) {
|
||||||
while (*s) {
|
while (*s) {
|
||||||
logc(*s++);
|
logc(*s++);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void logpgmstr(const char *s) {
|
void logpgmstr(const char *s) {
|
||||||
char c;
|
char c;
|
||||||
do {
|
do {
|
||||||
c = pgm_read_byte(s++);
|
c = pgm_read_byte(s++);
|
||||||
if (c) {
|
if (c) {
|
||||||
logc(c);
|
logc(c);
|
||||||
}
|
}
|
||||||
} while (c);
|
} while (c);
|
||||||
}
|
}
|
||||||
|
|
||||||
char hex1(uint8_t i) {
|
char hex1(uint8_t i) {
|
||||||
i &= 0x0f;
|
i &= 0x0f;
|
||||||
if (i < 10) {
|
if (i < 10) {
|
||||||
i += '0';
|
i += '0';
|
||||||
} else {
|
} else {
|
||||||
i += ('A' - 10);
|
i += ('A' - 10);
|
||||||
}
|
}
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
void loghex1(uint8_t i) {
|
void loghex1(uint8_t i) {
|
||||||
logc(hex1(i));
|
logc(hex1(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
void loghex2(uint8_t i) {
|
void loghex2(uint8_t i) {
|
||||||
loghex1(i >> 4);
|
loghex1(i >> 4);
|
||||||
loghex1(i);
|
loghex1(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
void loghex4(uint16_t i) {
|
void loghex4(uint16_t i) {
|
||||||
loghex2(i >> 8);
|
loghex2(i >> 8);
|
||||||
loghex2(i);
|
loghex2(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
void logint(int i) {
|
void logint(int i) {
|
||||||
char buffer[16];
|
char buffer[16];
|
||||||
strint(buffer, i);
|
strint(buffer, i);
|
||||||
logs(buffer);
|
logs(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void loglong(long i) {
|
void loglong(long i) {
|
||||||
char buffer[16];
|
char buffer[16];
|
||||||
strlong(buffer, i);
|
strlong(buffer, i);
|
||||||
logs(buffer);
|
logs(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *strfill(char *buffer, char c, uint8_t i) {
|
char *strfill(char *buffer, char c, uint8_t i) {
|
||||||
while (i-- > 0) {
|
while (i-- > 0) {
|
||||||
*buffer++ = c;
|
*buffer++ = c;
|
||||||
}
|
}
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *strhex1(char *buffer, uint8_t i) {
|
char *strhex1(char *buffer, uint8_t i) {
|
||||||
*buffer++ = hex1(i);
|
*buffer++ = hex1(i);
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *strhex2(char *buffer, uint8_t i) {
|
char *strhex2(char *buffer, uint8_t i) {
|
||||||
buffer = strhex1(buffer, i >> 4);
|
buffer = strhex1(buffer, i >> 4);
|
||||||
buffer = strhex1(buffer, i);
|
buffer = strhex1(buffer, i);
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *strhex4(char *buffer, uint16_t i) {
|
char *strhex4(char *buffer, uint16_t i) {
|
||||||
buffer = strhex2(buffer, i >> 8);
|
buffer = strhex2(buffer, i >> 8);
|
||||||
buffer = strhex2(buffer, i);
|
buffer = strhex2(buffer, i);
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *strint(char *buffer, int i) {
|
char *strint(char *buffer, int i) {
|
||||||
return itoa(i, buffer, 10);
|
return itoa(i, buffer, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *strlong(char *buffer, long i) {
|
char *strlong(char *buffer, long i) {
|
||||||
return ltoa(i, buffer, 10);
|
return ltoa(i, buffer, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *strinsert(char *buffer, const char *s) {
|
char *strinsert(char *buffer, const char *s) {
|
||||||
while (*s) {
|
while (*s) {
|
||||||
*buffer++ = *s++;
|
*buffer++ = *s++;
|
||||||
}
|
}
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
@ -1,89 +1,89 @@
|
|||||||
/*
|
/*
|
||||||
Status.h
|
Status.h
|
||||||
|
|
||||||
Functions for logging program status to the serial port, to
|
Functions for logging program status to the serial port, to
|
||||||
be used for debugging pruposes etc.
|
be used for debugging pruposes etc.
|
||||||
|
|
||||||
2008-03-21, P.Harvey-Smith.
|
2008-03-21, P.Harvey-Smith.
|
||||||
|
|
||||||
Some functions and macros borrowed from Dean Camera's LURFA
|
Some functions and macros borrowed from Dean Camera's LURFA
|
||||||
USB libraries.
|
USB libraries.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <avr/io.h>
|
#include <avr/io.h>
|
||||||
#include <avr/pgmspace.h>
|
#include <avr/pgmspace.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
#ifndef __STATUS_DEFINES__
|
#ifndef __STATUS_DEFINES__
|
||||||
#define __STATUS_DEFINES__
|
#define __STATUS_DEFINES__
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/********************************************************
|
/********************************************************
|
||||||
* Simple string logger, as log0 is expensive
|
* Simple string logger, as log0 is expensive
|
||||||
********************************************************/
|
********************************************************/
|
||||||
|
|
||||||
#define logstr(s) logpgmstr(PSTR((s)))
|
#define logstr(s) logpgmstr(PSTR((s)))
|
||||||
|
|
||||||
void logc(char c);
|
void logc(char c);
|
||||||
void logs(const char *s);
|
void logs(const char *s);
|
||||||
void logpgmstr(const char *s);
|
void logpgmstr(const char *s);
|
||||||
void loghex1(uint8_t i);
|
void loghex1(uint8_t i);
|
||||||
void loghex2(uint8_t i);
|
void loghex2(uint8_t i);
|
||||||
void loghex4(uint16_t i);
|
void loghex4(uint16_t i);
|
||||||
void logint(int i);
|
void logint(int i);
|
||||||
void loglong(long i);
|
void loglong(long i);
|
||||||
char *strfill(char *buffer, char c, uint8_t i);
|
char *strfill(char *buffer, char c, uint8_t i);
|
||||||
char *strhex1(char *buffer, uint8_t i);
|
char *strhex1(char *buffer, uint8_t i);
|
||||||
char *strhex2(char *buffer, uint8_t i);
|
char *strhex2(char *buffer, uint8_t i);
|
||||||
char *strhex4(char *buffer, uint16_t i);
|
char *strhex4(char *buffer, uint16_t i);
|
||||||
char *strint(char *buffer, int i);
|
char *strint(char *buffer, int i);
|
||||||
char *strlong(char *buffer, long i);
|
char *strlong(char *buffer, long i);
|
||||||
char *strinsert(char *buffer, const char *s);
|
char *strinsert(char *buffer, const char *s);
|
||||||
|
|
||||||
#define log0(format,...) fprintf_P(&ser0stream,PSTR(format),##__VA_ARGS__)
|
#define log0(format,...) fprintf_P(&ser0stream,PSTR(format),##__VA_ARGS__)
|
||||||
|
|
||||||
//
|
//
|
||||||
// For stdio
|
// For stdio
|
||||||
//
|
//
|
||||||
|
|
||||||
extern FILE ser0stream;
|
extern FILE ser0stream;
|
||||||
|
|
||||||
/* Default baud rate if 0 passed to Serial_Init */
|
/* Default baud rate if 0 passed to Serial_Init */
|
||||||
|
|
||||||
#define DefaultBaudRate 9600
|
#define DefaultBaudRate 9600
|
||||||
|
|
||||||
/** Indicates whether a character has been received through the USART - boolean false if no character
|
/** Indicates whether a character has been received through the USART - boolean false if no character
|
||||||
* has been received, or non-zero if a character is waiting to be read from the reception buffer.
|
* has been received, or non-zero if a character is waiting to be read from the reception buffer.
|
||||||
*/
|
*/
|
||||||
#define Serial_IsCharReceived() ((UCSR1A & (1 << RXC1)) ? true : false)
|
#define Serial_IsCharReceived() ((UCSR1A & (1 << RXC1)) ? true : false)
|
||||||
|
|
||||||
/** Macro for calculating the baud value from a given baud rate when the U2X (double speed) bit is
|
/** Macro for calculating the baud value from a given baud rate when the U2X (double speed) bit is
|
||||||
* not set.
|
* not set.
|
||||||
*/
|
*/
|
||||||
#define SERIAL_UBBRVAL(baud) (((F_CPU / 16) / baud) - 1)
|
#define SERIAL_UBBRVAL(baud) (((F_CPU / 16) / baud) - 1)
|
||||||
|
|
||||||
/** Macro for calculating the baud value from a given baud rate when the U2X (double speed) bit is
|
/** Macro for calculating the baud value from a given baud rate when the U2X (double speed) bit is
|
||||||
* set.
|
* set.
|
||||||
*/
|
*/
|
||||||
#define SERIAL_2X_UBBRVAL(baud) (((F_CPU / 8) / baud) - 1)
|
#define SERIAL_2X_UBBRVAL(baud) (((F_CPU / 8) / baud) - 1)
|
||||||
|
|
||||||
#define SerEOL0() { Serial_TxByte0('\r'); Serial_TxByte0('\n'); }
|
#define SerEOL0() { Serial_TxByte0('\r'); Serial_TxByte0('\n'); }
|
||||||
|
|
||||||
#ifdef NOUSART1
|
#ifdef NOUSART1
|
||||||
#undef UCSR1A
|
#undef UCSR1A
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void USART_Init0(const uint32_t BaudRate);
|
void USART_Init0(const uint32_t BaudRate);
|
||||||
void Serial_TxByte0(const char DataByte);
|
void Serial_TxByte0(const char DataByte);
|
||||||
char Serial_RxByte0(void);
|
char Serial_RxByte0(void);
|
||||||
uint8_t Serial_ByteRecieved0(void);
|
uint8_t Serial_ByteRecieved0(void);
|
||||||
|
|
||||||
void Serial_Init(const uint32_t BaudRate0);
|
void Serial_Init(const uint32_t BaudRate0);
|
||||||
|
|
||||||
void cls();
|
void cls();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,176 +1,176 @@
|
|||||||
/*
|
/*
|
||||||
LUFA Library
|
LUFA Library
|
||||||
Copyright (C) Dean Camera, 2008.
|
Copyright (C) Dean Camera, 2008.
|
||||||
|
|
||||||
dean [at] fourwalledcubicle [dot] com
|
dean [at] fourwalledcubicle [dot] com
|
||||||
www.fourwalledcubicle.com
|
www.fourwalledcubicle.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright 2008 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
Copyright 2008 Dean Camera (dean [at] fourwalledcubicle [dot] com)
|
||||||
|
|
||||||
Permission to use, copy, modify, and distribute this software
|
Permission to use, copy, modify, and distribute this software
|
||||||
and its documentation for any purpose and without fee is hereby
|
and its documentation for any purpose and without fee is hereby
|
||||||
granted, provided that the above copyright notice appear in all
|
granted, provided that the above copyright notice appear in all
|
||||||
copies and that both that the copyright notice and this
|
copies and that both that the copyright notice and this
|
||||||
permission notice and warranty disclaimer appear in supporting
|
permission notice and warranty disclaimer appear in supporting
|
||||||
documentation, and that the name of the author not be used in
|
documentation, and that the name of the author not be used in
|
||||||
advertising or publicity pertaining to distribution of the
|
advertising or publicity pertaining to distribution of the
|
||||||
software without specific, written prior permission.
|
software without specific, written prior permission.
|
||||||
|
|
||||||
The author disclaim all warranties with regard to this
|
The author disclaim all warranties with regard to this
|
||||||
software, including all implied warranties of merchantability
|
software, including all implied warranties of merchantability
|
||||||
and fitness. In no event shall the author be liable for any
|
and fitness. In no event shall the author be liable for any
|
||||||
special, indirect or consequential damages or any damages
|
special, indirect or consequential damages or any damages
|
||||||
whatsoever resulting from loss of use, data or profits, whether
|
whatsoever resulting from loss of use, data or profits, whether
|
||||||
in an action of contract, negligence or other tortious action,
|
in an action of contract, negligence or other tortious action,
|
||||||
arising out of or in connection with the use or performance of
|
arising out of or in connection with the use or performance of
|
||||||
this software.
|
this software.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** \file
|
/** \file
|
||||||
*
|
*
|
||||||
* ANSI terminal compatible escape sequences. These escape sequences are designed to be concatenated with existing
|
* ANSI terminal compatible escape sequences. These escape sequences are designed to be concatenated with existing
|
||||||
* strings to modify their display on a compatible terminal application.
|
* strings to modify their display on a compatible terminal application.
|
||||||
*
|
*
|
||||||
* \note If desired, the macro DISABLE_TERMINAL_CODES can be defined in the project makefile and passed to the GCC
|
* \note If desired, the macro DISABLE_TERMINAL_CODES can be defined in the project makefile and passed to the GCC
|
||||||
* compiler via the -D switch to disable the terminal codes without modifying the source, for use with non
|
* compiler via the -D switch to disable the terminal codes without modifying the source, for use with non
|
||||||
* compatible terminals (any terminal code then equate to empty strings).
|
* compatible terminals (any terminal code then equate to empty strings).
|
||||||
*
|
*
|
||||||
* Example Usage:
|
* Example Usage:
|
||||||
* \code
|
* \code
|
||||||
* printf("Some String, " ESC_BOLD_ON " Some bold string");
|
* printf("Some String, " ESC_BOLD_ON " Some bold string");
|
||||||
* \endcode
|
* \endcode
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __TERMINALCODES_H__
|
#ifndef __TERMINALCODES_H__
|
||||||
#define __TERMINALCODES_H__
|
#define __TERMINALCODES_H__
|
||||||
|
|
||||||
/* Public Interface - May be used in end-application: */
|
/* Public Interface - May be used in end-application: */
|
||||||
/* Macros: */
|
/* Macros: */
|
||||||
#if !defined(DISABLE_TERMINAL_CODES)
|
#if !defined(DISABLE_TERMINAL_CODES)
|
||||||
/** Creates an ANSII escape sequence with the payload specified by "c". */
|
/** Creates an ANSII escape sequence with the payload specified by "c". */
|
||||||
#define ANSI_ESCAPE_SEQUENCE(c) "\33[" c
|
#define ANSI_ESCAPE_SEQUENCE(c) "\33[" c
|
||||||
#else
|
#else
|
||||||
#define ANSI_ESCAPE_SEQUENCE(c)
|
#define ANSI_ESCAPE_SEQUENCE(c)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** Resets any escape sequence modifiers back to their defaults. */
|
/** Resets any escape sequence modifiers back to their defaults. */
|
||||||
#define ESC_RESET ANSI_ESCAPE_SEQUENCE("0m")
|
#define ESC_RESET ANSI_ESCAPE_SEQUENCE("0m")
|
||||||
|
|
||||||
/** Turns on bold so that any following text is printed to the terminal in bold. */
|
/** Turns on bold so that any following text is printed to the terminal in bold. */
|
||||||
#define ESC_BOLD_ON ANSI_ESCAPE_SEQUENCE("1m")
|
#define ESC_BOLD_ON ANSI_ESCAPE_SEQUENCE("1m")
|
||||||
|
|
||||||
/** Turns on italics so that any following text is printed to the terminal in italics. */
|
/** Turns on italics so that any following text is printed to the terminal in italics. */
|
||||||
#define ESC_ITALICS_ON ANSI_ESCAPE_SEQUENCE("3m")
|
#define ESC_ITALICS_ON ANSI_ESCAPE_SEQUENCE("3m")
|
||||||
|
|
||||||
/** Turns on underline so that any following text is printed to the terminal underlined. */
|
/** Turns on underline so that any following text is printed to the terminal underlined. */
|
||||||
#define ESC_UNDERLINE_ON ANSI_ESCAPE_SEQUENCE("4m")
|
#define ESC_UNDERLINE_ON ANSI_ESCAPE_SEQUENCE("4m")
|
||||||
|
|
||||||
/** Turns on inverse so that any following text is printed to the terminal in inverted colours. */
|
/** Turns on inverse so that any following text is printed to the terminal in inverted colours. */
|
||||||
#define ESC_INVERSE_ON ANSI_ESCAPE_SEQUENCE("7m")
|
#define ESC_INVERSE_ON ANSI_ESCAPE_SEQUENCE("7m")
|
||||||
|
|
||||||
/** Turns on strikethrough so that any following text is printed to the terminal with a line through the
|
/** Turns on strikethrough so that any following text is printed to the terminal with a line through the
|
||||||
* center.
|
* center.
|
||||||
*/
|
*/
|
||||||
#define ESC_STRIKETHROUGH_ON ANSI_ESCAPE_SEQUENCE("9m")
|
#define ESC_STRIKETHROUGH_ON ANSI_ESCAPE_SEQUENCE("9m")
|
||||||
|
|
||||||
/** Turns off bold so that any following text is printed to the terminal in non bold. */
|
/** Turns off bold so that any following text is printed to the terminal in non bold. */
|
||||||
#define ESC_BOLD_OFF ANSI_ESCAPE_SEQUENCE("22m")
|
#define ESC_BOLD_OFF ANSI_ESCAPE_SEQUENCE("22m")
|
||||||
|
|
||||||
/** Turns off italics so that any following text is printed to the terminal in non italics. */
|
/** Turns off italics so that any following text is printed to the terminal in non italics. */
|
||||||
#define ESC_ITALICS_OFF ANSI_ESCAPE_SEQUENCE("23m")
|
#define ESC_ITALICS_OFF ANSI_ESCAPE_SEQUENCE("23m")
|
||||||
|
|
||||||
/** Turns off underline so that any following text is printed to the terminal non underlined. */
|
/** Turns off underline so that any following text is printed to the terminal non underlined. */
|
||||||
#define ESC_UNDERLINE_OFF ANSI_ESCAPE_SEQUENCE("24m")
|
#define ESC_UNDERLINE_OFF ANSI_ESCAPE_SEQUENCE("24m")
|
||||||
|
|
||||||
/** Turns off inverse so that any following text is printed to the terminal in non inverted colours. */
|
/** Turns off inverse so that any following text is printed to the terminal in non inverted colours. */
|
||||||
#define ESC_INVERSE_OFF ANSI_ESCAPE_SEQUENCE("27m")
|
#define ESC_INVERSE_OFF ANSI_ESCAPE_SEQUENCE("27m")
|
||||||
|
|
||||||
/** Turns off strikethrough so that any following text is printed to the terminal without a line through
|
/** Turns off strikethrough so that any following text is printed to the terminal without a line through
|
||||||
* the center.
|
* the center.
|
||||||
*/
|
*/
|
||||||
#define ESC_STRIKETHROUGH_OFF ANSI_ESCAPE_SEQUENCE("29m")
|
#define ESC_STRIKETHROUGH_OFF ANSI_ESCAPE_SEQUENCE("29m")
|
||||||
|
|
||||||
/** Sets the foreground (text) colour to black. */
|
/** Sets the foreground (text) colour to black. */
|
||||||
#define ESC_FG_BLACK ANSI_ESCAPE_SEQUENCE("30m")
|
#define ESC_FG_BLACK ANSI_ESCAPE_SEQUENCE("30m")
|
||||||
|
|
||||||
/** Sets the foreground (text) colour to red. */
|
/** Sets the foreground (text) colour to red. */
|
||||||
#define ESC_FG_RED ANSI_ESCAPE_SEQUENCE("31m")
|
#define ESC_FG_RED ANSI_ESCAPE_SEQUENCE("31m")
|
||||||
|
|
||||||
/** Sets the foreground (text) colour to green. */
|
/** Sets the foreground (text) colour to green. */
|
||||||
#define ESC_FG_GREEN ANSI_ESCAPE_SEQUENCE("32m")
|
#define ESC_FG_GREEN ANSI_ESCAPE_SEQUENCE("32m")
|
||||||
|
|
||||||
/** Sets the foreground (text) colour to yellow. */
|
/** Sets the foreground (text) colour to yellow. */
|
||||||
#define ESC_FG_YELLOW ANSI_ESCAPE_SEQUENCE("33m")
|
#define ESC_FG_YELLOW ANSI_ESCAPE_SEQUENCE("33m")
|
||||||
|
|
||||||
/** Sets the foreground (text) colour to blue. */
|
/** Sets the foreground (text) colour to blue. */
|
||||||
#define ESC_FG_BLUE ANSI_ESCAPE_SEQUENCE("34m")
|
#define ESC_FG_BLUE ANSI_ESCAPE_SEQUENCE("34m")
|
||||||
|
|
||||||
/** Sets the foreground (text) colour to magenta. */
|
/** Sets the foreground (text) colour to magenta. */
|
||||||
#define ESC_FG_MAGENTA ANSI_ESCAPE_SEQUENCE("35m")
|
#define ESC_FG_MAGENTA ANSI_ESCAPE_SEQUENCE("35m")
|
||||||
|
|
||||||
/** Sets the foreground (text) colour to cyan. */
|
/** Sets the foreground (text) colour to cyan. */
|
||||||
#define ESC_FG_CYAN ANSI_ESCAPE_SEQUENCE("36m")
|
#define ESC_FG_CYAN ANSI_ESCAPE_SEQUENCE("36m")
|
||||||
|
|
||||||
/** Sets the foreground (text) colour to white. */
|
/** Sets the foreground (text) colour to white. */
|
||||||
#define ESC_FG_WHITE ANSI_ESCAPE_SEQUENCE("37m")
|
#define ESC_FG_WHITE ANSI_ESCAPE_SEQUENCE("37m")
|
||||||
|
|
||||||
/** Sets the foreground (text) colour to the terminal's default. */
|
/** Sets the foreground (text) colour to the terminal's default. */
|
||||||
#define ESC_FG_DEFAULT ANSI_ESCAPE_SEQUENCE("39m")
|
#define ESC_FG_DEFAULT ANSI_ESCAPE_SEQUENCE("39m")
|
||||||
|
|
||||||
/** Sets the text background colour to black. */
|
/** Sets the text background colour to black. */
|
||||||
#define ESC_BG_BLACK ANSI_ESCAPE_SEQUENCE("40m")
|
#define ESC_BG_BLACK ANSI_ESCAPE_SEQUENCE("40m")
|
||||||
|
|
||||||
/** Sets the text background colour to red. */
|
/** Sets the text background colour to red. */
|
||||||
#define ESC_BG_RED ANSI_ESCAPE_SEQUENCE("41m")
|
#define ESC_BG_RED ANSI_ESCAPE_SEQUENCE("41m")
|
||||||
|
|
||||||
/** Sets the text background colour to green. */
|
/** Sets the text background colour to green. */
|
||||||
#define ESC_BG_GREEN ANSI_ESCAPE_SEQUENCE("42m")
|
#define ESC_BG_GREEN ANSI_ESCAPE_SEQUENCE("42m")
|
||||||
|
|
||||||
/** Sets the text background colour to yellow. */
|
/** Sets the text background colour to yellow. */
|
||||||
#define ESC_BG_YELLOW ANSI_ESCAPE_SEQUENCE("43m")
|
#define ESC_BG_YELLOW ANSI_ESCAPE_SEQUENCE("43m")
|
||||||
|
|
||||||
/** Sets the text background colour to blue. */
|
/** Sets the text background colour to blue. */
|
||||||
#define ESC_BG_BLUE ANSI_ESCAPE_SEQUENCE("44m")
|
#define ESC_BG_BLUE ANSI_ESCAPE_SEQUENCE("44m")
|
||||||
|
|
||||||
/** Sets the text background colour to magenta. */
|
/** Sets the text background colour to magenta. */
|
||||||
#define ESC_BG_MAGENTA ANSI_ESCAPE_SEQUENCE("45m")
|
#define ESC_BG_MAGENTA ANSI_ESCAPE_SEQUENCE("45m")
|
||||||
|
|
||||||
/** Sets the text background colour to cyan. */
|
/** Sets the text background colour to cyan. */
|
||||||
#define ESC_BG_CYAN ANSI_ESCAPE_SEQUENCE("46m")
|
#define ESC_BG_CYAN ANSI_ESCAPE_SEQUENCE("46m")
|
||||||
|
|
||||||
/** Sets the text background colour to white. */
|
/** Sets the text background colour to white. */
|
||||||
#define ESC_BG_WHITE ANSI_ESCAPE_SEQUENCE("47m")
|
#define ESC_BG_WHITE ANSI_ESCAPE_SEQUENCE("47m")
|
||||||
|
|
||||||
/** Sets the text background colour to the terminal's default. */
|
/** Sets the text background colour to the terminal's default. */
|
||||||
#define ESC_BG_DEFAULT ANSI_ESCAPE_SEQUENCE("49m")
|
#define ESC_BG_DEFAULT ANSI_ESCAPE_SEQUENCE("49m")
|
||||||
|
|
||||||
/** Sets the cursor position to the given line and column. */
|
/** Sets the cursor position to the given line and column. */
|
||||||
#define ESC_CURSOR_POS(L, C) ANSI_ESCAPE_SEQUENCE(#L ";" #C "H")
|
#define ESC_CURSOR_POS(L, C) ANSI_ESCAPE_SEQUENCE(#L ";" #C "H")
|
||||||
|
|
||||||
/** Moves the cursor up the given number of lines. */
|
/** Moves the cursor up the given number of lines. */
|
||||||
#define ESC_CURSOR_UP(L) ANSI_ESCAPE_SEQUENCE(#L "A")
|
#define ESC_CURSOR_UP(L) ANSI_ESCAPE_SEQUENCE(#L "A")
|
||||||
|
|
||||||
/** Moves the cursor down the given number of lines. */
|
/** Moves the cursor down the given number of lines. */
|
||||||
#define ESC_CURSOR_DOWN(L) ANSI_ESCAPE_SEQUENCE(#L "B")
|
#define ESC_CURSOR_DOWN(L) ANSI_ESCAPE_SEQUENCE(#L "B")
|
||||||
|
|
||||||
/** Moves the cursor to the right the given number of columns. */
|
/** Moves the cursor to the right the given number of columns. */
|
||||||
#define ESC_CURSOR_FORWARD(C) ANSI_ESCAPE_SEQUENCE(#C "C")
|
#define ESC_CURSOR_FORWARD(C) ANSI_ESCAPE_SEQUENCE(#C "C")
|
||||||
|
|
||||||
/** Moves the cursor to the left the given number of columns. */
|
/** Moves the cursor to the left the given number of columns. */
|
||||||
#define ESC_CURSOR_BACKWARD(C) ANSI_ESCAPE_SEQUENCE(#C "D")
|
#define ESC_CURSOR_BACKWARD(C) ANSI_ESCAPE_SEQUENCE(#C "D")
|
||||||
|
|
||||||
/** Saves the current cursor position so that it may be restored with ESC_CURSOR_POS_RESTORE. */
|
/** Saves the current cursor position so that it may be restored with ESC_CURSOR_POS_RESTORE. */
|
||||||
#define ESC_CURSOR_POS_SAVE ANSI_ESCAPE_SEQUENCE("s")
|
#define ESC_CURSOR_POS_SAVE ANSI_ESCAPE_SEQUENCE("s")
|
||||||
|
|
||||||
/** Restores the cursor position to the last position saved with ESC_CURSOR_POS_SAVE. */
|
/** Restores the cursor position to the last position saved with ESC_CURSOR_POS_SAVE. */
|
||||||
#define ESC_CURSOR_POS_RESTORE ANSI_ESCAPE_SEQUENCE("u")
|
#define ESC_CURSOR_POS_RESTORE ANSI_ESCAPE_SEQUENCE("u")
|
||||||
|
|
||||||
/** Erases the entire display, returning the cursor to the top left. */
|
/** Erases the entire display, returning the cursor to the top left. */
|
||||||
#define ESC_ERASE_DISPLAY ANSI_ESCAPE_SEQUENCE("2J")
|
#define ESC_ERASE_DISPLAY ANSI_ESCAPE_SEQUENCE("2J")
|
||||||
|
|
||||||
/** Erases the current line, returning the cursor to the far left. */
|
/** Erases the current line, returning the cursor to the far left. */
|
||||||
#define ESC_ERASE_LINE ANSI_ESCAPE_SEQUENCE("K")
|
#define ESC_ERASE_LINE ANSI_ESCAPE_SEQUENCE("K")
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user