spi_7seg.h 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #ifndef _DEV_SPI_7SEG_H_
  2. #define _DEV_SPI_7SEG_H_
  3. /*
  4. * Copyright (C) 2009 by Ulrich Prinz (uprinz2@netscape.net)
  5. * Copyright (C) 2009 by Rittal GmbH & Co. KG. All rights reserved.
  6. *
  7. * All rights reserved.
  8. *
  9. * Redistribution and use in source and binary forms, with or without
  10. * modification, are permitted provided that the following conditions
  11. * are met:
  12. *
  13. * 1. Redistributions of source code must retain the above copyright
  14. * notice, this list of conditions and the following disclaimer.
  15. * 2. Redistributions in binary form must reproduce the above copyright
  16. * notice, this list of conditions and the following disclaimer in the
  17. * documentation and/or other materials provided with the distribution.
  18. * 3. Neither the name of the copyright holders nor the names of
  19. * contributors may be used to endorse or promote products derived
  20. * from this software without specific prior written permission.
  21. *
  22. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  23. * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  24. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  25. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  26. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  27. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  28. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  29. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  30. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  31. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  32. * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  33. * SUCH DAMAGE.
  34. *
  35. * For additional information see http://www.ethernut.de/
  36. */
  37. /*!
  38. * \file include/dev/spi_7seg.h
  39. * \brief ntrx
  40. *
  41. * \verbatim
  42. * $Id: spi_ntrx.h$
  43. * \endverbatim
  44. */
  45. #include <sys/device.h>
  46. #include <dev/spibus.h>
  47. extern NUTSPINODE nodeSpi7SEG;
  48. extern NUTDEVICE devSpi7SEG;
  49. #ifndef ESC_CHAR
  50. #define ESC_CHAR "\x1B"
  51. #endif
  52. /* 7 Segment Display commands for use in fprintf */
  53. #define CLR_7SEG ESC_CHAR "c" /*< \brief Clear display and reset write position. */
  54. #define BLS_7SEG ESC_CHAR "b" /*< \brief Set display blinking 0.5Hz. */
  55. #define BLF_7SEG ESC_CHAR "f" /*< \brief Set display blinking 2Hz. */
  56. #define NOR_7SEG ESC_CHAR "n" /*< \brief Set display to normal mode. */
  57. #define HOME_7SEG ESC_CHAR "h" /*< \brief Set write position home. */
  58. #define TEST_7SEG ESC_CHAR "t" /*< \brief Enable test mode of display (all segments on). */
  59. #define INT_7SEG ESC_CHAR "i" /*< \brief Set intensity of display ( "0".."f"). */
  60. /* 7 Segment Display dot extra functions */
  61. #define DOT_7SEG_CLR 0 /*< \brief Clear the decimal dot of a digit. */
  62. #define DOT_7SEG_SET 1 /*< \brief Set the decimal dot of a digit. */
  63. #define DOT_7SEG_FLIP 2 /*< \brief Invert the decimal dot of a digit. */
  64. void Spi7segDot(NUTDEVICE * dev, uint8_t pos, uint8_t act);
  65. extern int Spi7segCommand(NUTDEVICE * dev, uint8_t addr, const void *txbuf, void *rxbuf, int xlen);
  66. #endif