Exemplo n.º 1
0
/********************************************************************
 * DisplayInit() - Initialization routine for the Display module.
 ********************************************************************/
void DisplayInit(void) {

	/*	Initialize GPIOs	*/
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
#ifndef DEBUG
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
	SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
#endif

	/*	Initialize GPIO drive modes	*/
	GPIOPinTypeGPIOOutputOD(GPIO_PORTB_BASE, GPIO_ALL);
#ifndef DEBUG
	GPIOPinTypeGPIOOutputOD(GPIO_PORTA_BASE, GPIO_ALL & ~(BIT0 | BIT1));
	GPIOPinTypeGPIOOutputOD(GPIO_PORTC_BASE, GPIO_HNIB);
	GPIOPinTypeGPIOOutputOD(GPIO_PORTD_BASE, GPIO_LNIB);
	GPIOPinTypeGPIOOutputOD(GPIO_PORTE_BASE, GPIO_ALL & ~(BIT6 | BIT7));
	GPIOPinTypeGPIOOutputOD(GPIO_PORTF_BASE, GPIO_LNIB);
#endif

	/*	Initialize States	*/
	GPIOPinWrite(GPIO_PORTB_BASE, GPIO_ALL, GPIO_ALL);
#ifndef DEBUG
	GPIOPinWrite(GPIO_PORTE_BASE, BIT4 | BIT5, GPIO_ALL);
	GPIOPinWrite(GPIO_PORTA_BASE, GPIO_ALL & ~(BIT0 | BIT1), GPIO_ALL);

	GPIOPinWrite(GPIO_PORTD_BASE, GPIO_LNIB, GPIO_ALL);
	GPIOPinWrite(GPIO_PORTC_BASE, GPIO_HNIB, GPIO_ALL);

	GPIOPinWrite(GPIO_PORTE_BASE, GPIO_LNIB, GPIO_ALL);
	GPIOPinWrite(GPIO_PORTF_BASE, GPIO_LNIB, GPIO_ALL);
#endif
}
Exemplo n.º 2
0
//*****************************************************************************
//
// Initializes the dynamic braking control routines.
//
// This function initializes the ADC module and the control routines,
// preparing them to monitor currents and voltages on the motor drive.
//
// \return None.
//
//*****************************************************************************
void
BrakeInit(void)
{
    //
    // Configure the brake control pin as an open-drain output, allowing the
    // signal to float high in the "1" state (Brake disabled).
    //
    GPIOPinTypeGPIOOutputOD(PIN_BRAKE_PORT, PIN_BRAKE_PIN);
    GPIOPinWrite(PIN_BRAKE_PORT, PIN_BRAKE_PIN, PIN_BRAKE_PIN);

    //
    // The initial brake state is off.
    //
    g_ulBrakeState = STATE_BRAKE_OFF;

    //
    // The initial brake count is zero.
    //
    g_ulBrakeCount = 0;
}