I just pulled from develop and my version does not have hal_adc support for the nrf52.
I looked in the following place and didn’t see a hal_adc.c file. $ ls repos/apache-mynewt-core/hw/mcu/nordic/nrf52xxx/src/ hal_cputime.c hal_gpio.c hal_system.c hal_uart.c hal_flash.c hal_os_tick.c hal_system_start.c nrf52_hw_id.c There is a method in hal_adc_int.h (I think this should be in hal_adc.h) that you can use to get a hal_adc object from the bsp /* The BSP must implement this factory to get devices for the application. */ extern struct hal_adc *bsp_get_hal_adc(enum system_device_id sysid); However, I think if you call this for nrf52 you will get an undefined external. From: "David G. Simmons" <[email protected]<mailto:[email protected]>> Reply-To: <[email protected]<mailto:[email protected]>> Date: Thursday, June 30, 2016 at 9:46 AM To: <[email protected]<mailto:[email protected]>> Subject: Using the ADC on nrf52dk I think I’m finally getting a handle on mynewt … I’m able to add tasks, schedule them, respond to them, etc. so this is some progress. :-) I do have a question about the ADC though. I can find scant info on how to use the ADC. In looking through the header files, I see that hal_adc.h defines some useful looking things like /* This is the device for an ADC. The application using the ADC device * does not need to know the definition of this device and can operate * with a pointer to this device. you can get/build device pointers in the * BSP */ struct hal_adc; /* initialize the ADC on the corresponding BSP Pin. Returns a pointer * to the adc object to use for the methods below. Returns NULL on * error */ struct hal_adc *hal_adc_init(enum system_device_id sysid); /* read the ADC corresponding to sysid in your system. Returns * the adc value read or negative on error, See * hal_adc_get_resolution to check the range of the return value */ int hal_adc_read(struct hal_adc *padc); But the “you can get/build device pointers in the BSP is a tad vague. I know (or at least think I know) that the ADC pin is P0.03, so that would be pin 3, but since hal_adc has no size, or real definition. So, anyone used the ADC on the NRF52 Dev board? dg -- David G. Simmons (919) 534-5099 Web<https://davidgs.com> • Blog<https://davidgs.com/davidgs_blog> • Linkedin<http://linkedin.com/in/davidgsimmons> • Twitter<http://twitter.com/TechEvangelist1> • GitHub<http://github.com/davidgs> /** Message digitally signed for security and authenticity. * If you cannot read the PGP.sig attachment, please go to * http://www.gnupg.com/ Secure your email!!! * Public key available at keyserver.pgp.com<http://keyserver.pgp.com/> **/ ♺ This email uses 100% recycled electrons. Don't blow it by printing! There are only 2 hard things in computer science: Cache invalidation, naming things, and off-by-one errors.
