Keyboard firmwares for Atmel AVR and Cortex-M
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.

LEDs.h 5.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. /*
  2. LUFA Library
  3. Copyright (C) Dean Camera, 2014.
  4. dean [at] fourwalledcubicle [dot] com
  5. www.lufa-lib.org
  6. */
  7. /*
  8. Copyright 2014 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 disclaims 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 Atmel EVK1100.
  28. * \copydetails Group_LEDs_EVK1100
  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_EVK1100 EVK1100
  35. * \brief Board specific LED driver header for the Atmel EVK1100.
  36. *
  37. * Board specific LED driver header for the Atmel EVK1100.
  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>LED0 LED</td><td>Low</td><td>GPIO51</td></tr>
  42. * <tr><td>LEDS_LED2</td><td>Green</td><td>LED1 LED</td><td>Low</td><td>GPIO52</td></tr>
  43. * <tr><td>LEDS_LED3</td><td>Green</td><td>LED2 LED</td><td>Low</td><td>GPIO53</td></tr>
  44. * <tr><td>LEDS_LED4</td><td>Green</td><td>LED3 LED</td><td>Low</td><td>GPIO54</td></tr>
  45. * <tr><td>LEDS_LED5</td><td>Green</td><td>LED4 LED</td><td>Low</td><td>GPIO59</td></tr>
  46. * <tr><td>LEDS_LED6</td><td>Green</td><td>LED5 LED</td><td>Low</td><td>GPIO60</td></tr>
  47. * <tr><td>LEDS_LED7</td><td>Green</td><td>LED6 LED</td><td>Low</td><td>GPIO61</td></tr>
  48. * <tr><td>LEDS_LED8</td><td>Green</td><td>LED7 LED</td><td>Low</td><td>GPIO62</td></tr>
  49. * </table>
  50. *
  51. * @{
  52. */
  53. #ifndef __LEDS_EVK1100_H__
  54. #define __LEDS_EVK1100_H__
  55. /* Includes: */
  56. #include "../../../../Common/Common.h"
  57. /* Enable C linkage for C++ Compilers: */
  58. #if defined(__cplusplus)
  59. extern "C" {
  60. #endif
  61. /* Preprocessor Checks: */
  62. #if !defined(__INCLUDE_FROM_LEDS_H)
  63. #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead.
  64. #endif
  65. /* Private Interface - For use in library only: */
  66. #if !defined(__DOXYGEN__)
  67. /* Macros: */
  68. #define LEDS_PORT 1
  69. #endif
  70. /* Public Interface - May be used in end-application: */
  71. /* Macros: */
  72. /** LED mask for the first LED on the board. */
  73. #define LEDS_LED1 (1UL << 19)
  74. /** LED mask for the second LED on the board. */
  75. #define LEDS_LED2 (1UL << 20)
  76. /** LED mask for the third LED on the board. */
  77. #define LEDS_LED3 (1UL << 21)
  78. /** LED mask for the fourth LED on the board. */
  79. #define LEDS_LED4 (1UL << 22)
  80. /** LED mask for the fifth LED on the board. */
  81. #define LEDS_LED5 (1UL << 27)
  82. /** LED mask for the sixth LED on the board. */
  83. #define LEDS_LED6 (1UL << 28)
  84. /** LED mask for the seventh LED on the board. */
  85. #define LEDS_LED7 (1UL << 29)
  86. /** LED mask for the eighth LED on the board. */
  87. #define LEDS_LED8 (1UL << 30)
  88. /** LED mask for all the LEDs on the board. */
  89. #define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2 | LEDS_LED3 | LEDS_LED4 \
  90. LEDS_LED5 | LEDS_LED6 | LEDS_LED7 | LEDS_LED8)
  91. /** LED mask for the none of the board LEDs */
  92. #define LEDS_NO_LEDS 0
  93. /* Inline Functions: */
  94. #if !defined(__DOXYGEN__)
  95. static inline void LEDs_Init(void)
  96. {
  97. AVR32_GPIO.port[LEDS_PORT].gpers = LEDS_ALL_LEDS;
  98. AVR32_GPIO.port[LEDS_PORT].oders = LEDS_ALL_LEDS;
  99. AVR32_GPIO.port[LEDS_PORT].ovrs = LEDS_ALL_LEDS;
  100. }
  101. static inline void LEDs_Disable(void)
  102. {
  103. AVR32_GPIO.port[LEDS_PORT].gperc = LEDS_ALL_LEDS;
  104. AVR32_GPIO.port[LEDS_PORT].oderc = LEDS_ALL_LEDS;
  105. AVR32_GPIO.port[LEDS_PORT].ovrc = LEDS_ALL_LEDS;
  106. }
  107. static inline void LEDs_TurnOnLEDs(const uint32_t LEDMask)
  108. {
  109. AVR32_GPIO.port[LEDS_PORT].ovrc = LEDMask;
  110. }
  111. static inline void LEDs_TurnOffLEDs(const uint32_t LEDMask)
  112. {
  113. AVR32_GPIO.port[LEDS_PORT].ovrs = LEDMask;
  114. }
  115. static inline void LEDs_SetAllLEDs(const uint32_t LEDMask)
  116. {
  117. AVR32_GPIO.port[LEDS_PORT].ovrs = LEDS_ALL_LEDS;
  118. AVR32_GPIO.port[LEDS_PORT].ovrc = LEDMask;
  119. }
  120. static inline void LEDs_ChangeLEDs(const uint32_t LEDMask, const uint32_t ActiveMask)
  121. {
  122. AVR32_GPIO.port[LEDS_PORT].ovrs = LEDMask;
  123. AVR32_GPIO.port[LEDS_PORT].ovrc = ActiveMask;
  124. }
  125. static inline void LEDs_ToggleLEDs(const uint32_t LEDMask)
  126. {
  127. AVR32_GPIO.port[LEDS_PORT].ovrt = LEDMask;
  128. }
  129. static inline uint32_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
  130. static inline uint32_t LEDs_GetLEDs(void)
  131. {
  132. return (~AVR32_GPIO.port[LEDS_PORT].ovr & LEDS_ALL_LEDS);
  133. }
  134. #endif
  135. /* Disable C linkage for C++ Compilers: */
  136. #if defined(__cplusplus)
  137. }
  138. #endif
  139. #endif
  140. /** @} */