Fork of my original MQTTGateway

Dependencies:   mbed-http

Committer:
vpcola
Date:
Sat Apr 08 14:43:14 2017 +0000
Revision:
0:a1734fe1ec4b
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
vpcola 0:a1734fe1ec4b 1 /*
vpcola 0:a1734fe1ec4b 2 * Copyright (c) 2012, STMicroelectronics.
vpcola 0:a1734fe1ec4b 3 * All rights reserved.
vpcola 0:a1734fe1ec4b 4 *
vpcola 0:a1734fe1ec4b 5 * Redistribution and use in source and binary forms, with or without
vpcola 0:a1734fe1ec4b 6 * modification, are permitted provided that the following conditions
vpcola 0:a1734fe1ec4b 7 * are met:
vpcola 0:a1734fe1ec4b 8 * 1. Redistributions of source code must retain the above copyright
vpcola 0:a1734fe1ec4b 9 * notice, this list of conditions and the following disclaimer.
vpcola 0:a1734fe1ec4b 10 * 2. Redistributions in binary form must reproduce the above copyright
vpcola 0:a1734fe1ec4b 11 * notice, this list of conditions and the following disclaimer in the
vpcola 0:a1734fe1ec4b 12 * documentation and/or other materials provided with the distribution.
vpcola 0:a1734fe1ec4b 13 * 3. Neither the name of the Institute nor the names of its contributors
vpcola 0:a1734fe1ec4b 14 * may be used to endorse or promote products derived from this software
vpcola 0:a1734fe1ec4b 15 * without specific prior written permission.
vpcola 0:a1734fe1ec4b 16 *
vpcola 0:a1734fe1ec4b 17 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
vpcola 0:a1734fe1ec4b 18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
vpcola 0:a1734fe1ec4b 19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
vpcola 0:a1734fe1ec4b 20 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
vpcola 0:a1734fe1ec4b 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
vpcola 0:a1734fe1ec4b 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
vpcola 0:a1734fe1ec4b 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
vpcola 0:a1734fe1ec4b 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
vpcola 0:a1734fe1ec4b 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
vpcola 0:a1734fe1ec4b 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
vpcola 0:a1734fe1ec4b 27 * SUCH DAMAGE.
vpcola 0:a1734fe1ec4b 28 *
vpcola 0:a1734fe1ec4b 29 * This file is part of the Contiki operating system.
vpcola 0:a1734fe1ec4b 30 *
vpcola 0:a1734fe1ec4b 31 */
vpcola 0:a1734fe1ec4b 32 /*---------------------------------------------------------------------------*/
vpcola 0:a1734fe1ec4b 33 #ifndef __SPIRIT1_CONFIG_H__
vpcola 0:a1734fe1ec4b 34 #define __SPIRIT1_CONFIG_H__
vpcola 0:a1734fe1ec4b 35 /*---------------------------------------------------------------------------*/
vpcola 0:a1734fe1ec4b 36 #include "radio.h"
vpcola 0:a1734fe1ec4b 37 #include "SPIRIT_Config.h"
vpcola 0:a1734fe1ec4b 38 #include "spirit1-const.h"
vpcola 0:a1734fe1ec4b 39 /*---------------------------------------------------------------------------*/
vpcola 0:a1734fe1ec4b 40 #define CCA_THRESHOLD -98.0 /* dBm */
vpcola 0:a1734fe1ec4b 41 #define XTAL_FREQUENCY 50000000 /* Hz */
vpcola 0:a1734fe1ec4b 42 #define SPIRIT_MAX_FIFO_LEN (96) // betzw - WAS: 600
vpcola 0:a1734fe1ec4b 43 /*---------------------------------------------------------------------------*/
vpcola 0:a1734fe1ec4b 44
vpcola 0:a1734fe1ec4b 45 /* Sometimes Spirit1 seems to NOT deliver (correctly) the 'IRQ_RX_DATA_READY'
vpcola 0:a1734fe1ec4b 46 * event for packets which have a length which is close to a multiple of
vpcola 0:a1734fe1ec4b 47 * RX FIFO size. Furthermore, in these cases also the content delivery seems
vpcola 0:a1734fe1ec4b 48 * to be compromised as well as the generation of RX/TX FIFO errors.
vpcola 0:a1734fe1ec4b 49 * This can be avoided by reducing the maximum packet length to a value which
vpcola 0:a1734fe1ec4b 50 * is lower than the RX FIFO size.
vpcola 0:a1734fe1ec4b 51 *
vpcola 0:a1734fe1ec4b 52 * Enable beyond macro if you want to use the version of the driver which avoids
vpcola 0:a1734fe1ec4b 53 * FIFO overflows by reducing packet length.
vpcola 0:a1734fe1ec4b 54 *
vpcola 0:a1734fe1ec4b 55 * NOTE: the non delivery of event 'IRQ_RX_DATA_READY' MUST still be
vpcola 0:a1734fe1ec4b 56 * investigated further deeply (both on HW & SW level)!
vpcola 0:a1734fe1ec4b 57 */
vpcola 0:a1734fe1ec4b 58 #define RX_FIFO_THR_WA
vpcola 0:a1734fe1ec4b 59
vpcola 0:a1734fe1ec4b 60 /**
vpcola 0:a1734fe1ec4b 61 * The MAX_PACKET_LEN is an arbitrary value used to define the two array
vpcola 0:a1734fe1ec4b 62 * spirit_txbuf and spirit_rxbuf.
vpcola 0:a1734fe1ec4b 63 * The SPIRIT1 supports with its packet handler a length of 65,535 bytes,
vpcola 0:a1734fe1ec4b 64 * and in direct mode (without packet handler) there is no limit of data.
vpcola 0:a1734fe1ec4b 65 */
vpcola 0:a1734fe1ec4b 66 #ifdef RX_FIFO_THR_WA
vpcola 0:a1734fe1ec4b 67 #define MAX_PACKET_LEN (SPIRIT_MAX_FIFO_LEN-1)
vpcola 0:a1734fe1ec4b 68 #else
vpcola 0:a1734fe1ec4b 69 #define MAX_PACKET_LEN (255) // betzw - WAS: SPIRIT_MAX_FIFO_LEN, but LEN_WIDTH is set to 7 so the variable payload length is theoretically from 0 to 255 bytes
vpcola 0:a1734fe1ec4b 70 #endif
vpcola 0:a1734fe1ec4b 71
vpcola 0:a1734fe1ec4b 72 /*---------------------------------------------------------------------------*/
vpcola 0:a1734fe1ec4b 73 /**
vpcola 0:a1734fe1ec4b 74 * Spirit1 IC version
vpcola 0:a1734fe1ec4b 75 */
vpcola 0:a1734fe1ec4b 76 #define SPIRIT1_VERSION SPIRIT_VERSION_3_0
vpcola 0:a1734fe1ec4b 77 /*---------------------------------------------------------------------------*/
vpcola 0:a1734fe1ec4b 78 #endif /* __SPIRIT1_CONFIG_H__ */
vpcola 0:a1734fe1ec4b 79 /*---------------------------------------------------------------------------*/