Hi. I'm trying to work with il9163 128x128 lcd, but i can't seem to get it to work.
all i can see is a white screen even when i try to put something on screen or something.
here is my code:
/*
* LCD.c
*
* Created on: 3.8.2015
* Author: Martin Salko
*/
#include "LCD.h"
#include "LCD_cfg.h"
#include "LCD_font.h"
#include "stdint.h"
#include <em_cmu.h>
#include <em_usart.h>
#include <em_gpio.h>
#include "delay.h"
void LCD_init(void)
{
// enable peripheral and spi clock
CMU_ClockEnable(cmuClock_GPIO,1);
CMU_ClockEnable(cmuClock_USART1,1);
// set maximal speed
CMU_ClockDivSet(cmuClock_HFPER,1);
GPIO_PinModeSet(LCD_CS_PORT, LCD_CS_PIN, gpioModePushPull, 1);
GPIO_PinModeSet(LCD_CLK_PORT, LCD_CLK_PIN, gpioModePushPull, 0);
GPIO_PinModeSet(LCD_A0_PORT, LCD_A0_PIN, gpioModePushPull, 0);
GPIO_PinModeSet(LCD_TX_PORT, LCD_TX_PIN, gpioModePushPull, 0);
GPIO_PinModeSet(LCD_RST_PORT, LCD_RST_PIN, gpioModePushPull, 0);
GPIO_PinModeSet(LCD_LED_PORT, LCD_LED_PIN, gpioModePushPull, 0);
LCD_USART->CTRL |= USART_CTRL_SYNC; //set sinchronous mode
LCD_USART->FRAME |= USART_FRAME_DATABITS_EIGHT; // set nine databits
LCD_USART->CMD |= USART_CMD_TXEN; // enable transmit
LCD_USART->CMD |= USART_CMD_RXEN; // enable recieve
LCD_USART->CMD |= USART_CMD_MASTEREN; // enable master mode
LCD_USART->ROUTE |= LCD_USART_LOC; // set desired location
LCD_USART->ROUTE |= USART_ROUTE_CLKPEN; //enable clock
LCD_USART->ROUTE |= USART_ROUTE_CSPEN; //enable clock
LCD_USART->ROUTE |= USART_ROUTE_TXPEN; //enable clock
LCD_USART->CTRL |= USART_CTRL_CLKPHA_SAMPLELEADING; // set sample leading
LCD_USART->CTRL |= USART_CTRL_AUTOCS; //set auotomatic cs
LCD_USART->CTRL |= USART_CTRL_MSBF; //set most significant bit first
LCD_USART->CLKDIV = 0xffff; // set some delay
}
void LCD_ON(void)
{
GPIO_PinOutSet(LCD_LED_PORT, LCD_LED_PIN);
GPIO_PinOutSet(LCD_RST_PORT, LCD_RST_PIN);
LCD_Push(0,0x01);
LCD_Push(0,0x00);
LCD_Push(0,0x00);
LCD_Push(0,0x00);
LCD_Push(0,0x00);
LCD_Push(0,0x11);
LCD_Push(0,0x00);
LCD_Push(0,0x00);
LCD_Push(0,0x00);
LCD_Push(0,0x00);
LCD_Push(0,0x21);
}
void LCD_Push(uint8_t DC,uint8_t data)
{
//wait for it
while( !(USART1->STATUS & USART_STATUS_TXBL));
GPIO->P[3].DOUT = (GPIO->P[3].DOUT & ~(1<<LCD_A0_PIN)) | ((DC & 1)<<LCD_A0_PIN);
//send data
LCD_USART->TXDATA= (data) & 0xff;
}
void LCD_pushPixel(void)
{
}
void LCD_OFF(void)
{
LCD_Push(1,0x28);
GPIO_PinOutClear(LCD_LED_PORT, LCD_LED_PIN);
}
void LCD_pushArea(void)
{
}
void LCD_update(void)
{
}
what am i doing wrong.