ssd1963
helpers.h@4:84a51911fb31, 2020-10-16 (annotated)
- Committer:
- sPymbed
- Date:
- Fri Oct 16 17:39:40 2020 +0000
- Revision:
- 4:84a51911fb31
- Parent:
- 2:d8a9ebd28f0a
fixed: backlight
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sPymbed | 2:d8a9ebd28f0a | 1 | /** \file helpers.h |
sPymbed | 2:d8a9ebd28f0a | 2 | * \brief Utility functions and macros. |
sPymbed | 2:d8a9ebd28f0a | 3 | * \copyright GNU Public License, v2. or later |
sPymbed | 2:d8a9ebd28f0a | 4 | * |
sPymbed | 2:d8a9ebd28f0a | 5 | * This library is based on the Arduino/chipKIT UTFT library by Henning |
sPymbed | 2:d8a9ebd28f0a | 6 | * Karlsen, http://henningkarlsen.com/electronics/library.php?id=52 |
sPymbed | 2:d8a9ebd28f0a | 7 | * |
sPymbed | 2:d8a9ebd28f0a | 8 | * Copyright (C)2010-2012 Henning Karlsen. All right reserved. |
sPymbed | 2:d8a9ebd28f0a | 9 | * |
sPymbed | 2:d8a9ebd28f0a | 10 | * Copyright (C)2012 Todor Todorov. |
sPymbed | 2:d8a9ebd28f0a | 11 | * |
sPymbed | 2:d8a9ebd28f0a | 12 | * This library is free software; you can redistribute it and/or |
sPymbed | 2:d8a9ebd28f0a | 13 | * modify it under the terms of the GNU Lesser General Public |
sPymbed | 2:d8a9ebd28f0a | 14 | * License as published by the Free Software Foundation; either |
sPymbed | 2:d8a9ebd28f0a | 15 | * version 2.1 of the License, or (at your option) any later version. |
sPymbed | 2:d8a9ebd28f0a | 16 | * |
sPymbed | 2:d8a9ebd28f0a | 17 | * This library is distributed in the hope that it will be useful, |
sPymbed | 2:d8a9ebd28f0a | 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
sPymbed | 2:d8a9ebd28f0a | 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
sPymbed | 2:d8a9ebd28f0a | 20 | * Lesser General Public License for more details. |
sPymbed | 2:d8a9ebd28f0a | 21 | * |
sPymbed | 2:d8a9ebd28f0a | 22 | * You should have received a copy of the GNU Lesser General Public |
sPymbed | 2:d8a9ebd28f0a | 23 | * License along with this library; if not, write to: |
sPymbed | 2:d8a9ebd28f0a | 24 | * |
sPymbed | 2:d8a9ebd28f0a | 25 | * Free Software Foundation, Inc. |
sPymbed | 2:d8a9ebd28f0a | 26 | * 51 Franklin St, 5th Floor, Boston, MA 02110-1301, USA |
sPymbed | 2:d8a9ebd28f0a | 27 | * |
sPymbed | 2:d8a9ebd28f0a | 28 | *********************************************************************/ |
sPymbed | 2:d8a9ebd28f0a | 29 | #ifndef TFTLCD_HELPERS_H |
sPymbed | 2:d8a9ebd28f0a | 30 | #define TFTLCD_HELPERS_H |
sPymbed | 2:d8a9ebd28f0a | 31 | |
sPymbed | 2:d8a9ebd28f0a | 32 | #include "mbed.h" |
sPymbed | 2:d8a9ebd28f0a | 33 | |
sPymbed | 2:d8a9ebd28f0a | 34 | /** \def HIGH |
sPymbed | 2:d8a9ebd28f0a | 35 | * \brief User-friendly high pin level designation. |
sPymbed | 2:d8a9ebd28f0a | 36 | */ |
sPymbed | 2:d8a9ebd28f0a | 37 | #define HIGH 1 |
sPymbed | 2:d8a9ebd28f0a | 38 | /** \def LOW |
sPymbed | 2:d8a9ebd28f0a | 39 | * \brief User-friendly low pin level designation. |
sPymbed | 2:d8a9ebd28f0a | 40 | */ |
sPymbed | 2:d8a9ebd28f0a | 41 | #define LOW 0 |
sPymbed | 2:d8a9ebd28f0a | 42 | |
sPymbed | 2:d8a9ebd28f0a | 43 | /** \def swap( type, a, b ) |
sPymbed | 2:d8a9ebd28f0a | 44 | * \brief Convenience macro to swap two values. |
sPymbed | 2:d8a9ebd28f0a | 45 | */ |
sPymbed | 2:d8a9ebd28f0a | 46 | #define swap( type, a, b ) { type tmp = ( a ); ( a ) = ( b ); ( b ) = tmp; } |
sPymbed | 2:d8a9ebd28f0a | 47 | |
sPymbed | 2:d8a9ebd28f0a | 48 | /** \def pulseLow( pin ) |
sPymbed | 2:d8a9ebd28f0a | 49 | * \brief Toggles a pin low, then high. |
sPymbed | 2:d8a9ebd28f0a | 50 | */ |
sPymbed | 2:d8a9ebd28f0a | 51 | #define pulseLow( pin ) pin = LOW; pin = HIGH |
sPymbed | 2:d8a9ebd28f0a | 52 | |
sPymbed | 2:d8a9ebd28f0a | 53 | /** \def pulseHigh( pin ) |
sPymbed | 2:d8a9ebd28f0a | 54 | * \brief Toggles a pin high, then low. |
sPymbed | 2:d8a9ebd28f0a | 55 | */ |
sPymbed | 2:d8a9ebd28f0a | 56 | #define pulseHigh( pin ) pin = HIGH; pin = LOW |
sPymbed | 2:d8a9ebd28f0a | 57 | |
sPymbed | 2:d8a9ebd28f0a | 58 | #ifndef ushort |
sPymbed | 2:d8a9ebd28f0a | 59 | typedef unsigned short ushort; |
sPymbed | 2:d8a9ebd28f0a | 60 | #endif |
sPymbed | 2:d8a9ebd28f0a | 61 | |
sPymbed | 2:d8a9ebd28f0a | 62 | #endif /* TFTLCD_HELPERS_H */ |