Example #1
0
static void IDrawTitle(void)
{
    GlyphNormalScreen(G_glyphLCD);
    GlyphClearScreen(G_glyphLCD);
    GlyphSetFont(G_glyphLCD, GLYPH_FONT_5_BY_7);
    GlyphSetXY(G_glyphLCD, CENTER_X(20, 5u), DISPLAY_HEIGHT - 24);
    GlyphString(G_glyphLCD, "Future Designs, Inc.", 20);
    GlyphSetXY(G_glyphLCD, CENTER_X(12, 5u), DISPLAY_HEIGHT - 16);
    GlyphString(G_glyphLCD, "RX Solutions", 12);
    GlyphSetXY(G_glyphLCD, CENTER_X(15, 5u), DISPLAY_HEIGHT - 8);
    GlyphString(G_glyphLCD, "www.teamfdi.com", 15);
}
Example #2
0
void LCDDisplayLogo()
{
    T_glyphFont font;
    
    GlyphGetFont(G_lcd, &font);
    
    GlyphSetFont(G_lcd, GLYPH_FONT_LOGOS);
    GlyphSetXY (G_lcd, 8, 0); 
    GlyphString(G_lcd, 0, 1);
    
    GlyphSetFont(G_lcd, font);
}
Example #3
0
/******************************************************************************
* Function name : DisplayLCD
* Description   : This function controls the LCD writes.
*                 The display supports 8 lines with up to 12 characters per line
*                 Use the defines LCD_LINE1 to LCD_LINE8 to specfify the starting
*                 position.
*                 For example, to start at the 4th position on line 1:
*                     DisplayLCD(LCD_LINE1 + 4, "Hello")
* Arguments     : uint8_t position - line number of display
*                 const unit8_t * string - pointer to null terminated string
* Return Value  : none
******************************************************************************/
void DisplayLCD(uint8_t position, const uint8_t * string)
{
    uint8_t y = position - (position % 8);
    uint8_t xOffset = (position % 8)<<3 ;

    /* Draw text lines, 8 pixels high, 96 pixels wide */
    /* Clear the rectangle of this line */
    GlyphEraseBlock(G_lcd, xOffset, y, (95 - xOffset), y+7);
    GlyphSetXY(G_lcd, xOffset, y);
    GlyphString(G_lcd, (uint8_t *)string, strlen((void *)string));

}
Example #4
0
int CmdLCD(void *aWorkspace, int argc, char *argv[])
{
    if (argc == 2) {
        GlyphClearScreen(G_glyphLCD);
        GlyphSetXY(G_glyphLCD, 0, 0);
        GlyphString(G_glyphLCD, (uint8_t *)argv[1], strlen(argv[1]));
        FDICmdPrintf(aWorkspace, "PASS: OK\n");
    } else {
        FDICmdPrintf(aWorkspace, "FAIL: Incorrect parameters\n");
    }
    return 0;
}
Example #5
0
void LCDString (const char *aStr, uint8_t aX, uint8_t aY)
{
    GlyphSetXY (G_lcd, aX, aY);
    GlyphString(G_lcd, (uint8_t *)aStr, strlen(aStr));
}
Example #6
0
/*---------------------------------------------------------------------------*
 * Task:  main
 *---------------------------------------------------------------------------*
 * Description:
 *      In the uEZ system, main() is a task.  Do not exit this task
 *      unless you want to the board to reset.  This function should
 *      setup the system and then run the main loop of the program.
 * Outputs:
 *      int                     -- Output error code
 *---------------------------------------------------------------------------*/
int MainTask(void)
{	
	T_uezDevice temp;
	T_uezDevice accel;
	T_uezError tempDeviceError;
	T_uezError accelDeviceError;
	TUInt8 displayString[100];
	TInt32 tempValue;
	float tempFloatValue;
	AccelerometerReading accelReading;
	
	printf("\f" PROJECT_NAME " " VERSION_AS_TEXT "\n\n"); // clear serial screen and put up banner
	
	// Start up the heart beat of the LED
    UEZTaskCreate(Heartbeat, "Heart", 64, (void *)0, UEZ_PRIORITY_NORMAL, 0);
	
    NVSettingsInit();
    // Load the settings from non-volatile memory
    if (NVSettingsLoad() == UEZ_ERROR_CHECKSUM_BAD) {
        printf("EEPROM Settings\n");
        NVSettingsInit();
        NVSettingsSave();
    }
	
	// Setup any additional misc. tasks (such as the heartbeat task)
    SetupTasks();

    GlyphOpen(&G_glyphLCD, 0);
	IDrawTitle();
	
	PlayAudio(523, 100);
    PlayAudio(659, 100);
    PlayAudio(783, 100);
    PlayAudio(1046, 100);
    PlayAudio(783, 100);
    PlayAudio(659, 100);
    PlayAudio(523, 100);	
	
	tempDeviceError = UEZTemperatureOpen("Temp0", &temp);
	if (tempDeviceError == UEZ_ERROR_NONE) {
		printf("MainTask: Temperature Device Open\n");
    } else {
        printf("MainTask: Failed to Open Temperature Device\n");
    }
	
	accelDeviceError = UEZAccelerometerOpen("Accel0", &accel);
	if (accelDeviceError == UEZ_ERROR_NONE) {
		printf("MainTask: Accelerometer Device Open\n");
    } else {
        printf("MainTask: Failed to Open Accelerometer Device\n");
    }
	
	while(1) {
		
		if ( tempDeviceError == UEZ_ERROR_NONE ) {
			if (UEZTemperatureRead(temp, &tempValue) == UEZ_ERROR_NONE) {
				tempFloatValue = tempValue/65536.0;
				sprintf((char *)displayString, "Temp: %.2f C", tempFloatValue);
				GlyphSetXY(G_glyphLCD, 0, 0);
    			GlyphString(G_glyphLCD, displayString, strlen(displayString));
            }
		}
		
		if ( accelDeviceError == UEZ_ERROR_NONE ) {
			if(UEZAccelerometerReadXYZ(accel, &accelReading, 10) == UEZ_ERROR_NONE )
			{				
				sprintf((char *)displayString, "ACCEL X: %d", accelReading.iX);
				GlyphSetXY(G_glyphLCD, 0, 16);
    			GlyphString(G_glyphLCD, displayString, strlen(displayString));
				
				sprintf((char *)displayString, "ACCEL Y: %d", accelReading.iY);
				GlyphSetXY(G_glyphLCD, 0, 24);
    			GlyphString(G_glyphLCD, displayString, strlen(displayString));
				
				sprintf((char *)displayString, "ACCEL Z: %d", accelReading.iZ);
				GlyphSetXY(G_glyphLCD, 0, 32);
    			GlyphString(G_glyphLCD, displayString, strlen(displayString));
			}
		}
		
		UEZTaskDelay(500);
	}

    return 0;
}
Example #7
0
/*---------------------------------------------------------------------------*
 * Task:  main
 *---------------------------------------------------------------------------*
 * Description:
 *      In the uEZ system, main() is a task.  Do not exit this task
 *      unless you want to the board to reset.  This function should
 *      setup the system and then run the main loop of the program.
 * Outputs:
 *      int                     -- Output error code
 *---------------------------------------------------------------------------*/
int MainTask(void)
{	
	T_uezDevice adc;
	T_uezDevice temp;
	T_uezDevice accel;
	T_uezError adcDeviceError;
	T_uezError tempDeviceError;
	T_uezError accelDeviceError;
	ADC_RequestSingle adcRequest;
	TUInt32 adcReading;
	TUInt8 displayString[100];
	TInt32 tempValue;
	float tempFloatValue;
	AccelerometerReading accelReading;
	
	printf("\f" PROJECT_NAME " " VERSION_AS_TEXT "\n\n");
	
	NVSettingsInit();
    // Load the settings from non-volatile memory
    if (NVSettingsLoad() == UEZ_ERROR_CHECKSUM_BAD) {
        printf("EEPROM Settings\n");
        NVSettingsInit();
        NVSettingsSave();
    }
	
	SetupTasks();

	GlyphOpen(&G_glyphLCD, 0);
	IDrawTitle();

	PlayAudio(523, 100);
    PlayAudio(659, 100);
    PlayAudio(783, 100);
    PlayAudio(1046, 100);
    PlayAudio(783, 100);
    PlayAudio(659, 100);
    PlayAudio(523, 100);	

	adcDeviceError = UEZADCOpen("ADC_S12AD", &adc);
	if (adcDeviceError == UEZ_ERROR_NONE) {
		printf("MainTask: ADC Device Open\n");
	} else {
		printf("MainTask: Failed to Open ADC Device\n");
	}
	
	tempDeviceError = UEZTemperatureOpen("Temp0", &temp);
	if (tempDeviceError == UEZ_ERROR_NONE) {
		printf("MainTask: Temperature Device Open\n");
    } else {
        printf("MainTask: Failed to Open Temperature Device\n");
    }
	
	accelDeviceError = UEZAccelerometerOpen("Accel0", &accel);
	if (accelDeviceError == UEZ_ERROR_NONE) {
		printf("MainTask: Accelerometer Device Open\n");
    } else {
        printf("MainTask: Failed to Open Accelerometer Device\n");
    }
	    
	//PORTE.PDR.BIT.B3 = 1;
	while(1) {
		if( adcDeviceError == UEZ_ERROR_NONE )
		{
			// the device opened properly
		    adcRequest.iADCChannel = 2;
		    adcRequest.iBitSampleSize = 12;
		    adcRequest.iTrigger = ADC_TRIGGER_NOW;
		    adcRequest.iCapturedData = &adcReading;
		    if (UEZADCRequestSingle(adc,&adcRequest) == UEZ_ERROR_NONE) {
				printf("MainTask: Potentiometer Reading: %d\n", adcReading);
		    } else {
		        printf("MainTask: Failed to get a Potentiometer Reading\n");
		    }
		}
		
		if ( tempDeviceError == UEZ_ERROR_NONE ) {
			if (UEZTemperatureRead(temp, &tempValue) == UEZ_ERROR_NONE) {
				tempFloatValue = tempValue/65536.0;
				sprintf((char *)displayString, "Temp: %.2f C", tempFloatValue);
				GlyphSetXY(G_glyphLCD, 0, 0);
    			GlyphString(G_glyphLCD, displayString, strlen(displayString));
            }
		}

		if ( accelDeviceError == UEZ_ERROR_NONE ) {
			if(UEZAccelerometerReadXYZ(accel, &accelReading, 10) == UEZ_ERROR_NONE )
			{				
				sprintf((char *)displayString, "ACCEL X: %d", accelReading.iX);
				GlyphSetXY(G_glyphLCD, 0, 16);
    			GlyphString(G_glyphLCD, displayString, strlen(displayString));
				
				sprintf((char *)displayString, "ACCEL Y: %d", accelReading.iY);
				GlyphSetXY(G_glyphLCD, 0, 24);
    			GlyphString(G_glyphLCD, displayString, strlen(displayString));
				
				sprintf((char *)displayString, "ACCEL Z: %d", accelReading.iZ);
				GlyphSetXY(G_glyphLCD, 0, 32);
    			GlyphString(G_glyphLCD, displayString, strlen(displayString));
			}
		}

		UEZTaskDelay(1000);
	}
    return 0;
}