Lizzy project

Dependencies:   aconno_I2C Lis2dh12 adc52832_common aconno_SEGGER_RTT

Committer:
jurica238814
Date:
Thu Sep 13 12:20:35 2018 +0200
Branch:
mbedOsUpdate
Revision:
19:2681edc2f2b9
Parent:
8:7ba4f82de9b6
Work in progress

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dbartolovic 8:7ba4f82de9b6 1 #ifndef __BSP_BUZZ_H__
dbartolovic 8:7ba4f82de9b6 2 #define __BSP_BUZZ_H__
dbartolovic 8:7ba4f82de9b6 3
jurica238814 19:2681edc2f2b9 4 #include "aconnoConfig.h"
dbartolovic 8:7ba4f82de9b6 5 #include "acn_nrf52_pwm.h"
dbartolovic 8:7ba4f82de9b6 6
dbartolovic 8:7ba4f82de9b6 7 #if NANO_MODULE
dbartolovic 8:7ba4f82de9b6 8 #else
dbartolovic 8:7ba4f82de9b6 9 #define BUZZER_PIN (p18)
dbartolovic 8:7ba4f82de9b6 10 #endif
dbartolovic 8:7ba4f82de9b6 11
dbartolovic 8:7ba4f82de9b6 12 #define BUZZER_FREQUENCY_HZ (4000)
dbartolovic 8:7ba4f82de9b6 13 #define BUZZ_TIME_S (2) /* Buzz time in s */
dbartolovic 8:7ba4f82de9b6 14
dbartolovic 8:7ba4f82de9b6 15 class Buzz
dbartolovic 8:7ba4f82de9b6 16 {
dbartolovic 8:7ba4f82de9b6 17 typedef typeof(NRF_PWM0) NRF_PWM_TYPE;
jurica238814 19:2681edc2f2b9 18
dbartolovic 8:7ba4f82de9b6 19 public:
jurica238814 19:2681edc2f2b9 20
dbartolovic 8:7ba4f82de9b6 21 Buzz(NRF_PWM_TYPE pwmInstance, uint8_t pin) :
dbartolovic 8:7ba4f82de9b6 22 buzzer(pwmInstance), pwm_pin(pin), state(false){}
jurica238814 19:2681edc2f2b9 23
dbartolovic 8:7ba4f82de9b6 24 void enable();
dbartolovic 8:7ba4f82de9b6 25 void disable();
jurica238814 19:2681edc2f2b9 26
dbartolovic 8:7ba4f82de9b6 27 inline bool get_state(){ return state; }
jurica238814 19:2681edc2f2b9 28
dbartolovic 8:7ba4f82de9b6 29 private:
jurica238814 19:2681edc2f2b9 30
dbartolovic 8:7ba4f82de9b6 31 uint8_t pwm_pin;
dbartolovic 8:7ba4f82de9b6 32 NRF52_PWM buzzer;
jurica238814 19:2681edc2f2b9 33
dbartolovic 8:7ba4f82de9b6 34 bool state;
dbartolovic 8:7ba4f82de9b6 35 };
dbartolovic 8:7ba4f82de9b6 36
jurica238814 19:2681edc2f2b9 37 #endif //__BSP_BUZZ_H__