You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

135 lines
3.9 KiB

  1. /*
  2. LUFA Library
  3. Copyright (C) Dean Camera, 2012.
  4. dean [at] fourwalledcubicle [dot] com
  5. www.lufa-lib.org
  6. */
  7. /*
  8. Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
  9. Permission to use, copy, modify, distribute, and sell this
  10. software and its documentation for any purpose is hereby granted
  11. without fee, provided that the above copyright notice appear in
  12. all copies and that both that the copyright notice and this
  13. permission notice and warranty disclaimer appear in supporting
  14. documentation, and that the name of the author not be used in
  15. advertising or publicity pertaining to distribution of the
  16. software without specific, written prior permission.
  17. The author disclaim all warranties with regard to this
  18. software, including all implied warranties of merchantability
  19. and fitness. In no event shall the author be liable for any
  20. special, indirect or consequential damages or any damages
  21. whatsoever resulting from loss of use, data or profits, whether
  22. in an action of contract, negligence or other tortious action,
  23. arising out of or in connection with the use or performance of
  24. this software.
  25. */
  26. /** \file
  27. * \brief Board specific LED driver header for the Microsin AVR-USB162 board.
  28. * \copydetails Group_LEDs_MICROSIN162
  29. *
  30. * \note This file should not be included directly. It is automatically included as needed by the LEDs driver
  31. * dispatch header located in LUFA/Drivers/Board/LEDs.h.
  32. */
  33. /** \ingroup Group_LEDs
  34. * \defgroup Group_LEDs_MICROSIN162 MICROSIN162
  35. * \brief Board specific LED driver header for the Microsin AVR-USB162 board.
  36. *
  37. * Board specific LED driver header for the Microsin AVR-USB162 board (http://microsin.ru/content/view/685/44/).
  38. *
  39. * <table>
  40. * <tr><th>Name</th><th>Color</th><th>Info</th><th>Active Level</th><th>Port Pin</th></tr>
  41. * <tr><td>LEDS_LED1</td><td>Green</td><td>General Indicator</td><td>Low</td><td>PORTD.4</td></tr>
  42. * </table>
  43. *
  44. * @{
  45. */
  46. #ifndef __LEDS_MICROSIN162_H__
  47. #define __LEDS_MICROSIN162_H__
  48. /* Includes: */
  49. #include "../../../../Common/Common.h"
  50. /* Enable C linkage for C++ Compilers: */
  51. #if defined(__cplusplus)
  52. extern "C" {
  53. #endif
  54. /* Preprocessor Checks: */
  55. #if !defined(__INCLUDE_FROM_LEDS_H)
  56. #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead.
  57. #endif
  58. /* Public Interface - May be used in end-application: */
  59. /* Macros: */
  60. /** LED mask for the first LED on the board. */
  61. #define LEDS_LED1 (1 << 4)
  62. /** LED mask for all the LEDs on the board. */
  63. #define LEDS_ALL_LEDS LEDS_LED1
  64. /** LED mask for none of the board LEDs. */
  65. #define LEDS_NO_LEDS 0
  66. /* Inline Functions: */
  67. #if !defined(__DOXYGEN__)
  68. static inline void LEDs_Init(void)
  69. {
  70. DDRD |= LEDS_ALL_LEDS;
  71. PORTD |= LEDS_ALL_LEDS;
  72. }
  73. static inline void LEDs_Disable(void)
  74. {
  75. DDRD &= ~LEDS_ALL_LEDS;
  76. PORTD &= ~LEDS_ALL_LEDS;
  77. }
  78. static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
  79. {
  80. PORTD &= ~LEDMask;
  81. }
  82. static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask)
  83. {
  84. PORTD |= LEDMask;
  85. }
  86. static inline void LEDs_SetAllLEDs(const uint8_t LEDMask)
  87. {
  88. PORTD = ((PORTD | LEDS_ALL_LEDS) & ~LEDMask);
  89. }
  90. static inline void LEDs_ChangeLEDs(const uint8_t LEDMask,
  91. const uint8_t ActiveMask)
  92. {
  93. PORTD = ((PORTD | LEDMask) & ~ActiveMask);
  94. }
  95. static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
  96. {
  97. PIND = LEDMask;
  98. }
  99. static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
  100. static inline uint8_t LEDs_GetLEDs(void)
  101. {
  102. return (~PORTD & LEDS_ALL_LEDS);
  103. }
  104. #endif
  105. /* Disable C linkage for C++ Compilers: */
  106. #if defined(__cplusplus)
  107. }
  108. #endif
  109. #endif
  110. /** @} */