tests: adc: update to unified kernel

Use k_sleep instead of nano timer.

Change-Id: Iba88b93c71dedd60bdbb842fd8e44a55593f54bf
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
This commit is contained in:
Baohong Liu 2016-11-10 11:57:13 -08:00 committed by Anas Nashif
commit 5e2f899bad

View file

@ -23,8 +23,8 @@
#include <adc.h> #include <adc.h>
#include <misc/printk.h> #include <misc/printk.h>
#define SLEEPTIME 2 /* in millisecond */
#define SLEEPTICKS (SLEEPTIME * sys_clock_ticks_per_sec) #define SLEEPTIME 2000
#define ADC_DEVICE_NAME "ADC_0" #define ADC_DEVICE_NAME "ADC_0"
@ -66,8 +66,6 @@ static void _print_sample_in_hex(uint8_t *buf, uint32_t length)
void main(void) void main(void)
{ {
struct device *adc; struct device *adc;
struct nano_timer timer;
uint32_t data[2] = {0, 0};
printk("ADC sample started on %s\n", ADC_DEVICE_NAME); printk("ADC sample started on %s\n", ADC_DEVICE_NAME);
@ -77,7 +75,6 @@ void main(void)
return; return;
} }
nano_timer_init(&timer, data);
adc_enable(adc); adc_enable(adc);
while (1) { while (1) {
if (adc_read(adc, &table) != 0) { if (adc_read(adc, &table) != 0) {
@ -86,8 +83,7 @@ void main(void)
printk("Sampling is done\n"); printk("Sampling is done\n");
_print_sample_in_hex(seq_buffer, BUFFER_SIZE); _print_sample_in_hex(seq_buffer, BUFFER_SIZE);
} }
nano_timer_start(&timer, SLEEPTICKS); k_sleep(SLEEPTIME);
nano_timer_test(&timer, TICKS_UNLIMITED);
} }
adc_disable(adc); adc_disable(adc);
} }