Landfall

Annotated conf/landfall-examples/mips-qi_lb60-input-event-client.cfg

129:152c4fc0a967
2021-01-16 Paul Boddie Added missing Makefiles.
paul@3 1
-- vim: ft=lua ts=2 et sw=2
paul@3 2
  
paul@3 3
-- Start Mag to multiplex the framebuffer showing only a single program.
paul@3 4
-- This example shows the key values produced by the input event driver.
paul@3 5
-- The target platform is the Ben NanoNote.
paul@3 6
paul@3 7
local L4 = require("L4");
paul@3 8
paul@3 9
local l = L4.default_loader;
paul@3 10
paul@3 11
-- Define general access to peripherals.
paul@3 12
paul@3 13
local io_buses = {
paul@3 14
    cpm   = l:new_channel();
paul@3 15
    gpio  = l:new_channel();
paul@3 16
    lcd   = l:new_channel();
paul@3 17
  };
paul@3 18
paul@3 19
l:start({
paul@3 20
    caps = {
paul@3 21
      cpm    = io_buses.cpm:svr(),
paul@3 22
      gpio   = io_buses.gpio:svr(),
paul@3 23
      lcd    = io_buses.lcd:svr(),
paul@3 24
paul@3 25
      icu    = L4.Env.icu,
paul@3 26
      sigma0 = L4.cast(L4.Proto.Factory, L4.Env.sigma0):create(L4.Proto.Sigma0),
paul@3 27
    },
paul@3 28
  },
paul@7 29
  "rom/io rom/hw_devices.io rom/mips-qi_lb60-common.io");
paul@3 30
paul@3 31
-- Expose a SPI peripheral as a device.
paul@3 32
paul@3 33
local spi = l:new_channel();
paul@3 34
paul@3 35
l:startv({
paul@3 36
    caps = {
paul@3 37
      vbus = io_buses.gpio,
paul@3 38
      spi  = spi:svr(),
paul@3 39
    },
paul@3 40
  },
paul@3 41
  "rom/dev_spi_jz4740", "C23", "C22", "C21"); -- specifying clock, data, enable pin details
paul@3 42
paul@3 43
-- Expose a SPI backlight device for the Ben.
paul@3 44
paul@3 45
local backlight = l:new_channel(); -- exposes backlight device
paul@3 46
paul@3 47
l:start({
paul@3 48
    caps = {
paul@3 49
      spi       = spi,
paul@3 50
      backlight = backlight:svr(),
paul@3 51
    },
paul@3 52
  },
paul@19 53
  "rom/dev_backlight_spi_ili8960");
paul@3 54
paul@3 55
-- Expose a display device for the Ben.
paul@3 56
paul@3 57
local display = l:new_channel(); -- exposes display device
paul@3 58
paul@3 59
l:start({
paul@3 60
    caps = {
paul@3 61
      backlight = backlight,
paul@3 62
      display   = display:svr(),
paul@3 63
      vbus      = io_buses.gpio,
paul@3 64
    },
paul@3 65
  },
paul@3 66
  "rom/dev_display_qi_lb60");
paul@3 67
paul@3 68
-- Expose the CPM peripheral.
paul@3 69
paul@3 70
local cpm = l:new_channel();
paul@3 71
paul@3 72
l:start({
paul@3 73
  caps = {
paul@3 74
      vbus    = io_buses.cpm,
paul@3 75
      cpm     = cpm:svr(),
paul@3 76
    },
paul@3 77
  },
paul@3 78
  "rom/dev_cpm_jz4740");
paul@3 79
paul@3 80
-- Expose a framebuffer device.
paul@3 81
paul@3 82
local fbdrv_fb = l:new_channel();
paul@3 83
paul@3 84
l:start({
paul@3 85
    caps = {
paul@3 86
      vbus    = io_buses.lcd,
paul@3 87
      fb      = fbdrv_fb:svr(),
paul@3 88
      cpm     = cpm,
paul@3 89
      display = display, -- needed by LCD driver
paul@3 90
    },
paul@3 91
  },
paul@3 92
  "rom/fb-drv");
paul@3 93
paul@3 94
-- Multiplex the framebuffer.
paul@3 95
paul@3 96
local mag_caps = {
paul@3 97
    mag = l:new_channel(),
paul@3 98
    svc = l:new_channel(),
paul@3 99
  };
paul@3 100
paul@3 101
l:start({
paul@3 102
    caps = {
paul@3 103
      vbus = io_buses.gpio, -- needed by input driver
paul@3 104
      fb   = fbdrv_fb,
paul@3 105
      mag  = mag_caps.mag:svr(),
paul@3 106
      svc  = mag_caps.svc:svr(),
paul@3 107
    },
paul@3 108
  },
paul@3 109
  "rom/mag");
paul@3 110
paul@3 111
-- Expose the keypad matrix.
paul@3 112
paul@3 113
local keypad = l:new_channel();
paul@3 114
paul@3 115
l:start({
paul@3 116
    caps = {
paul@3 117
      vbus = io_buses.gpio,
paul@3 118
      keypad = keypad:svr(),
paul@3 119
    },
paul@3 120
  },
paul@3 121
  "rom/dev_keypad_qi_lb60");
paul@3 122
paul@3 123
-- Expose the keypad events.
paul@3 124
paul@3 125
local ev = l:new_channel();
paul@3 126
paul@3 127
l:start({
paul@3 128
    caps = {
paul@3 129
      keypad = keypad,
paul@3 130
      ev = ev:svr(),
paul@3 131
    },
paul@3 132
  },
paul@38 133
  "rom/dev_input_keypad");
paul@3 134
paul@3 135
-- Show key event values.
paul@3 136
paul@3 137
l:startv({
paul@3 138
    caps = {
paul@3 139
      fb = mag_caps.svc:create(L4.Proto.Goos, "g=320x230+0+0", "barheight=10"),
paul@3 140
      ev = ev,
paul@3 141
    },
paul@3 142
  },
paul@3 143
  "rom/ex_input_event_client", "chars");