Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of nRF51822 by
TARGET_MCU_NRF51822/source/common/ansi_escape.h@638:c90ae1400bf2, 2016-09-14 (annotated)
- Committer:
- Vincent Coubard
- Date:
- Wed Sep 14 14:39:43 2016 +0100
- Revision:
- 638:c90ae1400bf2
Sync with bdab10dc0f90748b6989c8b577771bb403ca6bd8 from ARMmbed/mbed-os.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Vincent Coubard |
638:c90ae1400bf2 | 1 | /**************************************************************************/ |
| Vincent Coubard |
638:c90ae1400bf2 | 2 | /*! |
| Vincent Coubard |
638:c90ae1400bf2 | 3 | @file ansi_esc_code.h |
| Vincent Coubard |
638:c90ae1400bf2 | 4 | @author hathach (tinyusb.org) |
| Vincent Coubard |
638:c90ae1400bf2 | 5 | |
| Vincent Coubard |
638:c90ae1400bf2 | 6 | @section LICENSE |
| Vincent Coubard |
638:c90ae1400bf2 | 7 | |
| Vincent Coubard |
638:c90ae1400bf2 | 8 | Software License Agreement (BSD License) |
| Vincent Coubard |
638:c90ae1400bf2 | 9 | |
| Vincent Coubard |
638:c90ae1400bf2 | 10 | Copyright (c) 2013, hathach (tinyusb.org) |
| Vincent Coubard |
638:c90ae1400bf2 | 11 | All rights reserved. |
| Vincent Coubard |
638:c90ae1400bf2 | 12 | |
| Vincent Coubard |
638:c90ae1400bf2 | 13 | Redistribution and use in source and binary forms, with or without |
| Vincent Coubard |
638:c90ae1400bf2 | 14 | modification, are permitted provided that the following conditions are met: |
| Vincent Coubard |
638:c90ae1400bf2 | 15 | 1. Redistributions of source code must retain the above copyright |
| Vincent Coubard |
638:c90ae1400bf2 | 16 | notice, this list of conditions and the following disclaimer. |
| Vincent Coubard |
638:c90ae1400bf2 | 17 | 2. Redistributions in binary form must reproduce the above copyright |
| Vincent Coubard |
638:c90ae1400bf2 | 18 | notice, this list of conditions and the following disclaimer in the |
| Vincent Coubard |
638:c90ae1400bf2 | 19 | documentation and/or other materials provided with the distribution. |
| Vincent Coubard |
638:c90ae1400bf2 | 20 | 3. Neither the name of the copyright holders nor the |
| Vincent Coubard |
638:c90ae1400bf2 | 21 | names of its contributors may be used to endorse or promote products |
| Vincent Coubard |
638:c90ae1400bf2 | 22 | derived from this software without specific prior written permission. |
| Vincent Coubard |
638:c90ae1400bf2 | 23 | |
| Vincent Coubard |
638:c90ae1400bf2 | 24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY |
| Vincent Coubard |
638:c90ae1400bf2 | 25 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| Vincent Coubard |
638:c90ae1400bf2 | 26 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| Vincent Coubard |
638:c90ae1400bf2 | 27 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY |
| Vincent Coubard |
638:c90ae1400bf2 | 28 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| Vincent Coubard |
638:c90ae1400bf2 | 29 | INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| Vincent Coubard |
638:c90ae1400bf2 | 30 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION HOWEVER CAUSED AND |
| Vincent Coubard |
638:c90ae1400bf2 | 31 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| Vincent Coubard |
638:c90ae1400bf2 | 32 | INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS |
| Vincent Coubard |
638:c90ae1400bf2 | 33 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| Vincent Coubard |
638:c90ae1400bf2 | 34 | |
| Vincent Coubard |
638:c90ae1400bf2 | 35 | This file is part of the tinyusb stack. |
| Vincent Coubard |
638:c90ae1400bf2 | 36 | */ |
| Vincent Coubard |
638:c90ae1400bf2 | 37 | /**************************************************************************/ |
| Vincent Coubard |
638:c90ae1400bf2 | 38 | |
| Vincent Coubard |
638:c90ae1400bf2 | 39 | /** \file |
| Vincent Coubard |
638:c90ae1400bf2 | 40 | * \brief TBD |
| Vincent Coubard |
638:c90ae1400bf2 | 41 | * |
| Vincent Coubard |
638:c90ae1400bf2 | 42 | * \note TBD |
| Vincent Coubard |
638:c90ae1400bf2 | 43 | */ |
| Vincent Coubard |
638:c90ae1400bf2 | 44 | |
| Vincent Coubard |
638:c90ae1400bf2 | 45 | /** \ingroup TBD |
| Vincent Coubard |
638:c90ae1400bf2 | 46 | * \defgroup TBD |
| Vincent Coubard |
638:c90ae1400bf2 | 47 | * \brief TBD |
| Vincent Coubard |
638:c90ae1400bf2 | 48 | * |
| Vincent Coubard |
638:c90ae1400bf2 | 49 | * @{ |
| Vincent Coubard |
638:c90ae1400bf2 | 50 | */ |
| Vincent Coubard |
638:c90ae1400bf2 | 51 | |
| Vincent Coubard |
638:c90ae1400bf2 | 52 | #ifndef _ANSI_ESC_CODE_H_ |
| Vincent Coubard |
638:c90ae1400bf2 | 53 | #define _ANSI_ESC_CODE_H_ |
| Vincent Coubard |
638:c90ae1400bf2 | 54 | |
| Vincent Coubard |
638:c90ae1400bf2 | 55 | |
| Vincent Coubard |
638:c90ae1400bf2 | 56 | #ifdef __cplusplus |
| Vincent Coubard |
638:c90ae1400bf2 | 57 | extern "C" { |
| Vincent Coubard |
638:c90ae1400bf2 | 58 | #endif |
| Vincent Coubard |
638:c90ae1400bf2 | 59 | |
| Vincent Coubard |
638:c90ae1400bf2 | 60 | #define CSI_CODE(seq) "\33[" seq |
| Vincent Coubard |
638:c90ae1400bf2 | 61 | #define CSI_SGR(x) CSI_CODE(#x) "m" |
| Vincent Coubard |
638:c90ae1400bf2 | 62 | |
| Vincent Coubard |
638:c90ae1400bf2 | 63 | //------------- Cursor movement -------------// |
| Vincent Coubard |
638:c90ae1400bf2 | 64 | #define ANSI_CURSOR_UP(n) CSI_CODE(#n "A") |
| Vincent Coubard |
638:c90ae1400bf2 | 65 | #define ANSI_CURSOR_DOWN(n) CSI_CODE(#n "B") |
| Vincent Coubard |
638:c90ae1400bf2 | 66 | #define ANSI_CURSOR_FORWARD(n) CSI_CODE(#n "C") |
| Vincent Coubard |
638:c90ae1400bf2 | 67 | #define ANSI_CURSOR_BACKWARD(n) CSI_CODE(#n "D") |
| Vincent Coubard |
638:c90ae1400bf2 | 68 | #define ANSI_CURSOR_LINE_DOWN(n) CSI_CODE(#n "E") |
| Vincent Coubard |
638:c90ae1400bf2 | 69 | #define ANSI_CURSOR_LINE_UP(n) CSI_CODE(#n "F") |
| Vincent Coubard |
638:c90ae1400bf2 | 70 | #define ANSI_CURSOR_POSITION(n, m) CSI_CODE(#n ";" #m "H") |
| Vincent Coubard |
638:c90ae1400bf2 | 71 | |
| Vincent Coubard |
638:c90ae1400bf2 | 72 | #define ANSI_ERASE_SCREEN(n) CSI_CODE(#n "J") |
| Vincent Coubard |
638:c90ae1400bf2 | 73 | #define ANSI_ERASE_LINE(n) CSI_CODE(#n "K") |
| Vincent Coubard |
638:c90ae1400bf2 | 74 | |
| Vincent Coubard |
638:c90ae1400bf2 | 75 | /** text color */ |
| Vincent Coubard |
638:c90ae1400bf2 | 76 | #define ANSI_TEXT_BLACK CSI_SGR(30) |
| Vincent Coubard |
638:c90ae1400bf2 | 77 | #define ANSI_TEXT_RED CSI_SGR(31) |
| Vincent Coubard |
638:c90ae1400bf2 | 78 | #define ANSI_TEXT_GREEN CSI_SGR(32) |
| Vincent Coubard |
638:c90ae1400bf2 | 79 | #define ANSI_TEXT_YELLOW CSI_SGR(33) |
| Vincent Coubard |
638:c90ae1400bf2 | 80 | #define ANSI_TEXT_BLUE CSI_SGR(34) |
| Vincent Coubard |
638:c90ae1400bf2 | 81 | #define ANSI_TEXT_MAGENTA CSI_SGR(35) |
| Vincent Coubard |
638:c90ae1400bf2 | 82 | #define ANSI_TEXT_CYAN CSI_SGR(36) |
| Vincent Coubard |
638:c90ae1400bf2 | 83 | #define ANSI_TEXT_WHITE CSI_SGR(37) |
| Vincent Coubard |
638:c90ae1400bf2 | 84 | #define ANSI_TEXT_DEFAULT CSI_SGR(39) |
| Vincent Coubard |
638:c90ae1400bf2 | 85 | |
| Vincent Coubard |
638:c90ae1400bf2 | 86 | /** background color */ |
| Vincent Coubard |
638:c90ae1400bf2 | 87 | #define ANSI_BG_BLACK CSI_SGR(40) |
| Vincent Coubard |
638:c90ae1400bf2 | 88 | #define ANSI_BG_RED CSI_SGR(41) |
| Vincent Coubard |
638:c90ae1400bf2 | 89 | #define ANSI_BG_GREEN CSI_SGR(42) |
| Vincent Coubard |
638:c90ae1400bf2 | 90 | #define ANSI_BG_YELLOW CSI_SGR(43) |
| Vincent Coubard |
638:c90ae1400bf2 | 91 | #define ANSI_BG_BLUE CSI_SGR(44) |
| Vincent Coubard |
638:c90ae1400bf2 | 92 | #define ANSI_BG_MAGENTA CSI_SGR(45) |
| Vincent Coubard |
638:c90ae1400bf2 | 93 | #define ANSI_BG_CYAN CSI_SGR(46) |
| Vincent Coubard |
638:c90ae1400bf2 | 94 | #define ANSI_BG_WHITE CSI_SGR(47) |
| Vincent Coubard |
638:c90ae1400bf2 | 95 | #define ANSI_BG_DEFAULT CSI_SGR(49) |
| Vincent Coubard |
638:c90ae1400bf2 | 96 | |
| Vincent Coubard |
638:c90ae1400bf2 | 97 | #ifdef __cplusplus |
| Vincent Coubard |
638:c90ae1400bf2 | 98 | } |
| Vincent Coubard |
638:c90ae1400bf2 | 99 | #endif |
| Vincent Coubard |
638:c90ae1400bf2 | 100 | |
| Vincent Coubard |
638:c90ae1400bf2 | 101 | #endif /* _TUSB_ANSI_ESC_CODE_H_ */ |
| Vincent Coubard |
638:c90ae1400bf2 | 102 | |
| Vincent Coubard |
638:c90ae1400bf2 | 103 | /** @} */ |
