File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/api Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -94,6 +94,22 @@ void analogin_init(analogin_t *obj, PinName pin)
94
94
MBED_ASSERT (channel != 0xFFFFFFFF );
95
95
obj -> UserBuffer .nChannels = channel ;
96
96
97
+ /* Set ACLK to CCLK/16 */
98
+ adi_pwr_SetClockDivider (ADI_CLOCK_ACLK ,16 );
99
+
100
+ /* Set default values for conversion and delay cycles. This sets up a sampling rate of
101
+ 16kHz. The sampling frequency is worked out from the following:
102
+
103
+ if delay time > 0:
104
+ Fs = ACLK / [((14 + sampling time) * oversample factor) + (delay time + 2)]
105
+ if delay time = 0:
106
+ Fs = ACLK / ((14 + sampling time) * oversample factor)
107
+
108
+ The sampling (or acquisition) and delay times are in number of ACLK clock cycles.
109
+ */
110
+ obj -> DelayCycles = 0 ;
111
+ obj -> SampleCycles = 88 ;
112
+
97
113
/* Open the ADC device */
98
114
adi_adc_Open (ADC_DEV_NUM , DeviceMemory , sizeof (DeviceMemory ), & hDevice );
99
115
obj -> hDevice = hDevice ;
You can’t perform that action at this time.
0 commit comments