Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dadosutter committed Jan 23, 2011
0 parents commit 9e6a414
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
34 changes: 34 additions & 0 deletions EK-LM3S6965.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
-- 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

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

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 )

20 changes: 20 additions & 0 deletions EK-LM3S8962.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
local pio = pio

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

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 )

0 comments on commit 9e6a414

Please sign in to comment.