bumper.c
/*******************************************************************************
* examples/bumper.c *
* ================= *
* *
* Version: 1.0.6 *
* Date : 06.12.17 *
* Author : Peter Weissig *
* *
* If you are changing this file, you may also consider to update *
* demos/diagnosticTool/diagnosticTool.c *
*******************************************************************************/
//*********************************<Included files>*****************************
#include <tucbot/tucbot.h>
//*********************************<Methods>************************************
void testBumper(void);
int main(void);
//*********************************[testBumper]*********************************
void testBumper(void) {
uint8_t bumpers;
lcdclr();
lcdstr_p(PSTR("Bumper" ));
lcdxy(0,1);
lcdstr_p(PSTR("F: # # B: # # "));
while (1) {
if (bumpers_changed()) {
bumpers = bumpers_get(kBumperAll);
lcdxy( 3,1);
if (bumpers & kBumperFrontLeft ) {lcdout('L'); }
else {lcdout(' ');}
lcdxy( 5,1);
if (bumpers & kBumperFrontRight) {lcdout('R'); }
else {lcdout(' ');}
lcdxy(11,1);
if (bumpers & kBumperBackLeft ) {lcdout('L'); }
else {lcdout(' ');}
lcdxy(13,1);
if (bumpers & kBumperBackRight ) {lcdout('R'); }
else {lcdout(' ');}
}
}
}
//*********************************[main]***************************************
int main (void) {
init_tucbot(0xFF);
testBumper();
return (0);
}
kBumperBackLeft
@ kBumperBackLeft
bit mask (0x04): the back left bumper
Definition: bumpers.h:36
kBumperFrontRight
@ kBumperFrontRight
bit mask (0x02): the front right bumper
Definition: bumpers.h:34
kRequestContinuous
@ kRequestContinuous
constant (3): request continuous updates
Definition: update.h:37
kBumperAll
@ kBumperAll
bit mask (0x0F): all bumpers
Definition: bumpers.h:40
lcdclr
void lcdclr(void)
Clears the display.
lcdxy
void lcdxy(uint8_t x, uint8_t y)
Moves the cursor to a postion on the display.
bumpers_request
void bumpers_request(eRequestType request)
Requests new data from the bumpers.
bumpers_changed
uint8_t bumpers_changed(void)
Indicates if new data changed the data block sMD_Bumper.
lcdstr_p
void lcdstr_p(const char *send_data)
Writes a string located in the flash to the display.
lcdout
void lcdout(uint8_t data)
Writes one byte to the display.
kBumperBackRight
@ kBumperBackRight
bit mask (0x08): the back right bumper
Definition: bumpers.h:38
init_tucbot
void init_tucbot(uint8_t enable_interrupts)
Initiates the TUC-Bot.
bumpers_get
eBumperMask bumpers_get(eBumperMask bitmask)
Returns the last stored value of the masked bumpers.
kBumperFrontLeft
@ kBumperFrontLeft
bit mask (0x01): the front left bumper
Definition: bumpers.h:32