Hey people,
I don't have a question but I want to share this code.
I searched for a way to get a blinking LED within NG. Here is what it looks like:
EVENT_BUTTON id=1 type=meta meta=runsection:2 button_mode=Toggle
EVENT_LED id=1 dimmed=1
EVENT_LED id=2000
And this is the NGR-part:
if ^section == 2
if BUTTON:1 == 127
set LED:2000 127
endif
if BUTTON:1 == 0
set LED:2000 0
endif
if LED:2000 == 127
set LED:1 64
delay_ms 150
set LED:1 20
delay
In your App.c
#define RESOLUTION 1000 // in uS
#define TIMER_NUM 1 // TIM3
#define TIMER_PRIO MIOS32_IRQ_PRIO_MID
static void TIMER_TIck(void);
/////////////////////////////////////////////////////////////////////////////
// This hook is called after startup to initialize the application
/////////////////////////////////////////////////////////////////////////////
void APP_Init(void)
{
MIOS32_TIMER_Init(TIMER_NUM, RESOLUTION, TIMER_TIck, TIMER_PRIO);
}
// This function will be call