Modules | Functions

Functions which handle the beeper. More...

Modules

 Advanced informations
 

Functions

void beeper_on (void)
 Turns the beeper on. More...
 
void beeper_off (void)
 Turns the beeper off. More...
 
void beeper_set (uint16_t Hz)
 Sets the frequency of the beeper. More...
 

Detailed Description

Functions which handle the beeper.

example

/*******************************************************************************
* examples/beeper.c *
* ================= *
* *
* Version: 1.0.5 *
* Date : 01.11.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 testBeeper(void);
int main(void);
//*********************************[testBeeper]*********************************
void testBeeper(void) {
uint16_t hz = 1000;
lcdclr();
lcdstr_p(PSTR("Beeper" ));
lcdxy(0,1);
lcdstr_p(PSTR("1000 Hz <+> <-> "));
while (1) {
mdelay(100);
hz = (hz / 9) * 10;
if (hz > 9999) {hz = 9999;}
lcdxy(0,1);
} else if (buttons_get(kButtonRight)) {
mdelay(100);
hz = (hz / 10) * 9;
if (hz < 200) {hz = 200;}
lcdxy(0,1);
}
}
}
//*********************************[main]***************************************
int main (void) {
init_tucbot(0xFF);
testBeeper();
return (0);
}

Function Documentation

◆ beeper_off()

void beeper_off ( void  )

Turns the beeper off.

See also
beeper_on() and beeper_set()
Examples
cyclic.c.

◆ beeper_on()

void beeper_on ( void  )

Turns the beeper on.

See also
beeper_off() and beeper_set()

◆ beeper_set()

void beeper_set ( uint16_t  Hz)

Sets the frequency of the beeper.

Parameters
Hz16-bit unsigned integer
If the frequency is not 0 Hz the beeper is set to this frequency and turned on. Otherwise it will be turned off.
The lowest possible frequency is about 40 Hz.
See also
beeper_on() and beeper_off()
Examples
beeper.c, and cyclic.c.
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
kLedOn
@ kLedOn
constant (0xFF): turn leds on
Definition: leds.h:63
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.
int16tostr
void int16tostr(void *out, int16_t number, uint8_t digits)
Converts an integer to a string and passes it to an output function.
beeper_set
void beeper_set(uint16_t Hz)
Sets the frequency of the beeper.
kRequestContinuous
@ kRequestContinuous
constant (3): request continuous updates
Definition: update.h:37
kLedMiddle
@ kLedMiddle
bit mask (0x08): middle led
Definition: leds.h:44
kLedOff
@ kLedOff
constant (0x00): turn leds off
Definition: leds.h:61
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.
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.
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.