Skip to content

Commit

Permalink
Merge pull request bitcraze#260 from fredg02/master
Browse files Browse the repository at this point in the history
Add buzzer deck init parameter (bitcraze#237)
  • Loading branch information
krichardsson authored Nov 9, 2017
2 parents b8a9e14 + fee178e commit 31f7167
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/deck/drivers/src/buzzdeck.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,13 @@
#include "stm32fxxx.h"

#include "deck.h"
#include "param.h"

#include "buzzer.h"
#include "piezo.h"

static bool isInit;

static void buzzDeckOn(uint32_t freq)
{
piezoSetRatio(128);
Expand All @@ -51,8 +54,14 @@ static struct buzzerControl buzzDeckCtrl = {

static void buzzDeckInit(DeckInfo *info)
{
if (isInit) {
return;
}

piezoInit();
buzzerSetControl(&buzzDeckCtrl);

isInit = true;
}

static const DeckDriver buzzer_deck = {
Expand All @@ -67,3 +76,7 @@ static const DeckDriver buzzer_deck = {
};

DECK_DRIVER(buzzer_deck);

PARAM_GROUP_START(deck)
PARAM_ADD(PARAM_UINT8 | PARAM_RONLY, bcBuzzer, &isInit)
PARAM_GROUP_STOP(deck)

0 comments on commit 31f7167

Please sign in to comment.