1 -- vim: ft=lua ts=2 et sw=2 2 3 -- Test LCD driver code. The target platform is the Ben NanoNote. 4 5 local L4 = require("L4"); 6 7 local l = L4.default_loader; 8 9 -- Define general access to peripherals. 10 11 local io_buses = { 12 cpm = l:new_channel(); 13 gpio = l:new_channel(); 14 lcd = l:new_channel(); 15 }; 16 17 l:start({ 18 caps = { 19 cpm = io_buses.cpm:svr(), 20 gpio = io_buses.gpio:svr(), 21 lcd = io_buses.lcd:svr(), 22 23 icu = L4.Env.icu, 24 sigma0 = L4.cast(L4.Proto.Factory, L4.Env.sigma0):create(L4.Proto.Sigma0), 25 }, 26 }, 27 "rom/io rom/hw_devices.io rom/mips-qi_lb60-common.io"); 28 29 -- Expose a SPI peripheral as a device. 30 31 local spi = l:new_channel(); 32 33 l:startv({ 34 caps = { 35 vbus = io_buses.gpio, 36 spi = spi:svr(), 37 }, 38 }, 39 "rom/dev_spi_jz4740", "C23", "C22", "C21"); -- specifying clock, data, enable pin details 40 41 -- Expose a SPI backlight device for the Ben. 42 43 local backlight = l:new_channel(); -- exposes backlight device 44 45 l:start({ 46 caps = { 47 spi = spi, 48 backlight = backlight:svr(), 49 }, 50 }, 51 "rom/dev_backlight_spi_ili8960"); 52 53 -- Expose a display device for the Ben. 54 55 local display = l:new_channel(); -- exposes display device 56 57 l:start({ 58 caps = { 59 backlight = backlight, 60 display = display:svr(), 61 vbus = io_buses.gpio, 62 }, 63 }, 64 "rom/dev_display_qi_lb60"); 65 66 -- Expose the CPM peripheral. 67 68 local cpm = l:new_channel(); 69 70 l:start({ 71 caps = { 72 vbus = io_buses.cpm, 73 cpm = cpm:svr(), 74 }, 75 }, 76 "rom/dev_cpm_jz4740"); 77 78 -- Start and demonstrate the LCD driver. 79 80 l:start({ 81 caps = { 82 icu = L4.Env.icu, 83 vbus = io_buses.lcd, 84 cpm = cpm, 85 display = display, -- needed by LCD driver 86 }, 87 }, 88 "rom/ex_jz4740_lcd_driver");