dvk_brd3600.c 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /**************************************************************************//**
  2. * @file
  3. * @brief EFM32GG_DK3750 board support package BRD3600A API implementation
  4. * @author Energy Micro AS
  5. * @version 1.2.2
  6. ******************************************************************************
  7. * @section License
  8. * <b>(C) Copyright 2011 Energy Micro AS, http://www.energymicro.com</b>
  9. ******************************************************************************
  10. *
  11. * This source code is the property of Energy Micro AS. The source and compiled
  12. * code may only be used on Energy Micro "EFM32" microcontrollers.
  13. *
  14. * This copyright notice may not be removed from the source code nor changed.
  15. *
  16. * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no
  17. * obligation to support this Software. Energy Micro AS is providing the
  18. * Software "AS IS", with no express or implied warranties of any kind,
  19. * including, but not limited to, any implied warranties of merchantability
  20. * or fitness for any particular purpose or warranties against infringement
  21. * of any proprietary rights of a third party.
  22. *
  23. * Energy Micro AS will not be liable for any consequential, incidental, or
  24. * special damages, or any other relief, or for any claim by any third party,
  25. * arising from your use of this Software.
  26. *
  27. *****************************************************************************/
  28. /***************************************************************************//**
  29. * @addtogroup BSP
  30. * @{
  31. ******************************************************************************/
  32. #include "efm32.h"
  33. #include "efm32_gpio.h"
  34. #include "efm32_ebi.h"
  35. #include "efm32_cmu.h"
  36. #include "dvk.h"
  37. #include "dvk_bcregisters.h"
  38. /**************************************************************************//**
  39. * @brief Configure BRD3600A on-board peripherals.
  40. *****************************************************************************/
  41. void DVK_BRD3600A_init(void)
  42. {
  43. /* Enable CMU GPIO clocks */
  44. CMU_ClockEnable(cmuClock_GPIO, true);
  45. /* USB status LED - configure PE1 as push pull */
  46. GPIO_PinModeSet(gpioPortE, 1, gpioModePushPull, 0);
  47. /* USB overcurrent status - configure PE2 as push pull */
  48. GPIO_PinModeSet(gpioPortE, 2, gpioModeInput, 0);
  49. /* USB VBUS switch - configure PF5 as push pull - Default OFF */
  50. GPIO_PinModeSet(gpioPortF, 5, gpioModePushPull, 0);
  51. return;
  52. }
  53. /**************************************************************************//**
  54. * @brief Disable EFM32GG_DK3750 EBI board support package functionality
  55. *****************************************************************************/
  56. void DVK_BRD3600A_deInit(void)
  57. {
  58. /* Disable PE1 */
  59. GPIO_PinModeSet(gpioPortE, 1, gpioModePushPull, 0);
  60. /* Disable CMU GPIO clocks */
  61. CMU_ClockEnable(cmuClock_GPIO, false);
  62. return;
  63. }
  64. /**************************************************************************//**
  65. * @brief Set state of USB status LED
  66. * @param[in] enable Set to true to light LED, false to dim it
  67. *****************************************************************************/
  68. void DVK_BRD3600A_usbStatusLEDEnable(int enable)
  69. {
  70. GPIO_PinModeSet(gpioPortE, 1, gpioModePushPull, enable);
  71. return;
  72. }
  73. /**************************************************************************//**
  74. * @brief Enable VBUS switch
  75. * @param[in] enable Set to true to enable switch
  76. *****************************************************************************/
  77. void DVK_BRD3600A_usbVBUSSwitchEnable(int enable)
  78. {
  79. GPIO_PinModeSet(gpioPortF, 5, gpioModePushPull, enable);
  80. return;
  81. }
  82. /**************************************************************************//**
  83. * @brief Get state of VBUS switch overcurrent flag
  84. *****************************************************************************/
  85. int DVK_BRD3600A_usbVBUSGetOCFlagState(void)
  86. {
  87. return ~GPIO_PinInGet(gpioPortE, 2);
  88. }
  89. /** @} (end group BSP) */