-
Notifications
You must be signed in to change notification settings - Fork 0
/
EK-LM3S6965.lua
executable file
·39 lines (31 loc) · 1.25 KB
/
EK-LM3S6965.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
-- This auxiliar platform dependent module defines some hardware devices
-- available in the specific development kit.
-- It will be automatically require()d when eLua detects it is running on the
-- respective platform, exposing auxiliar constants and functions to facilitate
-- and keep portable the access to the underlying hardware.
-- The code configures the MCU to interface with the platform devices and
-- exposes the following objects, constants and fuctions:
-- Onboard Buttons:
-- BTN_UP, BTN_DOWN, BTN_LEFT, BTN_RIGHT, BTN_SELECT
-- Onboard LED:
-- Auxiliar Function:
-- btn_pressed( button )
-- returns true if the arg button is pressed, false otherwise
local pio = pio
local lm3s = lm3s
module(...)
BTN_UP = pio.PE_0
BTN_DOWN = pio.PE_1
BTN_LEFT = pio.PE_2
BTN_RIGHT = pio.PE_3
BTN_SELECT = pio.PF_1
btn_pressed = function( button )
return pio.pin.getval( button ) == 0
end
LED_1 = pio.PF_0
-- Associate the RIT OLED display device supported by the builtin module lm3s with
-- a disp name/device offered here
disp = lm3s.disp
pio.pin.setdir( pio.INPUT, BTN_UP, BTN_DOWN, BTN_LEFT, BTN_RIGHT, BTN_SELECT )
pio.pin.setpull( pio.PULLUP, BTN_UP, BTN_DOWN, BTN_LEFT, BTN_RIGHT, BTN_SELECT )
pio.pin.setdir( pio.OUTPUT, LED_1 )