-
Notifications
You must be signed in to change notification settings - Fork 364
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hw/adc: Fix configuration for ADC on nRF5x
This patch fixes the way ADC is configured for nRF5x boards as it was confused what configuration should be provided when created adc device and how to configure it on open. With this patch when ADC os_dev is created (what happens in hal_bsp.c), It is expected to provide 'struct nrf52_adc_dev_cfg' or 'struct nrf51_adc_dev_cfg' which contains reference mv which can be configured by MYNEWT_VALs e.g. ADC_0_REFMV_0 When opening adc os_device (what happens in application), user needs to provide 'nrfx_saadc_config_t' with appropriate resolution, oversample etc. e.g. nrfx_saadc_config_t adc_config = { .resolution = NRF_SAADC_RESOLUTION_8BIT, .oversample = NRF_SAADC_OVERSAMPLE_DISABLED, .interrupt_priority = 7, .low_power_mode = NRFX_SAADC_CONFIG_LP_MODE }; nrf_saadc_channel_config_t cc = NRFX_SAADC_DEFAULT_CHANNEL_CONFIG_SE(NRF_SAADC_INPUT_AIN0); cc.gain = NRF_SAADC_GAIN1_5; cc.reference = NRF_SAADC_REFERENCE_INTERNAL; adc = (struct adc_dev *) os_dev_open("adc0", 0, &adc_config); This patch removes MYNEWT_VALs ADC_0_RESOLUTION, ADC_0_OVERSAMPLE, ADC_0_INTERRUPT_PRIORITY in favour of using nrfx specific defines.
- Loading branch information
1 parent
80c5e7f
commit d1e6307
Showing
20 changed files
with
138 additions
and
194 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.