⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 adc_test.c

📁 MANTIS是由科罗拉多大学开发的传感器网络嵌入式操作系统。 这是mantis的0.9.5版本的源码。
💻 C
字号:
//  This file is part of MANTIS OS, Operating System//  See http://mantis.cs.colorado.edu/////  Copyright (C) 2003,2004,2005 University of Colorado, Boulder////  This program is free software; you can redistribute it and/or//  modify it under the terms of the mos license (see file LICENSE)#include "mos.h"#include "dev.h"#include "adc.h"#include "avr-adc.h"#include "msp-adc.h"#include "mutex.h"#include "printf.h"#define NUM_ADC_CHANS 3void adc_test (void){   uint16_t adc_vals[NUM_ADC_CHANS];   uint8_t i;      while (1) {      printf ("adc readings: \n");      for (i = 0; i < NUM_ADC_CHANS; i++) {	 uint16_t val;	 dev_ioctl (DEV_ADC, ADC_SET_CHANNEL, i);	 dev_read(DEV_ADC, &val, sizeof(val));	 printf ("\t%d", val);      }      uint8_t samp;      uint16_t value;      dev_read(DEV_MICA2_TEMP, &samp, 1);      printf("\ttemp: %C ",samp);      dev_read(DEV_MICA2_LIGHT, &value, 2);      printf("\tlight: %d", value);      printf ("\n");      mos_thread_sleep(1000);      }}void start (void){   mos_thread_new (adc_test, 128, PRIORITY_NORMAL);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -