![Silicon Laboratories Si4012 Programming Manual Download Page 24](http://html1.mh-extra.com/html/silicon-laboratories/si4012/si4012_programming-manual_1272046024.webp)
A N 7 4 6
24
Rev. 0.1
5.3.5. Human-Machine Interface Module
The HMI related source files, called hmi.h and hmi.c, can be found in the
/src/driver/
folder. In order to use this
module, the required handlers need to be initialized at the very beginning of the program. Checking the status of
the various hardware components require to have a common cyclic mechanism. A 1 ms interrupt based cycle is
vital to be running in the background to serve the different handlers.
By using the LED handler, states of LEDs can be set and cleared either separately or together.
To manipulate the LEDs’ behavior dynamically,
eHmi_LedStates
needs to be used.
By using the button handler, statuses of the push-buttons can be read. Even if more button events happened
simultaneously, they can be stored to be handled later. The last pushed button event is always available first
amongst the unhandled events.
HANDLERS
//Start
the
push
button
handler
void
vHmi_InitPbHandler
(void);
//
Start
the
Led
handler
void
vHmi_InitLedHandler
(void);
//
Start
the
Buzzer
Handler
void
vHmi_InitBuzzer
(void);
void
vHmi_InitLedHandler
(
void
);
void
vHmi_ChangeLedState
(
eHmi_Leds
qiLed,
eHmi_LedStates
qiLedState);
void
vHmi_ChangeAllLedState
(
eHmi_LedStates
qiLedState);
void
vHmi_LedHandler
(
void
);
void
vHmi_ClearAllLeds
(
void
);
typedef
enum
_eHmi_LedStates
{
eHmi_LedOff_c
=
0x00,
/**<
Led
is
in
off
state
*/
eHmi_LedStdBy_c
=
0x01,
/**<
Led
waits
for
state
change
*/
eHmi_LedOn_c
=
0x10,
/**<
Led
is
in
on
state
*/
eHmi_LedBlink2Hz_c
=
0x20,
/**<
Led
blinks
with
2Hz
*/
eHmi_LedBlink1Hz_c
=
0x30,
/**<
Led
blinks
with
1Hz
*/
eHmi_LedBlinkHalfHz_c
=
0x40,
/**<
Led
blinks
with
0.5Hz
*/
eHmi_LedBlinkOnce_c
=
0x50,
/**<
Blinks
led
once
*/
eHmi_LedBlinkWait_c
=
0x55,
/**<
Blinks
led
once
*/
}
eHmi_LedStates
;
void
vHmi_InitPbHandler
(
void
);
BIT
gHmi_PbIsPushed
(
U8
*boPbPushTrack,
U16
*woPbPushTime);
BIT
gHmi_IsPbUnHandled
(
void
);
U8
bHmi_PbGetLastButton
(
U16
*woPbPushTime);
void
vHmi_PbHandler
(
void
);
Summary of Contents for Si4012
Page 14: ...AN746 14 Rev 0 1...
Page 18: ...AN746 18 Rev 0 1...
Page 29: ...AN746 Rev 0 1 29 NOTES...