1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/conf/landfall-examples/mips-qi_lb60-keypad-demo.cfg Sun May 13 01:34:16 2018 +0200
1.3 @@ -0,0 +1,183 @@
1.4 +-- vim: ft=lua ts=2 et sw=2
1.5 +
1.6 +-- Start Mag to multiplex the framebuffer between several example programs.
1.7 +-- These programs show the keypad status and also allow the backlight to be
1.8 +-- adjusted. The target platform is the Ben NanoNote.
1.9 +
1.10 +local L4 = require("L4");
1.11 +
1.12 +local l = L4.default_loader;
1.13 +
1.14 +-- Define general access to peripherals.
1.15 +
1.16 +local io_buses = {
1.17 + cpm = l:new_channel();
1.18 + gpio = l:new_channel();
1.19 + lcd = l:new_channel();
1.20 + };
1.21 +
1.22 +l:start({
1.23 + caps = {
1.24 + cpm = io_buses.cpm:svr(),
1.25 + gpio = io_buses.gpio:svr(),
1.26 + lcd = io_buses.lcd:svr(),
1.27 +
1.28 + icu = L4.Env.icu,
1.29 + sigma0 = L4.cast(L4.Proto.Factory, L4.Env.sigma0):create(L4.Proto.Sigma0),
1.30 + },
1.31 + },
1.32 + "rom/io rom/hw_devices.io rom/mips-qi_lb60-keypad-demo.io");
1.33 +
1.34 +-- Expose a SPI peripheral as a device.
1.35 +
1.36 +local spi = l:new_channel();
1.37 +
1.38 +l:startv({
1.39 + caps = {
1.40 + vbus = io_buses.gpio,
1.41 + spi = spi:svr(),
1.42 + },
1.43 + },
1.44 + "rom/dev_spi_jz4740", "C23", "C22", "C21"); -- specifying clock, data, enable pin details
1.45 +
1.46 +-- Expose a SPI backlight device for the Ben.
1.47 +
1.48 +local backlight = l:new_channel(); -- exposes backlight device
1.49 +
1.50 +l:start({
1.51 + caps = {
1.52 + spi = spi,
1.53 + backlight = backlight:svr(),
1.54 + },
1.55 + },
1.56 + "rom/dev_backlight_spi_qi_lb60");
1.57 +
1.58 +-- Expose a display device for the Ben.
1.59 +
1.60 +local display = l:new_channel(); -- exposes display device
1.61 +
1.62 +l:start({
1.63 + caps = {
1.64 + backlight = backlight,
1.65 + display = display:svr(),
1.66 + vbus = io_buses.gpio,
1.67 + },
1.68 + },
1.69 + "rom/dev_display_qi_lb60");
1.70 +
1.71 +-- Expose a panel definition for the Ben.
1.72 +
1.73 +local panel = l:new_channel(); -- exposes panel
1.74 +
1.75 +l:start({
1.76 + caps = {
1.77 + panel = panel:svr(),
1.78 + },
1.79 + },
1.80 + "rom/dev_panel_qi_lb60");
1.81 +
1.82 +-- Expose the CPM peripheral.
1.83 +
1.84 +local cpm = l:new_channel();
1.85 +
1.86 +l:start({
1.87 + caps = {
1.88 + vbus = io_buses.cpm,
1.89 + cpm = cpm:svr(),
1.90 + },
1.91 + },
1.92 + "rom/dev_cpm_jz4740");
1.93 +
1.94 +-- Expose a framebuffer device.
1.95 +
1.96 +local fbdrv_fb = l:new_channel();
1.97 +
1.98 +l:start({
1.99 + caps = {
1.100 + vbus = io_buses.lcd,
1.101 + fb = fbdrv_fb:svr(),
1.102 + cpm = cpm,
1.103 + display = display, -- needed by LCD driver
1.104 + panel = panel,
1.105 + },
1.106 + },
1.107 + "rom/fb-drv");
1.108 +
1.109 +-- Multiplex the framebuffer.
1.110 +
1.111 +local mag_caps = {
1.112 + mag = l:new_channel(),
1.113 + svc = l:new_channel(),
1.114 + };
1.115 +
1.116 +l:start({
1.117 + caps = {
1.118 + vbus = io_buses.gpio, -- needed by input driver
1.119 + fb = fbdrv_fb,
1.120 + mag = mag_caps.mag:svr(),
1.121 + svc = mag_caps.svc:svr(),
1.122 + },
1.123 + },
1.124 + "rom/mag");
1.125 +
1.126 +-- Expose the keypad matrix.
1.127 +
1.128 +local keypad = l:new_channel();
1.129 +
1.130 +l:start({
1.131 + caps = {
1.132 + vbus = io_buses.gpio,
1.133 + keypad = keypad:svr(),
1.134 + },
1.135 + },
1.136 + "rom/dev_keypad_qi_lb60");
1.137 +
1.138 +-- Show the keypad matrix.
1.139 +
1.140 +l:startv({
1.141 + caps = {
1.142 + fb = mag_caps.svc:create(L4.Proto.Goos, "g=160x110+0+0", "barheight=10"),
1.143 + keypad = keypad,
1.144 + },
1.145 + },
1.146 + "rom/ex_keypad_ds_client", "8", "8"); -- specifying keypad matrix dimensions
1.147 +
1.148 +-- Show the physical keypad layout.
1.149 +
1.150 +l:start({
1.151 + caps = {
1.152 + fb = mag_caps.svc:create(L4.Proto.Goos, "g=160x110+160+0", "barheight=10"),
1.153 + keypad = keypad,
1.154 + },
1.155 + },
1.156 + "rom/ex_qi_lb60_keypad_physical");
1.157 +
1.158 +-- Show key event values.
1.159 +
1.160 +l:start({
1.161 + caps = {
1.162 + fb = mag_caps.svc:create(L4.Proto.Goos, "g=160x110+0+120", "barheight=10"),
1.163 + keypad = keypad,
1.164 + },
1.165 + },
1.166 + "rom/ex_qi_lb60_keypad_driver");
1.167 +
1.168 +-- Show key strings.
1.169 +
1.170 +l:startv({
1.171 + caps = {
1.172 + fb = mag_caps.svc:create(L4.Proto.Goos, "g=160x110+160+120", "barheight=10"),
1.173 + keypad = keypad,
1.174 + },
1.175 + },
1.176 + "rom/ex_qi_lb60_keypad_driver", "chars");
1.177 +
1.178 +-- Control the backlight using the keyboard.
1.179 +
1.180 +l:start({
1.181 + caps = {
1.182 + backlight = backlight,
1.183 + keypad = keypad,
1.184 + },
1.185 + },
1.186 + "rom/ex_qi_lb60_backlight");