This is a port of Henning Kralsen's UTFT library for Arduino/chipKIT to mbed, refactored to make full use of C++ inheritance and access control, in order to reduce work when implementing new drivers and at the same time make the code more readable and easier to maintain. As of now supported are SSD1289 (16-bit interface), HX8340-B (serial interface) and ST7735 (serial interface). Drivers for other controllers will be added as time and resources to acquire the displays to test the code permit.

Dependents:   test SDCard capstone_display capstone_display_2 ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers helpers.h Source File

helpers.h

Go to the documentation of this file.
00001 /** \file helpers.h
00002  *  \brief Utility functions and macros.
00003  *  \copyright GNU Public License, v2. or later
00004  *
00005  * This library is based on the Arduino/chipKIT UTFT library by Henning
00006  * Karlsen, http://henningkarlsen.com/electronics/library.php?id=52
00007  *
00008  * Copyright (C)2010-2012 Henning Karlsen. All right reserved.
00009  *
00010  * Copyright (C)2012 Todor Todorov.
00011  *
00012  * This library is free software; you can redistribute it and/or
00013  * modify it under the terms of the GNU Lesser General Public
00014  * License as published by the Free Software Foundation; either
00015  * version 2.1 of the License, or (at your option) any later version.
00016  *
00017  * This library is distributed in the hope that it will be useful,
00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00020  * Lesser General Public License for more details.
00021  *
00022  * You should have received a copy of the GNU Lesser General Public
00023  * License along with this library; if not, write to:
00024  *
00025  * Free Software Foundation, Inc.
00026  * 51 Franklin St, 5th Floor, Boston, MA 02110-1301, USA
00027  *
00028  *********************************************************************/
00029 #ifndef TFTLCD_HELPERS_H
00030 #define TFTLCD_HELPERS_H
00031 
00032 #include "mbed.h"
00033 
00034 /** \def HIGH
00035  *  \brief User-friendly high pin level designation.
00036  */
00037 #define HIGH                    1
00038 /** \def LOW
00039  *  \brief User-friendly low pin level designation.
00040  */
00041 #define LOW                     0
00042 
00043 /** \def swap( type, a, b )
00044  *  \brief Convenience macro to swap two values.
00045  */
00046 #define swap( type, a, b )      { type tmp = ( a ); ( a ) = ( b ); ( b ) = tmp; }
00047 
00048 /** \def pulseLow( pin )
00049  *  \brief Toggles a pin low, then high.
00050  */
00051 #define pulseLow( pin )         pin = LOW; pin = HIGH
00052 
00053 /** \def pulseHigh( pin )
00054  *  \brief Toggles a pin high, then low.
00055  */
00056 #define pulseHigh( pin )        pin = HIGH; pin = LOW
00057 
00058 #ifndef ushort
00059 typedef unsigned short ushort;
00060 #endif
00061 
00062 #endif /* TFTLCD_HELPERS_H */