Modules | Enumerations | Functions

Functions which handle the leds. More...

Modules

 Advanced informations
 

Enumerations

enum  eLedMask
 clusters bit masks for accessing the leds More...
 
enum  eLed
 clusters boolean values for the leds More...
 

Functions

void leds_set (eLedMask bitmask, uint8_t bool)
 Sets the selected leds on or off. More...
 
eLedMask leds_get (eLedMask bitmask)
 Returns the current state of the selected leds. More...
 

Detailed Description

Functions which handle the leds.

example

/*******************************************************************************
* examples/led.c *
* ============== *
* *
* Version: 1.0.2 *
* Date : 01.11.17 *
* Author : Peter Weissig *
*******************************************************************************/
//*********************************<Included files>*****************************
#include <tucbot/tucbot.h>
//*********************************<Methods>************************************
void testLed(void);
int main(void);
//*********************************[testLed]***********************************
void testLed(void) {
while (1) {
mdelay(100);
mdelay(100);
mdelay(100);
mdelay(100);
mdelay(100);
mdelay(100);
mdelay(100);
mdelay(100);
}
}
//*********************************[main]***************************************
int main (void) {
init_tucbot(0xFF);
testLed();
return (0);
}

Enumeration Type Documentation

◆ eLed

enum eLed

clusters boolean values for the leds

See also
leds_set()
Enumerator
kLedOff 

constant (0x00): turn leds off

kLedOn 

constant (0xFF): turn leds on

◆ eLedMask

enum eLedMask

clusters bit masks for accessing the leds

This enum is used for masking the leds in leds_set() and leds_get(). Additionally it is used for storing leds_get()'s result as a bitfield.

Enumerator
kLedNone 

bit mask (0x00): no leds

kLedLeft 

bit mask (0x10): left led

kLedMiddle 

bit mask (0x08): middle led

kLedRight 

bit mask (0x04): right led

kLedAll 

bit mask (0x1C): all leds (except for laustracker)

kLedLaustracker 

bit mask (0x20): laustracker led module

kLedAllWithLaustracker 

bit mask (0x3C): all leds (including laustracker)

Function Documentation

◆ leds_get()

eLedMask leds_get ( eLedMask  bitmask)

Returns the current state of the selected leds.

This function relies directly on the measured state of led pins.

Parameters
bitmaskbit mask of the selected leds - see also eLedMask
The parameter is used to only return the state of the selected leds. All other states(bits) are set to 0.
Note
There are two different bit masks for all leds: kLedAll and kLedAllWithLaustracker
Returns
bitfield of the emitting leds - see also eLedMask
If a led is turned on its related bit will be 1, otherwise 0.
If only one led is selected the return value can be interpreted as a boolean expression.
See also
leds_set()
Examples
remoteControl.c.

◆ leds_set()

void leds_set ( eLedMask  bitmask,
uint8_t bool   
)

Sets the selected leds on or off.

The value parameter is a boolean expression.

This function will set the selected leds immediately.

Parameters
bitmaskbit mask of the selected leds - see also eLedMask
The parameter is used to only change the state of the selected leds. All other leds stay unchanged.
bool8-bit unsigned integer which is boolean - see also eLed
Note
There are two different bit masks for all leds: kLedAll and kLedAllWithLaustracker
See also
leds_get()
Examples
beeper.c, button.c, cyclic.c, driveAdjust.pupil.c, driveAngle.pupil.c, driveArc.pupil.c, driveDist.pupil.c, encoderComplex.c, encoderSimple.c, imu.c, lausTracker.c, led.c, lineComplex.c, mode.c, motorComplex.c, motorSimple.c, packedCom.c, remoteControl.c, servo.c, sharp.c, twi.c, and uart.c.
leds_set
void leds_set(eLedMask bitmask, uint8_t bool)
Sets the selected leds on or off.
kLedOn
@ kLedOn
constant (0xFF): turn leds on
Definition: leds.h:63
kLedRight
@ kLedRight
bit mask (0x04): right led
Definition: leds.h:46
kLedLeft
@ kLedLeft
bit mask (0x10): left led
Definition: leds.h:42
kLedMiddle
@ kLedMiddle
bit mask (0x08): middle led
Definition: leds.h:44
kLedOff
@ kLedOff
constant (0x00): turn leds off
Definition: leds.h:61
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.