#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include "nrf.h"
#include "LCD.h"
#include "Delay.h"


void GPIO_int(void)
{
	NRF_GPIO->PIN_CNF[LCD_RS]  = ((1 << 0) | (1 << 1) | (1 << 2) | (0 << 8)| (0 << 16));
	NRF_GPIO->PIN_CNF[LCD_E]   = ((1 << 0) | (1 << 1) | (1 << 2) | (0 << 8)| (0 << 16));
	NRF_GPIO->PIN_CNF[LCD_DB4] = ((1 << 0) | (1 << 1) | (1 << 2) | (0 << 8)| (0 << 16));
	NRF_GPIO->PIN_CNF[LCD_DB5] = ((1 << 0) | (1 << 1) | (1 << 2) | (0 << 8)| (0 << 16));
	NRF_GPIO->PIN_CNF[LCD_DB6] = ((1 << 0) | (1 << 1) | (1 << 2) | (0 << 8)| (0 << 16));
	NRF_GPIO->PIN_CNF[LCD_DB7] = ((1 << 0) | (1 << 1) | (1 << 2) | (0 << 8)| (0 << 16));
}

uint8_t customChar[8] = {
	0x00,
	0x0A,
	0x1F,
	0x1F,
	0x0E,
	0x04,
	0x00,
	0x00
};
uint8_t customChar1[8] = {
	0x00,
	0x00,
	0x00,
	0x00,
	0x00,
	0x00,
	0x00,
	0x00
};
int main ()
{
	NRF_CLOCK->EVENTS_HFCLKSTARTED = 0;
	NRF_CLOCK->TASKS_HFCLKSTART = 1;
	while (NRF_CLOCK->EVENTS_HFCLKSTARTED == 0);
	NRF_POWER->RESETREAS = 0;
	GPIO_int();
	LCD_int();
	LCD_CM_WRITE(0x01);
	
	LCDBuildChar(0,customChar);  // Create a customer character
	


	while (1)
	{		

			LCD_DATA_WRITE(0x00);			
			nrf_delay_ms(1000);

	}
}
