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_dac.h 4.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. /**********************************************************************
  2. * $Id$ lpc17xx_dac.h 2010-05-21
  3. *//**
  4. * @file lpc17xx_dac.h
  5. * @brief Contains all macro definitions and function prototypes
  6. * support for Clock and Power Control firmware library on LPC17xx
  7. * @version 2.0
  8. * @date 21. May. 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 DAC DAC (Digital-to-Analog Controller)
  34. * @ingroup LPC1700CMSIS_FwLib_Drivers
  35. * @{
  36. */
  37. #ifndef LPC17XX_DAC_H_
  38. #define LPC17XX_DAC_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 DAC_Private_Macros DAC Private Macros
  48. * @{
  49. */
  50. /** After the selected settling time after this field is written with a
  51. new VALUE, the voltage on the AOUT pin (with respect to VSSA)
  52. is VALUE/1024 × VREF */
  53. #define DAC_VALUE(n) ((uint32_t)((n&0x3FF)<<6))
  54. /** If this bit = 0: The settling time of the DAC is 1 microsecond max,
  55. * and the maximum current is 700 microAmpere
  56. * If this bit = 1: The settling time of the DAC is 2.5 microsecond
  57. * and the maximum current is 350 microAmpere */
  58. #define DAC_BIAS_EN ((uint32_t)(1<<16))
  59. /** Value to reload interrupt DMA counter */
  60. #define DAC_CCNT_VALUE(n) ((uint32_t)(n&0xffff))
  61. /** DCAR double buffering */
  62. #define DAC_DBLBUF_ENA ((uint32_t)(1<<1))
  63. /** DCAR Time out count enable */
  64. #define DAC_CNT_ENA ((uint32_t)(1<<2))
  65. /** DCAR DMA access */
  66. #define DAC_DMA_ENA ((uint32_t)(1<<3))
  67. /** DCAR DACCTRL mask bit */
  68. #define DAC_DACCTRL_MASK ((uint32_t)(0x0F))
  69. /** Macro to determine if it is valid DAC peripheral */
  70. #define PARAM_DACx(n) (((uint32_t *)n)==((uint32_t *)LPC_DAC))
  71. /** Macro to check DAC current optional parameter */
  72. #define PARAM_DAC_CURRENT_OPT(OPTION) ((OPTION == DAC_MAX_CURRENT_700uA)\
  73. ||(OPTION == DAC_MAX_CURRENT_350uA))
  74. /**
  75. * @}
  76. */
  77. /* Public Types --------------------------------------------------------------- */
  78. /** @defgroup DAC_Public_Types DAC Public Types
  79. * @{
  80. */
  81. /**
  82. * @brief Current option in DAC configuration option */
  83. typedef enum
  84. {
  85. DAC_MAX_CURRENT_700uA = 0, /*!< The settling time of the DAC is 1 us max,
  86. and the maximum current is 700 uA */
  87. DAC_MAX_CURRENT_350uA /*!< The settling time of the DAC is 2.5 us
  88. and the maximum current is 350 uA */
  89. } DAC_CURRENT_OPT;
  90. /**
  91. * @brief Configuration for DAC converter control register */
  92. typedef struct
  93. {
  94. uint8_t DBLBUF_ENA; /**<
  95. -0: Disable DACR double buffering
  96. -1: when bit CNT_ENA, enable DACR double buffering feature
  97. */
  98. uint8_t CNT_ENA; /*!<
  99. -0: Time out counter is disable
  100. -1: Time out conter is enable
  101. */
  102. uint8_t DMA_ENA; /*!<
  103. -0: DMA access is disable
  104. -1: DMA burst request
  105. */
  106. uint8_t RESERVED;
  107. } DAC_CONVERTER_CFG_Type;
  108. /**
  109. * @}
  110. */
  111. /* Public Functions ----------------------------------------------------------- */
  112. /** @defgroup DAC_Public_Functions DAC Public Functions
  113. * @{
  114. */
  115. void DAC_Init(LPC_DAC_TypeDef *DACx);
  116. void DAC_UpdateValue (LPC_DAC_TypeDef *DACx, uint32_t dac_value);
  117. void DAC_SetBias (LPC_DAC_TypeDef *DACx,uint32_t bias);
  118. void DAC_ConfigDAConverterControl (LPC_DAC_TypeDef *DACx,DAC_CONVERTER_CFG_Type *DAC_ConverterConfigStruct);
  119. void DAC_SetDMATimeOut(LPC_DAC_TypeDef *DACx,uint32_t time_out);
  120. /**
  121. * @}
  122. */
  123. #ifdef __cplusplus
  124. }
  125. #endif
  126. #endif /* LPC17XX_DAC_H_ */
  127. /**
  128. * @}
  129. */
  130. /* --------------------------------- End Of File ------------------------------ */