Lizzy project

Dependencies:   aconno_I2C Lis2dh12 adc52832_common aconno_SEGGER_RTT

Revision:
8:7ba4f82de9b6
Child:
19:2681edc2f2b9
diff -r ac8277568115 -r 7ba4f82de9b6 bsp/bsp_buzz.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bsp/bsp_buzz.h	Tue Mar 20 15:13:51 2018 +0000
@@ -0,0 +1,37 @@
+#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__
\ No newline at end of file