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

📄 sensorboardapp.h

📁 基于NesC/TinyOS的无线传感器网络测量节点源码
💻 H
字号:
/*
 * Copyright (c) 2004-2007 Crossbow Technology, Inc.
 * All rights reserved.
 * See license.txt file included with the distribution.
 *
 * $Id: sensorboardApp.h,v 1.2.4.2 2007/04/26 20:09:35 njain Exp $
 */

/* sensorboard.h - hardware specific definitions for the MDA300
*/
// controls for the voltage reference monitor
#define MAKE_BAT_MONITOR_OUTPUT() sbi(DDRA, 5)
#define MAKE_ADC_INPUT() cbi(DDRF, 7)
#define SET_BAT_MONITOR() sbi(PORTA, 5)
#define CLEAR_BAT_MONITOR() cbi(PORTA, 5)

// crossbow sensor board id
#define  SENSOR_BOARD_ID 0x90       //MDA300 sensor board id

#define NUM_MSG1_BYTES (28)			// bytes 2-29 
#define NUM_MSG2_BYTES (8)			// bytes 2-9 
#define NUM_MSG3_BYTES (13)			// bytes 2-13 

// format is:
//  byte 1 & 2: ADC reading in big-endian format

#define VOLTAGE_STABLE_TIME 100           //Time it takes for the supply voltage to be stable enough
#define DATA_KEEPING_PERIOD 210
#define DAILY_MEASUREMENT 12
#define DATA_RESTORE_BYTES 22

typedef struct CoordinatorHeader{
  uint8_t  node_id;
  uint8_t  commandtype;
}__attribute__ ((packed)) CoordinatorHeader;


typedef struct XSensorHeader{
  uint8_t  node_id;
  uint8_t  day;
  uint8_t  packet_id; // 3
  uint8_t  target;
}__attribute__ ((packed)) XSensorHeader;

typedef struct CommandData {
  uint8_t  Commandfield0;
  uint8_t  Commandfield1;
  uint8_t  Commandfield2;
} __attribute__ ((packed)) CommandData;

//pp:multihop need only the packet6
typedef struct SoilData {
  uint16_t vref;
  uint16_t adc0;  
  uint16_t adc1;
  uint16_t adc2;
  uint16_t adc3;
  uint8_t  WC3;
  uint8_t  WC2;
  uint8_t  WC1;
  uint8_t  WC0;
  uint8_t  EC2;
  uint8_t  EC1;
  uint8_t  EC0;
  uint8_t  Temp2;
  uint8_t  Temp1;
  uint8_t  Temp0;
  
} __attribute__ ((packed)) SoilData;

typedef struct XDataMsg {
  XSensorHeader xSensorHeader;
  union {
  SoilData    soilData;
  }xData;
}  __attribute__ ((packed)) XDataMsg;

typedef struct XDataCommand{
  CoordinatorHeader CoordinatorHeader;
  union {
  CommandData commandData;
  }xData;
} __attribute__ ((packed)) XDataCommand;

enum {
  AM_XSXMSG = 0,  
};

enum {
    Sample_Packet = 6,
};

enum {
    RADIO_TEST,
    UART_TEST
};
enum {
    AM_XDEBUG_MSG    = 49,
    AM_XSENSOR_MSG   = 50,
    AM_XMULTIHOP_MSG = 51,         // xsensor multihop 
};


#ifdef APP_RATE
uint32_t XSENSOR_SAMPLE_RATE = APP_RATE;
#else
#ifdef USE_LOW_POWER
uint32_t XSENSOR_SAMPLE_RATE = 184320;
#else
uint32_t XSENSOR_SAMPLE_RATE = 1843;
#endif
#endif

    uint32_t   timer_rate;  

⌨️ 快捷键说明

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