calvin-base icon indicating copy to clipboard operation
calvin-base copied to clipboard

Expose constants defined in calvinsys to Calvin scripts

Open fswensson opened this issue 10 years ago • 2 comments

It would be nice to be able to use constants defined in an object in calvinsys from an Calvin script.

Example: calvinsys/io/gpio_handler defines the constants PULLUP and PULLDOWN for enabling internal pull up/down resistors, these are then accessible from an Calvin script:

gpio : io.GPIOReader(pull=calvinsys.io.gpio_handler.PULLUP)

fswensson avatar Nov 13 '15 08:11 fswensson

What about @io.gpio_handler.PULLUP using @ to signify an "address" to a value? Could be used as is, or in via a define PULLUP = @io.gpio_handler.PULLUP.

persquare avatar Mar 28 '16 07:03 persquare

Looks good!

fswensson avatar Mar 29 '16 06:03 fswensson