Last active
November 21, 2016 22:14
-
-
Save pamaury/49f21d06cab61b85fa874f560449780b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- Philips GoGear SA3ARA | |
-- | |
SA3ARA = {} | |
function SA3ARA.lcd_send(is_data, data) | |
STMP.lcdif.send_pio(is_data, {data}) | |
end | |
function SA3ARA.lcd_init_seq_0() | |
SA3ARA.lcd_send(0, 0x11) | |
end | |
function SA3ARA.lcd_init_seq_1() | |
SA3ARA.lcd_send(0, 0xe3) | |
end | |
function SA3ARA.lcd_init_seq_2() | |
SA3ARA.lcd_send(0, 0xea) | |
end | |
function SA3ARA.lcd_init() | |
STMP.lcdif.setup_clock() | |
STMP.pinctrl.lcdif.setup_system(16, false) | |
STMP.lcdif.init() | |
STMP.lcdif.set_databus_width(16) | |
STMP.lcdif.set_word_length(16) | |
STMP.lcdif.set_system_timing(2, 1, 3, 3) | |
STMP.lcdif.set_data_swizzle(0) | |
STMP.lcdif.set_byte_packing_format(0xf) | |
STMP.lcdif.set_reset(1) | |
STMP.lcdif.set_reset(0) | |
STMP.lcdif.set_reset(1) | |
if SA3ARA.lcd_kind == 0 then | |
SA3ARA.lcd_init_seq_0() | |
elseif SA3ARA.lcd_kind == 1 ten | |
SA3ARA.lcd_init_seq_1() | |
else | |
SA3ARA.lcd_init_seq_2() | |
end | |
end | |
function SA3ARA.set_backlight(val) | |
-- ignore value for now | |
STMP.pinctrl.pin(1, 28).muxsel('GPIO') | |
STMP.pinctrl.pin(1, 28).enable() | |
if val == 0 then | |
STMP.pinctrl.pin(1, 28).clr() | |
else | |
STMP.pinctrl.pin(1, 28).set() | |
end | |
end | |
function SA3ARA.init() | |
SA3ARA.set_backlight(100) | |
-- replace with 0, 1 or 2 to choose lcd | |
SA3ARA.lcd_kind = 0 | |
SA3ARA.lcd_init() | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment