[En-Nut-Discussion] Configuration functions with arguments?

bon at elektron.ikp.physik.tu-darmstadt.de bon at elektron.ikp.physik.tu-darmstadt.de
Sat Jan 4 16:05:34 CET 2014


Hello,

can a function in the .nut file have arguments? The argument is the value of
a macro determined before.

Some example would be
 
function GetStmTimerChannelList(Timer)
 if TIMER == 1 return { "1", "2", "3", "4" } end
 if TIMER == 6 return { "1"} end


...
            {
                macro = "STM32TIM_OWI0_TIMER_ID",
                brief = "Timer for STM32 hardware timer OWI0 bus",
                description = "Timer used for OWI Bus 0. Requires at least
            dual channel!",
                type = "enumerated",
                choices = function() return GetStmTwoChannelsTimers() end,
                file = "include/cfg/owi.h",
            },
            {
                macro = "STM32TIM_OWI0_CHANNEL",
                brief = "Channel for STM32 hardware timer OWI0 bus",
                description = "Channel used for STM32 hardware timer OWI0
            bus. Requires at least dual channel!",
                type = "enumerated",
                choices = function() return GetStmTimerChannelList("STM32TIM_OWI0_TIMER_ID"),
                default = "1",
                file = "include/cfg/owi.h",
            },

Thanks

-- 
Uwe Bonnes                bon at elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------


More information about the En-Nut-Discussion mailing list