LCD connected to WiPOM board


Serial API test of LCD connected to WiPOM board.

Toolkit:STM Development System

Location:/bipom/devtools/STM32/examples/Wipom/lcd

Code Example


char line[32] = {0};

//********************************************************************************

static void vLCDTEST( void *pvParameters )
{
	int counter = 10;
	(void) pvParameters;
	while(1) 
	{
		// clear display

		CursorOffWipomLCD();
		ClearWipomLCD();

		
		strcpy(line, "COUNTER");
		SetTopLineWipomLCD();
		printf_WipomLCD(line,1);

		bipom_sprintf(line, "%d", counter++);
		SetBottomLineWipomLCD();
		printf_WipomLCD(line,2);

		vTaskDelay(1000);	
  	}
}

//********************************************************************************

int main(void) 
{
	delayMs(250);

	ERRCODE ec;
	tprintf("\n\rMini-Max/STM32F1");
	tprintf("\n\rLCD TEST REV 1.01");

	// Init I2C

	Soft_I2C_Config(&I2C_SETTINGS); 
	
	ec = Soft_I2C_Repair();
	if (ec)
	{
		tprintf("\r\nCannot repair I2C bus. ec=%d", ec);
		goto func_end;
	}
	
	// Adjust the contrast

	ec = WriteMCP465(I2C_DEVICE_MCP465_LCD, MCP465_WIPER0, 0x00);
	if (ec)
	{
		tprintf("\r\nCannot adjust contrast of WiPOM display. ec=%d", ec);
		goto func_end;
	}

	// Adjust the LCD backlight 

	ec = WriteMCP465(I2C_DEVICE_MCP465_LCD, MCP465_WIPER1, 0xFF);
	if (ec)
	{
		tprintf("\r\nCannot adjust backlight of WiPOM display. ec=%d", ec);
		goto func_end;
	}
	
	// init display

	ec = ConfigWipomLCD();
	if (ec)
	{
		tprintf("\r\nCannot initialize WiPOM display. ec=%d", ec);
		goto func_end;
	}
	tprintf("\r\nSUCCESS: All I2C devices are initialized");
	if(pdPASS != 
		xTaskCreate (vLCDTEST, ( const signed portCHAR * const )"LCDTEST", 
			configMINIMAL_STACK_SIZE<<4, NULL, tskIDLE_PRIORITY, NULL ))
	{
		tprintf("\n\rERROR: can't create LCDTEST task");
	}
	/* Now all the tasks have been started - start the scheduler. */
	vTaskStartScheduler();

func_end:	
	for(;;);
	return 0;
}