Nut/OS  4.10.3
API Reference
spi_7seg.h
Go to the documentation of this file.
00001 #ifndef _DEV_SPI_7SEG_H_
00002 #define _DEV_SPI_7SEG_H_
00003 /*
00004  * Copyright (C) 2009 by Ulrich Prinz (uprinz2@netscape.net)
00005  * Copyright (C) 2009 by Rittal GmbH & Co. KG. All rights reserved.
00006  *
00007  * All rights reserved.
00008  *
00009  * Redistribution and use in source and binary forms, with or without
00010  * modification, are permitted provided that the following conditions
00011  * are met:
00012  *
00013  * 1. Redistributions of source code must retain the above copyright
00014  *    notice, this list of conditions and the following disclaimer.
00015  * 2. Redistributions in binary form must reproduce the above copyright
00016  *    notice, this list of conditions and the following disclaimer in the
00017  *    documentation and/or other materials provided with the distribution.
00018  * 3. Neither the name of the copyright holders nor the names of
00019  *    contributors may be used to endorse or promote products derived
00020  *    from this software without specific prior written permission.
00021  *
00022  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00023  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00024  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00025  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00026  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00027  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00028  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
00029  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
00030  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00031  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
00032  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00033  * SUCH DAMAGE.
00034  *
00035  * For additional information see http://www.ethernut.de/
00036  */
00037 
00047 #include <sys/device.h>
00048 #include <dev/spibus.h>
00049 
00050 extern NUTSPINODE nodeSpi7SEG;
00051 extern NUTDEVICE devSpi7SEG;
00052 
00053 #ifndef ESC_CHAR
00054 #define ESC_CHAR        "\x1B"
00055 #endif
00056 
00057 /* 7 Segment Display commands for use in fprintf */
00058 #define CLR_7SEG    ESC_CHAR "c"    /*< \brief Clear display and reset write position. */
00059 #define BLS_7SEG    ESC_CHAR "b"    /*< \brief Set display blinking 0.5Hz. */
00060 #define BLF_7SEG    ESC_CHAR "f"    /*< \brief Set display blinking 2Hz. */
00061 #define NOR_7SEG    ESC_CHAR "n"    /*< \brief Set display to normal mode. */
00062 #define HOME_7SEG   ESC_CHAR "h"    /*< \brief Set write position home. */
00063 #define TEST_7SEG   ESC_CHAR "t"    /*< \brief Enable test mode of display (all segments on). */
00064 #define INT_7SEG    ESC_CHAR "i"    /*< \brief Set intensity of display ( "0".."f"). */
00065 
00066 /* 7 Segment Display dot extra functions */
00067 #define DOT_7SEG_CLR  0     /*< \brief Clear the decimal dot of a digit. */
00068 #define DOT_7SEG_SET  1     /*< \brief Set the decimal dot of a digit. */
00069 #define DOT_7SEG_FLIP 2     /*< \brief Invert the decimal dot of a digit. */
00070 
00071 __BEGIN_DECLS
00072 /* Prototypes */
00073 void Spi7segDot(NUTDEVICE * dev, uint8_t pos, uint8_t act);
00074 extern int Spi7segCommand(NUTDEVICE * dev, uint8_t addr, CONST void *txbuf, void *rxbuf, int xlen);
00075 /* Prototypes */
00076 __BEGIN_DECLS
00077 
00078 #endif