Files
hsb/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/HAL/inc/Buzzer.h
mmi a48164fe7a Added buzzer
Added powerloss detector

Added buzzer behaviour to system.
Added powerloss behaviour to system 

Added french translation to menu texts

git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@359 05563f52-14a8-4384-a975-3d1654cca0fa
2017-12-13 13:22:06 +00:00

162 lines
4.3 KiB
C

// -----------------------------------------------------------------------------
/// @file Buzzer.h
/// @brief File description
// -----------------------------------------------------------------------------
// Micro-Key bv
// Industrieweg 28, 9804 TG Noordhorn
// Postbus 92, 9800 AB Zuidhorn
// The Netherlands
// Tel: +31 594 503020
// Fax: +31 594 505825
// Email: support@microkey.nl
// Web: www.microkey.nl
// -----------------------------------------------------------------------------
/// $Revision$
/// $Author$
/// $Date$
// (c) 2015 Micro-Key bv
// -----------------------------------------------------------------------------
/// @defgroup {group_name} {group_description}
/// Description
/// @file Buzzer.h
/// @ingroup {group_name}
#ifndef INC_BUZZER_H_
#define INC_BUZZER_H_
// -----------------------------------------------------------------------------
// Include files
// -----------------------------------------------------------------------------
#include <stdbool.h>
#include "FreeRTOS.h"
#include "task.h"
#include "semphr.h"
#include "stm32f10x.h"
// -----------------------------------------------------------------------------
// Constant and macro definitions
// -----------------------------------------------------------------------------
#define BUZZER_MIN_PULSEWIDTH_MS (10)
#define BUZZER_KEYPAD_PULSEWIDTH_MS (60)
#define BUZZER_ERROR_PULSEWIDTH_MS (1000)
#define BUZZER_WARNING_PULSEWIDTH_MS (500)
#define BUZZER_KEYPAD_ACKNOWLEDGE(self) \
Buzzer_singleTone(self, BUZZER_KEYPAD_PULSEWIDTH_MS)
#define BUZZER_ERROR(self) \
Buzzer_start(self, BUZZER_ERROR_PULSEWIDTH_MS)
#define BUZZER_WARNING(self) \
Buzzer_start(self, BUZZER_WARNING_PULSEWIDTH_MS)
// -----------------------------------------------------------------------------
// Type definitions.
// -----------------------------------------------------------------------------
struct Buzzer
{
// General
bool initialized;
struct Gpio* gpio;
// Functionary properties
unsigned int pulseWidth;
// Task properties
bool runTask;
bool runPeriodically;
SemaphoreHandle_t semaphore;
xTaskHandle taskHandle;
int taskPriority;
uint16_t stackSize;
};
// -----------------------------------------------------------------------------
// Function declarations
// -----------------------------------------------------------------------------
/** ----------------------------------------------------------------------------
* Buzzer_construct
* Description of function
*
* @param self
* @param gpio
* @param taskPriority
* @param stackSize
*
* @return ErrorStatus
*
* @todo
* -----------------------------------------------------------------------------
*/
extern ErrorStatus Buzzer_construct(struct Buzzer* self, struct Gpio* gpio, int taskPriority, uint16_t stackSize);
/** ----------------------------------------------------------------------------
* Buzzer_destruct
* Description of function
*
* @param self
*
* @return void
*
* @todo
* -----------------------------------------------------------------------------
*/
extern void Buzzer_destruct(struct Buzzer* self);
/** ----------------------------------------------------------------------------
* Buzzer_start
* Description of function
*
* @param self
* @param pulseWidth
*
* @return void
*
* @todo
* -----------------------------------------------------------------------------
*/
extern void Buzzer_start(struct Buzzer* self, unsigned int pulseWidth);
/** ----------------------------------------------------------------------------
* Buzzer_stop
* Description of function
*
* @param self
* @param
* @return void
*
* @todo
* -----------------------------------------------------------------------------
*/
extern void Buzzer_stop(struct Buzzer* self);
/** ----------------------------------------------------------------------------
* Buzzer_singleTone
* Description of function
*
* @param self
* @param pulseWidth
* @return void
*
* @todo
* -----------------------------------------------------------------------------
*/
extern void Buzzer_singleTone(struct Buzzer* self, unsigned int pulseWidth);
#endif /* INC_BUZZER_H_ */