Hi Dialog,
我们使用一个定制的董事会与DA14585nd the SDK 6.0.10 . we want to add a buzzer and control it through a service. We have added the service but we want continuous beeps and not a musical note. We saw the timer0_pwm example and implemented by taking it as a reference. we are using the extended sleep mode. Can you please tell me how can i configure it so that i can hear continuous beep sounds ?
Device:
Hi blebot,
Let me ask you some questions in under to understand deeper which your requirements are and what would you like to accomplish.
Thanks, PM_Dialog
Hi,
Thanks for the reply.
1. Yes, exactly.
2. In the timer0_pwm example, as you said the timer0_pwm_test_expiration_counter decrements everytime and when it goes to zero the timer_0 will be stopped but i don't want it to stop unless i give the command to stop.i want the buzzer to make continuous beep sounds until i stop. Is there a way to do that ? and also there is a musical note in the example but i don't want to play notes just a simple beep sounds .
3.Can i make the timer block not powered down when the device enters sleep mode? if yes, How ?
Thanks,
Blebot.
Hi blebot,
Please check the ble_app_peripheral example of the SDK and focus on user_catch_rest_hndl() callback function which handles the messages that are not handled by the SDK internal mechanisms. Suppose that you have a writable characteristic in order to send the START/STOP command. In the ble_app_peripheral example, when writing to the “Control Point” characteristic, you will get a SVC1_IDX_CONTROL_POINT_VAL and the user_svc1_ctrl_wr_ind_handler() will be fired up which is the control point write indication handler. The “Control Point” characteristic has 1-byte length. The same you should implement for your case: START: 0x01 – STOP: 0x00 for example. The value that is written to the characteristic is stored into ¶m->value[0], so you should copy it to the “val”.
Regarding the timer0_pwm example, as I mentioned before, every time that an interrupt is generated, the pwm0_user_callback_function() is triggered. The notes are stored in the notes[] array. In you case, you should find which is the appropriate waveform for the beep sound and modify the callback accordingly. Regarding your last question, this is not possible. If you found any answer useful, please mark it as “accepted”.
Thanks, PM_Dialog
Hi Dialog,
Thanks for the reply . we know how to write and handle a 'control point' characteristic.
Is there a way we can workout the functionality in sleep mode ?
Thanks,
Blebot
Hi blebot,
As it is already mentioned, as soon as the device goes into sleep, all the peripheral blocks are powered down.
Thanks, PM_Dialog
Hi,
Thanks . Can i make the buzzer sound whenever the device gets out of sleep and and shut it off when the device enters sleep mode ?
Regards,
blebot.
Hi blebot,
Generally, the device goes into sleep between advertising and connection intervals. The state of the pin before going to sleep, is retained but not the configuration or the functionality of the pin. when the device wake's up the periph_init() function is called in order to re-configure the pins in each wakeup and the pins return their default application state. So, if any of the GPIOs is high before going to sleep, it will stay high during sleep, and will be reconfigured in wake up by the periph_init() function. Do you want to go into permanent sleep as implemented in the ble_app_sleepmode example of the SDK?
Thanks, PM_Dialog
Hi,
Yes , we are using permanent sleep as implemented in the ble_app_sleepmode example but not copying from OTP. We just want to make the buzzer sound everytime the device wakes up .
Thank you, blebot.
Hi blebot,
Alright, let me describe you a possible implementation about this. Please check the ble_app_sleepmode example of the SDK.
这是一个可能的实现。如果你发现它useful, please mark the answer as “accepted”
Thanks, PM_Dialog