Lizzy project

Dependencies:   aconno_I2C Lis2dh12 adc52832_common aconno_SEGGER_RTT

bsp/bsp_buzz.h

Committer:
jurica238814
Date:
2019-01-31
Branch:
master
Revision:
29:b021b33cf666
Parent:
8:7ba4f82de9b6
Child:
19:2681edc2f2b9

File content as of revision 29:b021b33cf666:

#ifndef __BSP_BUZZ_H__
#define __BSP_BUZZ_H__

#include "main.h"
#include "acn_nrf52_pwm.h"

#if NANO_MODULE
#else
    #define BUZZER_PIN          (p18)
#endif

#define BUZZER_FREQUENCY_HZ       (4000)
#define BUZZ_TIME_S               (2)     /* Buzz time in s */

class Buzz
{
    typedef typeof(NRF_PWM0) NRF_PWM_TYPE;
    
    public:
        
        Buzz(NRF_PWM_TYPE pwmInstance, uint8_t pin) :
        buzzer(pwmInstance), pwm_pin(pin), state(false){}
        
        void enable();
        void disable();
        
        inline bool get_state(){ return state; }
        
    private:
        
        uint8_t pwm_pin;
        NRF52_PWM buzzer;
        
        bool state;
};

#endif //__BSP_BUZZ_H__