DSP2803x_ECap.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. //###########################################################################
  2. //
  3. // FILE: DSP2803x_ECap.c
  4. //
  5. // TITLE: DSP2803x eCAP Initialization & Support Functions.
  6. //
  7. //###########################################################################
  8. // $TI Release: F2803x C/C++ Header Files and Peripheral Examples V130 $
  9. // $Release Date: May 8, 2015 $
  10. // $Copyright: Copyright (C) 2009-2015 Texas Instruments Incorporated -
  11. // http://www.ti.com/ ALL RIGHTS RESERVED $
  12. //###########################################################################
  13. #include "DSP2803x_Device.h" // DSP2803x Headerfile Include File
  14. #include "DSP2803x_Examples.h" // DSP2803x Examples Include File
  15. //---------------------------------------------------------------------------
  16. // InitECap:
  17. //---------------------------------------------------------------------------
  18. // This function initializes the eCAP(s) to a known state.
  19. //
  20. void InitECap(void)
  21. {
  22. // Initialize eCAP1
  23. //tbd...
  24. }
  25. //---------------------------------------------------------------------------
  26. // Example: InitECapGpio:
  27. //---------------------------------------------------------------------------
  28. // This function initializes GPIO pins to function as ECAP pins
  29. //
  30. // Each GPIO pin can be configured as a GPIO pin or up to 3 different
  31. // peripheral functional pins. By default all pins come up as GPIO
  32. // inputs after reset.
  33. //
  34. // Caution:
  35. // For each eCAP peripheral
  36. // Only one GPIO pin should be enabled for ECAP operation.
  37. // Comment out other unwanted lines.
  38. void InitECapGpio()
  39. {
  40. InitECap1Gpio();
  41. }
  42. void InitECap1Gpio(void)
  43. {
  44. EALLOW;
  45. /* Enable internal pull-up for the selected pins */
  46. // Pull-ups can be enabled or disabled by the user.
  47. // This will enable the pullups for the specified pins.
  48. // Comment out other unwanted lines.
  49. // GpioCtrlRegs.GPAPUD.bit.GPIO5 = 0; // Enable pull-up on GPIO5 (CAP1)
  50. // GpioCtrlRegs.GPAPUD.bit.GPIO19 = 0; // Enable pull-up on GPIO19 (CAP1)
  51. GpioCtrlRegs.GPAPUD.bit.GPIO24 = 0; // Enable pull-up on GPIO24 (CAP1)
  52. // Inputs are synchronized to SYSCLKOUT by default.
  53. // Comment out other unwanted lines.
  54. // GpioCtrlRegs.GPAQSEL1.bit.GPIO5 = 0; // Synch to SYSCLKOUT GPIO5 (CAP1)
  55. // GpioCtrlRegs.GPAQSEL2.bit.GPIO19 = 0; // Synch to SYSCLKOUT GPIO19 (CAP1)
  56. GpioCtrlRegs.GPAQSEL2.bit.GPIO24 = 0; // Synch to SYSCLKOUT GPIO24 (CAP1)
  57. /* Configure eCAP-1 pins using GPIO regs*/
  58. // This specifies which of the possible GPIO pins will be eCAP1 functional pins.
  59. // Comment out other unwanted lines.
  60. // GpioCtrlRegs.GPAMUX1.bit.GPIO5 = 3; // Configure GPIO5 as CAP1
  61. // GpioCtrlRegs.GPAMUX2.bit.GPIO19 = 3; // Configure GPIO19 as CAP1
  62. GpioCtrlRegs.GPAMUX2.bit.GPIO24 = 1; // Configure GPIO24 as CAP1
  63. EDIS;
  64. }
  65. //===========================================================================
  66. // End of file.
  67. //===========================================================================