button.c
/*******************************************************************************
* examples/button.c *
* ================= *
* *
* Version: 1.0.3 *
* Date : 01.11.17 *
* Author : Peter Weissig *
*******************************************************************************/
//*********************************<Included files>*****************************
#include <tucbot/tucbot.h>
//*********************************[testButton]*********************************
void
testButton(
void
) {
while
(1) {
leds_set
(
kLedLeft
,
buttons_get
(
kButtonLeft
));
leds_set
(
kLedMiddle
,
buttons_get
(
kButtonMiddle
));
leds_set
(
kLedRight
,
buttons_get
(
kButtonRight
));
mdelay
(50);
}
}
//*********************************[main]***************************************
int
main (
void
) {
init_tucbot
(0xFF);
buttons_request
(
kRequestContinuous
);
testButton();
return
(0);
}
leds_set
void leds_set(eLedMask bitmask, uint8_t bool)
Sets the selected leds on or off.
buttons_get
eButtonMask buttons_get(eButtonMask bitmask)
Returns the last stored value of the selected buttons.
kButtonMiddle
@ kButtonMiddle
bit mask (0x08): middle button
Definition:
buttons.h:35
kLedRight
@ kLedRight
bit mask (0x04): right led
Definition:
leds.h:46
kButtonRight
@ kButtonRight
bit mask (0x10): right button
Definition:
buttons.h:37
buttons_request
void buttons_request(eRequestType request)
Requests new data from the buttons.
kButtonLeft
@ kButtonLeft
bit mask (0x04): left button
Definition:
buttons.h:33
kLedLeft
@ kLedLeft
bit mask (0x10): left led
Definition:
leds.h:42
kRequestContinuous
@ kRequestContinuous
constant (3): request continuous updates
Definition:
update.h:37
kLedMiddle
@ kLedMiddle
bit mask (0x08): middle led
Definition:
leds.h:44
init_tucbot
void init_tucbot(uint8_t enable_interrupts)
Initiates the TUC-Bot.
mdelay
void mdelay(uint16_t mseconds)
Waits for the given time in milliseconds.
Generated on Wed Mar 1 2023 09:00:05 for TUC-Bot library by
1.8.17