Sending ADC data in ble_app_peripheral

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.wsdof.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
3 posts / 0 new
Last post
AndyC
Offline
Last seen:2 years 10 months ago
Joined:2017-10-07 09:22
Sending ADC data in ble_app_peripheral

我想开始我的道歉,因为这是这样一个beginners question, but I seem to be a little lost.

I’m looking at the ble_app_peripherial sample app (5.0.4 SDK). I’ve modified the code so that I can send the LED STATE from a connected mobile phone app to change the state of the LED.

However, I’m having trouble understanding how to send ads data. I understand from the ADC peripheral example how to read data from the ADC via adc_get_sample(void) . However I can not find this line in the code outside of the SDK adc.c file.

Am I missing something, does the ble_app_peripherial send ADC data ? If not, where do I put the code to get a ADC value ? Further, how do I transmit the data over the AdC channel ?

Many thanks for any help and apologies again for a beginners question.

Andy Cobley
University of Dundee

Device:
PM_Dialog
Offline
Last seen:1 day 1 hour ago
Staff
Joined:2018-02-08 11:03
Hi AndyC,

Hi AndyC,

Please check the8.26 Pillar 3 (Peripheral)chapter of theDA1458x Software Developer’s Guide (UM-B-050)user manual. This chapter demonstrates some basic interaction with three characteristics of a custom profile. TheADC VAL1 characteristic of the custom profile, reads samples from an ADC channel and send them via notification. Be aware that here is no hardware support for reading an Analog value and we are not using the adc.c driver for this example. So, when the ADC VAL 1 auto notifications are turned on from the central device and the notify operation is required by the peer, a 16-bit counter is incremented. This counter value emulates the Analog value of the ADC VAL 1.

Please check the user_catch_rest_hndl() function in the user_peripheral.c file in order to understand how each event is cached by the application and which user functions will be invoked. When the application gets a CUST1_IDX_CONTROL_POINT_VAL message, the user_custs1_ctrl_wr_ind_handler() function will be triggered from the user_catch_rest_hndl(). This function checks if the notifications are enabled or disabled and if they are enabled the app_adcval1_timer_cb_handler() callback will be invoked periodically when the app_easy_timer() elapses (APP_PERIPHERAL_CTRL_TIMER_DELAY = 100ms duration). This callback increments a 16-bit counter and sends each value to the central device via notifications

Thanks, PM_Dialog

AndyC
Offline
Last seen:2 years 10 months ago
Joined:2017-10-07 09:22
Thanks for that. I think I

Thanks for that. I think I was missing the Software developers guide.

https://support.dialog-semiconductor.com/resource/um-b-050-da1458x-softw...

Looks like that will get me started !
Andy