//########################################################################### // // FILE: DSP2803x_ECap.c // // TITLE: DSP2803x eCAP Initialization & Support Functions. // //########################################################################### // $TI Release: F2803x C/C++ Header Files and Peripheral Examples V130 $ // $Release Date: May 8, 2015 $ // $Copyright: Copyright (C) 2009-2015 Texas Instruments Incorporated - // http://www.ti.com/ ALL RIGHTS RESERVED $ //########################################################################### #include "DSP2803x_Device.h" // DSP2803x Headerfile Include File #include "DSP2803x_Examples.h" // DSP2803x Examples Include File //--------------------------------------------------------------------------- // InitECap: //--------------------------------------------------------------------------- // This function initializes the eCAP(s) to a known state. // void InitECap(void) { // Initialize eCAP1 //tbd... } //--------------------------------------------------------------------------- // Example: InitECapGpio: //--------------------------------------------------------------------------- // This function initializes GPIO pins to function as ECAP pins // // Each GPIO pin can be configured as a GPIO pin or up to 3 different // peripheral functional pins. By default all pins come up as GPIO // inputs after reset. // // Caution: // For each eCAP peripheral // Only one GPIO pin should be enabled for ECAP operation. // Comment out other unwanted lines. void InitECapGpio() { InitECap1Gpio(); } void InitECap1Gpio(void) { EALLOW; /* Enable internal pull-up for the selected pins */ // Pull-ups can be enabled or disabled by the user. // This will enable the pullups for the specified pins. // Comment out other unwanted lines. // GpioCtrlRegs.GPAPUD.bit.GPIO5 = 0; // Enable pull-up on GPIO5 (CAP1) // GpioCtrlRegs.GPAPUD.bit.GPIO19 = 0; // Enable pull-up on GPIO19 (CAP1) GpioCtrlRegs.GPAPUD.bit.GPIO24 = 0; // Enable pull-up on GPIO24 (CAP1) // Inputs are synchronized to SYSCLKOUT by default. // Comment out other unwanted lines. // GpioCtrlRegs.GPAQSEL1.bit.GPIO5 = 0; // Synch to SYSCLKOUT GPIO5 (CAP1) // GpioCtrlRegs.GPAQSEL2.bit.GPIO19 = 0; // Synch to SYSCLKOUT GPIO19 (CAP1) GpioCtrlRegs.GPAQSEL2.bit.GPIO24 = 0; // Synch to SYSCLKOUT GPIO24 (CAP1) /* Configure eCAP-1 pins using GPIO regs*/ // This specifies which of the possible GPIO pins will be eCAP1 functional pins. // Comment out other unwanted lines. // GpioCtrlRegs.GPAMUX1.bit.GPIO5 = 3; // Configure GPIO5 as CAP1 // GpioCtrlRegs.GPAMUX2.bit.GPIO19 = 3; // Configure GPIO19 as CAP1 GpioCtrlRegs.GPAMUX2.bit.GPIO24 = 1; // Configure GPIO24 as CAP1 EDIS; } //=========================================================================== // End of file. //===========================================================================