My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

lpc17xx_gpio.h 7.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. /**********************************************************************
  2. * $Id$ lpc17xx_gpio.h 2010-06-18
  3. *//**
  4. * @file lpc17xx_gpio.h
  5. * @brief Contains all macro definitions and function prototypes
  6. * support for GPDMA firmware library on LPC17xx
  7. * @version 3.0
  8. * @date 18. June. 2010
  9. * @author NXP MCU SW Application Team
  10. *
  11. * Copyright(C) 2010, NXP Semiconductor
  12. * All rights reserved.
  13. *
  14. ***********************************************************************
  15. * Software that is described herein is for illustrative purposes only
  16. * which provides customers with programming information regarding the
  17. * products. This software is supplied "AS IS" without any warranties.
  18. * NXP Semiconductors assumes no responsibility or liability for the
  19. * use of the software, conveys no license or title under any patent,
  20. * copyright, or mask work right to the product. NXP Semiconductors
  21. * reserves the right to make changes in the software without
  22. * notification. NXP Semiconductors also make no representation or
  23. * warranty that such application will be suitable for the specified
  24. * use without further testing or modification.
  25. * Permission to use, copy, modify, and distribute this software and its
  26. * documentation is hereby granted, under NXP Semiconductors'
  27. * relevant copyright in the software, without fee, provided that it
  28. * is used in conjunction with NXP Semiconductors microcontrollers. This
  29. * copyright, permission, and disclaimer notice must appear in all copies of
  30. * this code.
  31. **********************************************************************/
  32. /* Peripheral group ----------------------------------------------------------- */
  33. /** @defgroup GPIO GPIO (General Purpose Input/Output)
  34. * @ingroup LPC1700CMSIS_FwLib_Drivers
  35. * @{
  36. */
  37. #ifndef LPC17XX_GPIO_H_
  38. #define LPC17XX_GPIO_H_
  39. /* Includes ------------------------------------------------------------------- */
  40. #include "LPC17xx.h"
  41. #include "lpc_types.h"
  42. #ifdef __cplusplus
  43. extern "C"
  44. {
  45. #endif
  46. /* Public Macros -------------------------------------------------------------- */
  47. /** @defgroup GPIO_Public_Macros GPIO Public Macros
  48. * @{
  49. */
  50. /** Fast GPIO port 0 byte accessible definition */
  51. #define GPIO0_Byte ((GPIO_Byte_TypeDef *)(LPC_GPIO0_BASE))
  52. /** Fast GPIO port 1 byte accessible definition */
  53. #define GPIO1_Byte ((GPIO_Byte_TypeDef *)(LPC_GPIO1_BASE))
  54. /** Fast GPIO port 2 byte accessible definition */
  55. #define GPIO2_Byte ((GPIO_Byte_TypeDef *)(LPC_GPIO2_BASE))
  56. /** Fast GPIO port 3 byte accessible definition */
  57. #define GPIO3_Byte ((GPIO_Byte_TypeDef *)(LPC_GPIO3_BASE))
  58. /** Fast GPIO port 4 byte accessible definition */
  59. #define GPIO4_Byte ((GPIO_Byte_TypeDef *)(LPC_GPIO4_BASE))
  60. /** Fast GPIO port 0 half-word accessible definition */
  61. #define GPIO0_HalfWord ((GPIO_HalfWord_TypeDef *)(LPC_GPIO0_BASE))
  62. /** Fast GPIO port 1 half-word accessible definition */
  63. #define GPIO1_HalfWord ((GPIO_HalfWord_TypeDef *)(LPC_GPIO1_BASE))
  64. /** Fast GPIO port 2 half-word accessible definition */
  65. #define GPIO2_HalfWord ((GPIO_HalfWord_TypeDef *)(LPC_GPIO2_BASE))
  66. /** Fast GPIO port 3 half-word accessible definition */
  67. #define GPIO3_HalfWord ((GPIO_HalfWord_TypeDef *)(LPC_GPIO3_BASE))
  68. /** Fast GPIO port 4 half-word accessible definition */
  69. #define GPIO4_HalfWord ((GPIO_HalfWord_TypeDef *)(LPC_GPIO4_BASE))
  70. /**
  71. * @}
  72. */
  73. /* Public Types --------------------------------------------------------------- */
  74. /** @defgroup GPIO_Public_Types GPIO Public Types
  75. * @{
  76. */
  77. /**
  78. * @brief Fast GPIO port byte type definition
  79. */
  80. typedef struct {
  81. __IO uint8_t FIODIR[4]; /**< FIO direction register in byte-align */
  82. uint32_t RESERVED0[3]; /**< Reserved */
  83. __IO uint8_t FIOMASK[4]; /**< FIO mask register in byte-align */
  84. __IO uint8_t FIOPIN[4]; /**< FIO pin register in byte align */
  85. __IO uint8_t FIOSET[4]; /**< FIO set register in byte-align */
  86. __O uint8_t FIOCLR[4]; /**< FIO clear register in byte-align */
  87. } GPIO_Byte_TypeDef;
  88. /**
  89. * @brief Fast GPIO port half-word type definition
  90. */
  91. typedef struct {
  92. __IO uint16_t FIODIRL; /**< FIO direction register lower halfword part */
  93. __IO uint16_t FIODIRU; /**< FIO direction register upper halfword part */
  94. uint32_t RESERVED0[3]; /**< Reserved */
  95. __IO uint16_t FIOMASKL; /**< FIO mask register lower halfword part */
  96. __IO uint16_t FIOMASKU; /**< FIO mask register upper halfword part */
  97. __IO uint16_t FIOPINL; /**< FIO pin register lower halfword part */
  98. __IO uint16_t FIOPINU; /**< FIO pin register upper halfword part */
  99. __IO uint16_t FIOSETL; /**< FIO set register lower halfword part */
  100. __IO uint16_t FIOSETU; /**< FIO set register upper halfword part */
  101. __O uint16_t FIOCLRL; /**< FIO clear register lower halfword part */
  102. __O uint16_t FIOCLRU; /**< FIO clear register upper halfword part */
  103. } GPIO_HalfWord_TypeDef;
  104. /**
  105. * @}
  106. */
  107. /* Public Functions ----------------------------------------------------------- */
  108. /** @defgroup GPIO_Public_Functions GPIO Public Functions
  109. * @{
  110. */
  111. /* GPIO style ------------------------------- */
  112. void GPIO_SetDir(uint8_t portNum, uint32_t bitValue, uint8_t dir);
  113. void GPIO_SetValue(uint8_t portNum, uint32_t bitValue);
  114. void GPIO_ClearValue(uint8_t portNum, uint32_t bitValue);
  115. uint32_t GPIO_ReadValue(uint8_t portNum);
  116. void GPIO_IntCmd(uint8_t portNum, uint32_t bitValue, uint8_t edgeState);
  117. FunctionalState GPIO_GetIntStatus(uint8_t portNum, uint32_t pinNum, uint8_t edgeState);
  118. void GPIO_ClearInt(uint8_t portNum, uint32_t bitValue);
  119. /* FIO (word-accessible) style ------------------------------- */
  120. void FIO_SetDir(uint8_t portNum, uint32_t bitValue, uint8_t dir);
  121. void FIO_SetValue(uint8_t portNum, uint32_t bitValue);
  122. void FIO_ClearValue(uint8_t portNum, uint32_t bitValue);
  123. uint32_t FIO_ReadValue(uint8_t portNum);
  124. void FIO_SetMask(uint8_t portNum, uint32_t bitValue, uint8_t maskValue);
  125. void FIO_IntCmd(uint8_t portNum, uint32_t bitValue, uint8_t edgeState);
  126. FunctionalState FIO_GetIntStatus(uint8_t portNum, uint32_t pinNum, uint8_t edgeState);
  127. void FIO_ClearInt(uint8_t portNum, uint32_t pinNum);
  128. /* FIO (halfword-accessible) style ------------------------------- */
  129. void FIO_HalfWordSetDir(uint8_t portNum, uint8_t halfwordNum, uint16_t bitValue, uint8_t dir);
  130. void FIO_HalfWordSetMask(uint8_t portNum, uint8_t halfwordNum, uint16_t bitValue, uint8_t maskValue);
  131. void FIO_HalfWordSetValue(uint8_t portNum, uint8_t halfwordNum, uint16_t bitValue);
  132. void FIO_HalfWordClearValue(uint8_t portNum, uint8_t halfwordNum, uint16_t bitValue);
  133. uint16_t FIO_HalfWordReadValue(uint8_t portNum, uint8_t halfwordNum);
  134. /* FIO (byte-accessible) style ------------------------------- */
  135. void FIO_ByteSetDir(uint8_t portNum, uint8_t byteNum, uint8_t bitValue, uint8_t dir);
  136. void FIO_ByteSetMask(uint8_t portNum, uint8_t byteNum, uint8_t bitValue, uint8_t maskValue);
  137. void FIO_ByteSetValue(uint8_t portNum, uint8_t byteNum, uint8_t bitValue);
  138. void FIO_ByteClearValue(uint8_t portNum, uint8_t byteNum, uint8_t bitValue);
  139. uint8_t FIO_ByteReadValue(uint8_t portNum, uint8_t byteNum);
  140. /**
  141. * @}
  142. */
  143. #ifdef __cplusplus
  144. }
  145. #endif
  146. #endif /* LPC17XX_GPIO_H_ */
  147. /**
  148. * @}
  149. */
  150. /* --------------------------------- End Of File ------------------------------ */