Hi,
I want to give you some hints to get it running.
it's not very difficult to get it running on a baremetal system. You can still use the hwlib.
There is a headerfile called alt_i2c.h. This file contains a lot of definitions, needed to implement an i2c driver for your application.
To write something to the LCD you have to do the following steps:
first step: you need to write an init-function for the i2c interface. here you have to do the following steps:
- Disable the i2c controller by clearing the enabled bit in the alt_i2c_en register
- set the controller to master mode (register alt_i2c_con_mst_mod)
- set the speed to standard (the newheaven display only supports 100khz clock rate) (register alt_i2c_con_speed)
- enable the i2c controller (set enabled bit in the alt_i2c_en register)
second step: address the slave
- write the address of the slave to the alt_i2c_tar register
third step: the write function:
- to send data you have to set the ALT_i2c_data_cmd_cmd Register to WRITE
- write the data to the alt_i2c_data_cmd_dat Register
Now data will be send on the I2C. If you want to implement a full driver you can also check the status register etc. when you send some data...
Some hints for the newheaven LCD:
- Slave address is 0x28 (and not 0x50)
- between the commands you send, you need a delay (normally 100µs).
- A full list of special commands for the display you can find in the newheaven specification. (Download it from the newheaven website. The LCD is the NHD-0216K3Z)
I hope it helps you a bit.
Regards!