//***************************************************************************** // //! Initialize the OLED display. //! //! \param ulFrequency specifies the SSI Clock Frequency to be used. //! //! This function initializes the SSI interface to the OLED display and //! configures the SSD1329 controller on the panel. //! //! \return None. // //***************************************************************************** void RIT128x96x4Init(unsigned long ulFrequency) { unsigned long ulIdx; // Initialize the semaphore OS_InitSemaphore(&oLEDFree, 1); // // Enable the SSI0 and GPIO port blocks as they are needed by this driver. // SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIO_OLEDDC); // // Configure the SSI0CLK and SSIOTX pins for SSI operation. // GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_5); GPIOPadConfigSet(GPIO_PORTA_BASE, GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_5, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD_WPU); // // Configure the GPIO port pin used as a D/Cn signal for OLED device, // and the port pin used to enable power to the OLED panel. // GPIOPinTypeGPIOOutput(GPIO_OLEDDC_BASE, GPIO_OLEDDC_PIN | GPIO_OLEDEN_PIN); GPIOPadConfigSet(GPIO_OLEDDC_BASE, GPIO_OLEDDC_PIN | GPIO_OLEDEN_PIN, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD); GPIOPinWrite(GPIO_OLEDDC_BASE, GPIO_OLEDDC_PIN | GPIO_OLEDEN_PIN, GPIO_OLEDDC_PIN | GPIO_OLEDEN_PIN); HWREGBITW(&g_ulSSIFlags, FLAG_DC_HIGH) = 1; // // Configure and enable the SSI0 port for master mode. // RIT128x96x4Enable(ulFrequency); // // Clear the frame buffer. // RIT128x96x4Clear(); // // Initialize the SSD1329 controller. Loop through the initialization // sequence array, sending each command "string" to the controller. // for(ulIdx = 0; ulIdx < sizeof(g_pucRIT128x96x4Init); ulIdx += g_pucRIT128x96x4Init[ulIdx] + 1) { // // Send this command. // RITWriteCommand(g_pucRIT128x96x4Init + ulIdx + 1, g_pucRIT128x96x4Init[ulIdx] - 1); } }
//***************************************************************************** // //! Initialize the OLED display. //! //! \param ulFrequency specifies the SSI Clock Frequency to be used. //! //! This function initializes the SSI interface to the OLED display and //! configures the SSD1329 controller on the panel. //! //! This function is contained in <tt>rit128x96x4.c</tt>, with //! <tt>rit128x96x4.h</tt> containing the API definition for use by //! applications. //! //! \return None. // //***************************************************************************** void RIT128x96x4Init(unsigned long ulFrequency) { unsigned long ulIdx; /* Determine which board is being used. */ if( SysCtlPeripheralPresent( SYSCTL_PERIPH_ETH ) ) { /* Ethernet is present, we must be using the LM3S8962 EK. */ ulGPIOId = LM3S8962_SYSCTL_PERIPH_GPIO_OLEDDC; ulGPIOBase = LM3S8962_GPIO_OLEDDC_BASE; ulOLEDDC_PIN = GPIO_PIN_6; ulOLEDEN_PIN = GPIO_PIN_7; } else { /* Ethernet is not present, we must be using the LM3S1968 EK. */ ulGPIOId = LM3S1968_SYSCTL_PERIPH_GPIO_OLEDDC; ulGPIOBase = LM3S1968_GPIO_OLEDDC_BASE; ulOLEDDC_PIN = GPIO_PIN_2; ulOLEDEN_PIN = GPIO_PIN_3; } // // Enable the SSI0 and GPIO port blocks as they are needed by this driver. // SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); SysCtlPeripheralEnable(ulGPIOId); // // Configure the SSI0CLK and SSIOTX pins for SSI operation. // GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_5); GPIOPadConfigSet(GPIO_PORTA_BASE, GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_5, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD_WPU); // // Configure the GPIO port pin used as a D/Cn signal for OLED device, // and the port pin used to enable power to the OLED panel. // GPIOPinTypeGPIOOutput(ulGPIOBase, ulOLEDDC_PIN | ulOLEDEN_PIN); GPIOPadConfigSet(ulGPIOBase, ulOLEDDC_PIN | ulOLEDEN_PIN, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD); GPIOPinWrite(ulGPIOBase, ulOLEDDC_PIN | ulOLEDEN_PIN, ulOLEDDC_PIN | ulOLEDEN_PIN); // // Configure and enable the SSI0 port for master mode. // RIT128x96x4Enable(ulFrequency); // // Clear the frame buffer. // RIT128x96x4Clear(); // // Initialize the SSD1329 controller. Loop through the initialization // sequence array, sending each command "string" to the controller. // for(ulIdx = 0; ulIdx < sizeof(g_pucRIT128x96x4Init); ulIdx += g_pucRIT128x96x4Init[ulIdx] + 1) { // // Send this command. // RITWriteCommand(g_pucRIT128x96x4Init + ulIdx + 1, g_pucRIT128x96x4Init[ulIdx] - 1); } }