예제 #1
0
파일: adt75.c 프로젝트: AlexGora/cox
//*****************************************************************************
//
//! \brief Disable OTI mode corresponding pin interrupt.
//!
//! \param None
//! 
//! \return None
//
//*****************************************************************************
void ADT75IntDisable(void)
{
    unsigned long ulBase;
    
    xGPIOSPinIntDisable(ADT75_PIN_OS);
    ulBase = xGPIOSPinToPort(ADT75_PIN_OS);
    xIntDisable(xSysCtlPeripheraIntNumGet(ulBase));       
}
예제 #2
0
파일: adt75.c 프로젝트: AlexGora/cox
//*****************************************************************************
//
//! \brief Enable OTI mode corresponding pin interrupt.
//!
//! \param None
//! 
//! \return None
//
//*****************************************************************************
void ADT75IntEnable(void)
{
    unsigned long ulBase;
    
    xGPIOSPinTypeGPIOInput(ADT75_PIN_OS);
    xGPIOSPinIntEnable(ADT75_PIN_OS, ADT75_LEVEL_OS);
    ulBase = xGPIOSPinToPort(ADT75_PIN_OS);
    xIntEnable(xSysCtlPeripheraIntNumGet(ulBase)); 
}
예제 #3
0
파일: adt75.c 프로젝트: AlexGora/cox
//*****************************************************************************
//
//! \brief Init interrupts callback for the specified OTI connected pin.
//!
//! \param xtI2CCallback is callback for the specified Port.
//!
//! Init interrupts callback for the specified Port.
//!
//! \return None.
//
//*****************************************************************************
void ADT75IntCallbackInit(xtEventCallback xtI2CCallback)
{
    //
    // A read operation reset the OTI pin level
    //
    ADT75RegRead(ADT75_REGISTER_CFG);
    
    //
    // Init interrupts callback for the specified Port.
    //
    xGPIOPinIntCallbackInit(xGPIOSPinToPort(ADT75_PIN_OS),
                             xGPIOSPinToPin(ADT75_PIN_OS), xtI2CCallback);
    
}
예제 #4
0
파일: SPI.cpp 프로젝트: Azz1/RPI_EPI
//Initializes the SPI bus by setting SCK, MOSI, and SS to outputs, pulling SCK and MOSI low, and SS high.
void SPIClass::begin(int spiClock){
    // Enable Peripheral SPIx
    xSysCtlPeripheralEnable2(spiPort);
    xSysCtlPeripheralEnable2(xGPIOSPinToPort(sD13));

    // Configure Some GPIO pins as SPIx Mode
    sPinTypeSPI(spiPort);
    ulDataWidth = xSPI_DATA_WIDTH8;
    ulDataFormat = SPI_MODE0;
    ulDataMode = MSBFIRST;
    xSPIConfigSet(spiPort, spiClock, xSPI_MOTO_FORMAT_MODE_0 | xSPI_DATA_WIDTH8 | xSPI_MSB_FIRST | xSPI_MODE_MASTER);
    xSPISSSet(spiPort, xSPI_SS_HARDWARE, xSPI_SS0);
    xSPIEnable(spiPort);
}
예제 #5
0
파일: Wire.cpp 프로젝트: Azz1/RPI_EPI
/*
 * Initiate the Wire library and join the I2C bus as a master. This should normally be called only once.
 */
void WireClass::begin(void){
    // Enable the i2c&GPIO peripheral
    xSysCtlPeripheralEnable2(i2cPort);
    xSysCtlPeripheralEnable2(xGPIOSPinToPort(sSDA));

    // Congigure the i2c pin
    sPinTypeI2C(i2cPort);
    
    //Initialize I2C Module 100K
    xI2CMasterInit(i2cPort, 100000);
    xI2CMasterEnable(i2cPort);
    
    rxBufferIndex = 0; rxBufferLength = 0;
    txBufferIndex = 0; txBufferLength = 0;
}
예제 #6
0
파일: uc1701.c 프로젝트: AlexGora/cox
//*****************************************************************************
//
//! \brief Init the UC1701 LCD.
//!
//! \param ulSpiClock SPI clock to select.
//!
//! This function initialize the mcu SPI as master and specified SPI port.
//!
//! \return None.
//
//*****************************************************************************
void UC1701Init(unsigned long ulSpiClock)
{
    //
    // Enable the GPIOx port which is connected with UC1701
    //
    xSysCtlPeripheralEnable(xGPIOSPinToPort(LCD_PIN_SPI_CLK));
    xSysCtlPeripheralEnable(xGPIOSPinToPort(LCD_PIN_SPI_CS));
    xSysCtlPeripheralEnable(xGPIOSPinToPort(LCD_PIN_SPI_MOSI));
    xSysCtlPeripheralEnable(xGPIOSPinToPort(LCD_PIN_CD));
    xSysCtlPeripheralEnable(xGPIOSPinToPort(LCD_PIN_RESET));
    
    //
    // Enable the SPIx which is connected with UC1701
    //
    xSysCtlPeripheralEnable2(LCD_PIN_SPI_PORT);
    xSysCtlPeripheralReset2(LCD_PIN_SPI_PORT);
    //
    // Set the chip select pin as OUT_MODE
    //
    xGPIOSPinDirModeSet(LCD_PIN_SPI_CS, xGPIO_DIR_MODE_OUT);
    //
    // Set the chip reset pin as OUT_MODE
    //
    xGPIOSPinDirModeSet(LCD_PIN_CD, xGPIO_DIR_MODE_OUT);
    xGPIOSPinDirModeSet(LCD_PIN_RESET, xGPIO_DIR_MODE_OUT);
    
    xSPinTypeSPI(SPI_CLK, LCD_PIN_SPI_CLK);
    xSPinTypeSPI(SPI_MOSI, LCD_PIN_SPI_MOSI);
    
    //
    // Configure MCU as a master device , 8 bits data width ,MSB first,Mode_0
    //
    xSPIConfigSet(LCD_PIN_SPI_PORT, ulSpiClock, xSPI_MOTO_FORMAT_MODE_1 |
                                                xSPI_MODE_MASTER | 
                                                xSPI_MSB_FIRST |
                                                xSPI_DATA_WIDTH8);
    //
    // Disable UC1701 when Power up
    //
    xGPIOSPinWrite(LCD_PIN_SPI_CS, 1);

    //
    // Reset the chip
    //
    xGPIOSPinWrite(LCD_PIN_RESET, 0);
    delay_ms(2);
    xGPIOSPinWrite(LCD_PIN_RESET, 1);
    delay_ms(6);

    //
    // Initial Configuration
    //
    UC1701CmdWrite(0xe2);//System Reset
	UC1701CmdWrite(0x2c);//Power Rise Step1
	delay_ms(8);
	UC1701CmdWrite(0x2e);//Power Rise Step2
	delay_ms(8);
	UC1701CmdWrite(0x2f);//Power Rise Step3
	delay_ms(8);
	UC1701CmdWrite(0x23);
	UC1701DoubleCmdWrite(0x81, 0x1f);//Set LCD resistor ratio

	UC1701CmdWrite(0xa2);//Bias 1/9
	UC1701CmdWrite(0xc0);//Set COM Direction
	UC1701CmdWrite(0xa0);//Set SEG Direction
	UC1701CmdWrite(0x40);//Set Scroll Line: the first line
	UC1701CmdWrite(0xaf);//Display Enable

}