SparkFun Qwiic Buzzer  v1.0.1-17-gba6cd53
Library for the SparkFun Qwiic Buzzer
Loading...
Searching...
No Matches
QwiicBuzzer Class Reference

#include <SparkFun_Qwiic_Buzzer_Arduino_Library.h>

Inheritance diagram for QwiicBuzzer:

Public Member Functions

bool begin (const uint8_t address=SFE_QWIIC_BUZZER_DEFAULT_ADDRESS, TwoWire &wirePort=Wire)
 Begins the Qwiic Buzzer. More...
 
bool isConnected ()
 Checks if the Qwiic Buzzer is connected. More...
 
sfTkError_t begin (sfTkII2C *theBus=nullptr)
 Begins the Qwiic Buzzer. More...
 
sfTkError_t deviceId (uint8_t &deviceId)
 Reads the Device ID of the Qwiic Buzzer. More...
 
bool firmwareVersionMajor (uint8_t &versionMajor)
 Reads the Firmware Version Major of the Qwiic Buzzer. More...
 
bool firmwareVersionMinor (uint8_t &versionMinor)
 Reads the Firmware Version Minor of the Qwiic Buzzer. More...
 
sfTkError_t configureBuzzer (const uint16_t toneFrequency=SFE_QWIIC_BUZZER_RESONANT_FREQUENCY, const uint16_t duration=0, const uint8_t volume=4)
 Configures the Qwiic Buzzer without causing the buzzer to buzz. This allows configuration in silence (before you may want to buzz). It is also useful in combination with saveSettings(), and then later causing buzzing by using the physical TRIGGER pin. To start buzzing (via Qwiic) with your desired configuration, use this function, then call on(). More...
 
sfTkError_t on ()
 Turns on buzzer. More...
 
sfTkError_t off ()
 Turns off buzzer. More...
 
sfTkError_t saveSettings ()
 Stores settings to EEPROM. More...
 
sfTkError_t setAddress (const uint8_t &address)
 Changes the I2C address of the Qwiic Buzzer. More...
 
uint8_t address ()
 Gets the current I2C address of the Qwiic Buzzer. More...
 
bool playSoundEffect (const uint8_t soundEffectNumber, const uint8_t volume)
 Plays one of the sound effects included in this library. More...
 

Protected Attributes

sfTkII2C * _theBus
 

Member Function Documentation

◆ address()

uint8_t sfDevBuzzer::address ( )
inherited

Gets the current I2C address of the Qwiic Buzzer.

Returns
The current I2C address, 7-bit unshifted

◆ begin() [1/2]

bool QwiicBuzzer::begin ( const uint8_t  address = SFE_QWIIC_BUZZER_DEFAULT_ADDRESS,
TwoWire &  wirePort = Wire 
)
inline

Begins the Qwiic Buzzer.

Parameters
addressI2C device address to use for the sensor
wirePortWire port to use for I2C communication
Returns
True if successful, false otherwise

◆ begin() [2/2]

sfTkError_t sfDevBuzzer::begin ( sfTkII2C *  theBus = nullptr)
inherited

Begins the Qwiic Buzzer.

Parameters
theBusI2C bus to use for communication
Returns
0 for succuss, negative for errors, positive for warnings

◆ configureBuzzer()

sfTkError_t sfDevBuzzer::configureBuzzer ( const uint16_t  toneFrequency = SFE_QWIIC_BUZZER_RESONANT_FREQUENCY,
const uint16_t  duration = 0,
const uint8_t  volume = 4 
)
inherited

Configures the Qwiic Buzzer without causing the buzzer to buzz. This allows configuration in silence (before you may want to buzz). It is also useful in combination with saveSettings(), and then later causing buzzing by using the physical TRIGGER pin. To start buzzing (via Qwiic) with your desired configuration, use this function, then call on().

Parameters
toneFrequencyFrequency in Hz of buzzer tone
durationDuration in milliseconds (0 = forever)
volumeVolume (4 settings; 0=off, 1=quiet... 4=loudest)
Returns
0 for succuss, negative for errors, positive for warnings

◆ deviceId()

sfTkError_t sfDevBuzzer::deviceId ( uint8_t &  deviceId)
inherited

Reads the Device ID of the Qwiic Buzzer.

Parameters
deviceIduint8_t variable where the read results will be stored
Returns
0 for succuss, negative for errors, positive for warnings

◆ firmwareVersionMajor()

bool sfDevBuzzer::firmwareVersionMajor ( uint8_t &  versionMajor)
inherited

Reads the Firmware Version Major of the Qwiic Buzzer.

Parameters
versionMajorVariable where the read results will be stored
Returns
1 for succuss, 0 error

◆ firmwareVersionMinor()

bool sfDevBuzzer::firmwareVersionMinor ( uint8_t &  versionMinor)
inherited

Reads the Firmware Version Minor of the Qwiic Buzzer.

Parameters
versionMinorVariable where the read results will be stored
Returns
1 for succuss, 0 error

◆ isConnected()

bool QwiicBuzzer::isConnected ( )
inline

Checks if the Qwiic Buzzer is connected.

Returns
True if the sensor is connected, false otherwise

◆ off()

sfTkError_t sfDevBuzzer::off ( )
inherited

Turns off buzzer.

Returns
0 for succuss, negative for errors, positive for warnings

◆ on()

sfTkError_t sfDevBuzzer::on ( )
inherited

Turns on buzzer.

Returns
0 for succuss, negative for errors, positive for warnings

◆ playSoundEffect()

bool sfDevBuzzer::playSoundEffect ( const uint8_t  soundEffectNumber,
const uint8_t  volume 
)
inherited

Plays one of the sound effects included in this library.

Parameters
soundEffectNumberThe sound effect you with to play
volumeVolume (4 settings; 0=off, 1=quiet... 4=loudest)
Returns
1 for succuss, 0 error

◆ saveSettings()

sfTkError_t sfDevBuzzer::saveSettings ( )
inherited

Stores settings to EEPROM.

Returns
0 for succuss, negative for errors, positive for warnings

◆ setAddress()

sfTkError_t sfDevBuzzer::setAddress ( const uint8_t &  address)
inherited

Changes the I2C address of the Qwiic Buzzer.

Parameters
addressNew address, must be in the range 0x08 to 0x77
Returns
0 for succuss, negative for errors, positive for warnings

Member Data Documentation

◆ _theBus

sfTkII2C* sfDevBuzzer::_theBus
protectedinherited

The documentation for this class was generated from the following file: