/****************************************************************************** * ID : 60.0 * Outline : Glyph_uEZ_Open * Include : Glyph_uEZ_0.h * Function Name: Glyph_uEZ_Open * Description : Open and setup the communications channel 0. * Argument : aHandle - the Glyph handle to setup for the LCD and Communications. * Return Value : 0=success, not 0= error * Calling Functions : GlyphCommOpen ******************************************************************************/ T_glyphError Glyph_uEZ_Open(T_glyphHandle aHandle) { int i = 0 ; T_uezDevice dev; T_uezDeviceWorkspace *G_gpioC; if (G_spi == 0) { UEZDeviceTableFind("SPI0", &dev); UEZDeviceTableGetWorkspace(dev, (T_uezDeviceWorkspace **)&G_spi); HALInterfaceFind("GPIOC", (T_halWorkspace **)&G_gpioC); G_request.iBitsPerTransfer = 8; // Chip select on Port C2 (high true) G_request.iCSGPIOPort = (HAL_GPIOPort **)G_gpioC; G_request.iCSGPIOBit = (1<<2); G_request.iCSPolarity = EFalse; G_request.iClockOutPhase = EFalse; G_request.iClockOutPolarity = EFalse; G_request.iDataMISO = 0; G_request.iDataMOSI = 0; G_request.iNumTransfers = 0; G_request.iRate = 12000; // 12 MHz for now /* Set data direction for this bit to output */ PORTC.DDR.BIT.B3 = 1 ; // LCD GPIO for Reset LCD PORT5.DDR.BIT.B1 = 1 ; // LCD RS A0 StartResetLCD() ; for (i=0;i<1000000;i++){} EndResetLCD() ; for (i=0;i<1000000;i++){} } return GLYPH_ERROR_NONE ; }
/****************************************************************************** * ID : 60.0 * Outline : YRDKRX62N_RSPIOpen * Include : YRDKRX62N_RSPI0.h * Function Name: YRDKRX62N_RSPIOpen * Description : Open and setup the communications channel RSPI0. * Argument : aHandle - the Glyph handle to setup for the LCD and Communications. * Return Value : 0=success, not 0= error * Calling Functions : GlyphCommOpen ******************************************************************************/ T_glyphError YRDKRX62N_RSPIOpen(T_glyphHandle aHandle) { int i = 0 ; /* Set data direction for this bit to output */ PORTC.DDR.BIT.B3 = 1 ; // LCD GPIO for Reset LCD PORT5.DDR.BIT.B1 = 1 ; // LCD RS A0 StartResetLCD() ; for (i=0;i<1000000;i++){} EndResetLCD() ; for (i=0;i<1000000;i++){} YRDKRX62N_RSPIConfig() ; return GLYPH_ERROR_NONE ; }