cc2530-contiki读取DHT11并发送数据例程


使用IAR环境打开,工程路径: work1-读取温湿度并发送数据projectiarsimplecontiki_cc2530.eww
资源截图
代码片段和文件信息
/*
 * Copyright (c) 2008 Swedish Institute of Computer Science.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms with or without
 * modification are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. Neither the name of the Institute nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ‘‘AS IS‘‘ AND
 * ANY EXPRESS OR IMPLIED WARRANTIES INCLUDING BUT NOT LIMITED TO THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT INDIRECT INCIDENTAL SPECIAL EXEMPLARY OR CONSEQUENTIAL
 * DAMAGES (INCLUDING BUT NOT LIMITED TO PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE DATA OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY WHETHER IN CONTRACT STRICT
 * LIABILITY OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 * This file is part of the Contiki operating system.
 *
 */

/**
 * file
 *         AES encryption functions.
 * author
 *         Adam Dunkels 
 */

#include “contiki.h“
#include “dev/cc2420.h“
#include “dev/cc2420-aes.h“
#include “dev/spi.h“

#define KEYLEN 16
#define MAX_DATALEN 16

#define CC2420_WRITE_RAM_REV(bufferadrcount)               
  do {                                                       
    uint8_t i;                                               
    CC2420_SPI_ENABLE();                                     
    SPI_WRITE_FAST(0x80 | (adr & 0x7f));                     
    SPI_WRITE_FAST((adr >> 1) & 0xc0);                       
    for(i = (count); i > 0; i--) {                           
      SPI_WRITE_FAST(((uint8_t*)(buffer))[i - 1]);           
    }                                                        
    SPI_WAITFORTx_ENDED();                                   
    CC2420_SPI_DISABLE();                                    
  } while(0)

#define MIN(ab) ((a) < (b)? (a): (b))

/*---------------------------------------------------------------------------*/
void
cc2420_aes_set_key(const uint8_t *key int index)
{
  switch(index) {
  case 0:
    CC2420_WRITE_RAM_REV(key CC2420RAM_KEY0 KEYLEN);
    break;
  case 1:
    CC2420_WRITE_RAM_REV(key CC2420RAM_KEY1 KEYLEN);
    break;
  }
}
/*--------------------------------------------------

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        174  2016-02-02 13:33  work1-读取温湿度并发送数据.hg_archival.txt

     文件       9896  2016-02-02 13:33  work1-读取温湿度并发送数据corecontiki-default-conf.h

     文件       1907  2016-02-02 13:33  work1-读取温湿度并发送数据corecontiki-lib.h

     文件       2196  2016-02-02 13:33  work1-读取温湿度并发送数据corecontiki-net.h

     文件       1890  2016-02-02 13:33  work1-读取温湿度并发送数据corecontiki-version.h

     文件       2121  2016-02-02 13:33  work1-读取温湿度并发送数据corecontiki.h

     文件       2022  2016-02-02 13:33  work1-读取温湿度并发送数据coredevattery-sensor.h

     文件       1843  2016-02-02 13:33  work1-读取温湿度并发送数据coredevutton-sensor.h.old

     文件       4093  2016-02-02 13:33  work1-读取温湿度并发送数据coredevcc2420-aes.c

     文件       3016  2016-02-02 13:33  work1-读取温湿度并发送数据coredevcc2420-aes.h

     文件      22594  2016-02-02 13:33  work1-读取温湿度并发送数据coredevcc2420.c

     文件       8912  2016-02-02 13:33  work1-读取温湿度并发送数据coredevcc2420.h

     文件       4427  2016-02-02 13:33  work1-读取温湿度并发送数据coredevcc2420_const.h

     文件      22246  2016-02-02 13:33  work1-读取温湿度并发送数据coredevcc2520.c

     文件       9302  2016-02-02 13:33  work1-读取温湿度并发送数据coredevcc2520.h

     文件       8740  2016-02-02 13:33  work1-读取温湿度并发送数据coredevcc2520_const.h

     文件       6375  2016-02-02 13:33  work1-读取温湿度并发送数据coredevds2411.c

     文件       1780  2016-02-02 13:33  work1-读取温湿度并发送数据coredevds2411.h

     文件       3254  2016-02-02 13:33  work1-读取温湿度并发送数据coredeveeprom.h

     文件       3863  2016-02-02 13:33  work1-读取温湿度并发送数据coredevleds.c

     文件       2864  2016-02-02 13:33  work1-读取温湿度并发送数据coredevleds.h

     文件       1794  2016-02-02 13:33  work1-读取温湿度并发送数据coredev
ullradio.c

     文件        142  2016-02-02 13:33  work1-读取温湿度并发送数据coredev
ullradio.h

     文件       1950  2016-02-02 13:33  work1-读取温湿度并发送数据coredev
adio-sensor.h

     文件       3132  2016-02-02 13:33  work1-读取温湿度并发送数据coredev
adio.h

     文件       1815  2016-02-02 13:33  work1-读取温湿度并发送数据coredev
om.h

     文件       4391  2016-02-02 13:33  work1-读取温湿度并发送数据coredevserial-line.c

     文件       2813  2016-02-02 13:33  work1-读取温湿度并发送数据coredevserial-line.h

     文件       3157  2016-02-02 13:33  work1-读取温湿度并发送数据coredevsht11-sensor.c

     文件       2108  2016-02-02 13:33  work1-读取温湿度并发送数据coredevsht11-sensor.h

............此处省略958个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)