Move MAX, MIN and ABS to sys/cc.h
This commit is contained in:
parent
c9324d133f
commit
0dab6926b3
|
@ -36,6 +36,7 @@
|
||||||
* Matthias Kovatsch <kovatsch@inf.ethz.ch>
|
* Matthias Kovatsch <kovatsch@inf.ethz.ch>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "sys/cc.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
* Matthias Kovatsch <kovatsch@inf.ethz.ch>
|
* Matthias Kovatsch <kovatsch@inf.ethz.ch>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "sys/cc.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "er-coap-separate.h"
|
#include "er-coap-separate.h"
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "contiki.h"
|
#include "contiki.h"
|
||||||
|
#include "sys/cc.h"
|
||||||
#include "contiki-net.h"
|
#include "contiki-net.h"
|
||||||
|
|
||||||
#include "er-coap.h"
|
#include "er-coap.h"
|
||||||
|
|
|
@ -79,10 +79,6 @@ enum { OPTION_MAP_SIZE = sizeof(uint8_t) * 8 };
|
||||||
#define SET_OPTION(packet, opt) ((packet)->options[opt / OPTION_MAP_SIZE] |= 1 << (opt % OPTION_MAP_SIZE))
|
#define SET_OPTION(packet, opt) ((packet)->options[opt / OPTION_MAP_SIZE] |= 1 << (opt % OPTION_MAP_SIZE))
|
||||||
#define IS_OPTION(packet, opt) ((packet)->options[opt / OPTION_MAP_SIZE] & (1 << (opt % OPTION_MAP_SIZE)))
|
#define IS_OPTION(packet, opt) ((packet)->options[opt / OPTION_MAP_SIZE] & (1 << (opt % OPTION_MAP_SIZE)))
|
||||||
|
|
||||||
#ifndef MIN
|
|
||||||
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
|
||||||
#endif /* MIN */
|
|
||||||
|
|
||||||
/* parsed message struct */
|
/* parsed message struct */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t *buffer; /* pointer to CoAP header / incoming packet buffer / memory to serialize packet */
|
uint8_t *buffer; /* pointer to CoAP header / incoming packet buffer / memory to serialize packet */
|
||||||
|
|
|
@ -57,13 +57,12 @@
|
||||||
|
|
||||||
#include "lib/assert.h"
|
#include "lib/assert.h"
|
||||||
#include "lib/list.h"
|
#include "lib/list.h"
|
||||||
|
#include "sys/cc.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
#define DEBUG 0
|
#define DEBUG 0
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
#define PRINTF(...) PRINTF(__VA_ARGS__)
|
#define PRINTF(...) PRINTF(__VA_ARGS__)
|
||||||
|
|
|
@ -62,10 +62,6 @@
|
||||||
#define REST_MAX_CHUNK_SIZE 64
|
#define REST_MAX_CHUNK_SIZE 64
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MIN
|
|
||||||
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
|
||||||
#endif /* MIN */
|
|
||||||
|
|
||||||
struct resource_s;
|
struct resource_s;
|
||||||
struct periodic_resource_s;
|
struct periodic_resource_s;
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
#include "sys/energest.h"
|
#include "sys/energest.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include "sys/cc.h"
|
||||||
|
|
||||||
struct power_msg {
|
struct power_msg {
|
||||||
uint16_t len;
|
uint16_t len;
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "contiki.h"
|
#include "contiki.h"
|
||||||
|
#include "sys/cc.h"
|
||||||
#include "shell-sky.h"
|
#include "shell-sky.h"
|
||||||
|
|
||||||
#include "dev/watchdog.h"
|
#include "dev/watchdog.h"
|
||||||
|
@ -84,8 +85,6 @@ SHELL_COMMAND(rfchannel_command,
|
||||||
"rfchannel <channel>: change CC2420 radio channel (11 - 26)",
|
"rfchannel <channel>: change CC2420 radio channel (11 - 26)",
|
||||||
&shell_rfchannel_process);
|
&shell_rfchannel_process);
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#define MAX(a, b) ((a) > (b)? (a): (b))
|
|
||||||
#define MIN(a, b) ((a) < (b)? (a): (b))
|
|
||||||
struct spectrum {
|
struct spectrum {
|
||||||
int channel[16];
|
int channel[16];
|
||||||
};
|
};
|
||||||
|
|
|
@ -36,13 +36,10 @@
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
#include "contiki.h"
|
#include "contiki.h"
|
||||||
|
#include "sys/cc.h"
|
||||||
#include "shell.h"
|
#include "shell.h"
|
||||||
#include "telnet.h"
|
#include "telnet.h"
|
||||||
|
|
||||||
#ifndef MIN
|
|
||||||
#define MIN(a, b) ((a) < (b)? (a) : (b))
|
|
||||||
#endif /* MIN */
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
PROCESS(shell_tcpsend_process, "tcpsend");
|
PROCESS(shell_tcpsend_process, "tcpsend");
|
||||||
SHELL_COMMAND(tcpsend_command,
|
SHELL_COMMAND(tcpsend_command,
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "contiki.h"
|
#include "contiki.h"
|
||||||
|
#include "sys/cc.h"
|
||||||
#include "shell-time.h"
|
#include "shell-time.h"
|
||||||
|
|
||||||
#include "sys/clock.h"
|
#include "sys/clock.h"
|
||||||
|
@ -51,11 +52,6 @@
|
||||||
#define MAX_COMMANDLENGTH 64
|
#define MAX_COMMANDLENGTH 64
|
||||||
#define PERIOD_INTERVAL 60
|
#define PERIOD_INTERVAL 60
|
||||||
|
|
||||||
#ifndef MIN
|
|
||||||
#define MIN(a, b) ((a) < (b)? (a) : (b))
|
|
||||||
#endif /* MIN */
|
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
PROCESS(shell_time_process, "time");
|
PROCESS(shell_time_process, "time");
|
||||||
SHELL_COMMAND(time_command,
|
SHELL_COMMAND(time_command,
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "sys/cc.h"
|
||||||
#include "contiki-lib.h"
|
#include "contiki-lib.h"
|
||||||
#include "contiki-net.h"
|
#include "contiki-net.h"
|
||||||
#include "lib/petsciiconv.h"
|
#include "lib/petsciiconv.h"
|
||||||
|
@ -103,7 +104,6 @@ static uint8_t connected;
|
||||||
|
|
||||||
#define MAX_SILENCE_TIME (CLOCK_SECOND * 30)
|
#define MAX_SILENCE_TIME (CLOCK_SECOND * 30)
|
||||||
|
|
||||||
#define MIN(a, b) ((a) < (b)? (a): (b))
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void
|
static void
|
||||||
buf_init(struct telnetd_buf *buf)
|
buf_init(struct telnetd_buf *buf)
|
||||||
|
|
|
@ -65,10 +65,6 @@
|
||||||
#define SETTINGS_BOTTOM_ADDR (SETTINGS_TOP_ADDR + 1 - SETTINGS_MAX_SIZE)
|
#define SETTINGS_BOTTOM_ADDR (SETTINGS_TOP_ADDR + 1 - SETTINGS_MAX_SIZE)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MIN
|
|
||||||
#define MIN(a,b) ((a)<(b)?a:b)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
#if SETTINGS_CONF_SUPPORT_LARGE_VALUES
|
#if SETTINGS_CONF_SUPPORT_LARGE_VALUES
|
||||||
uint8_t size_extra;
|
uint8_t size_extra;
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "contiki.h"
|
#include "contiki.h"
|
||||||
|
#include "sys/cc.h"
|
||||||
#include "contiki-net.h"
|
#include "contiki-net.h"
|
||||||
|
|
||||||
#include "lib/list.h"
|
#include "lib/list.h"
|
||||||
|
@ -39,7 +40,6 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
|
||||||
|
|
||||||
static void relisten(struct tcp_socket *s);
|
static void relisten(struct tcp_socket *s);
|
||||||
|
|
||||||
|
|
|
@ -78,6 +78,8 @@
|
||||||
#include "net/ipv4/uip-neighbor.h"
|
#include "net/ipv4/uip-neighbor.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include "sys/cc.h"
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Variable definitions. */
|
/* Variable definitions. */
|
||||||
|
|
||||||
|
@ -1953,7 +1955,6 @@ void
|
||||||
uip_send(const void *data, int len)
|
uip_send(const void *data, int len)
|
||||||
{
|
{
|
||||||
int copylen;
|
int copylen;
|
||||||
#define MIN(a,b) ((a) < (b)? (a): (b))
|
|
||||||
copylen = MIN(len, UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN -
|
copylen = MIN(len, UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN -
|
||||||
(int)((char *)uip_sappdata - (char *)&uip_buf[UIP_LLH_LEN + UIP_TCPIP_HLEN]));
|
(int)((char *)uip_sappdata - (char *)&uip_buf[UIP_LLH_LEN + UIP_TCPIP_HLEN]));
|
||||||
if(copylen > 0) {
|
if(copylen > 0) {
|
||||||
|
|
|
@ -71,6 +71,7 @@
|
||||||
* the packet back to the peer.
|
* the packet back to the peer.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "sys/cc.h"
|
||||||
#include "net/ip/uip.h"
|
#include "net/ip/uip.h"
|
||||||
#include "net/ip/uipopt.h"
|
#include "net/ip/uipopt.h"
|
||||||
#include "net/ipv6/uip-icmp6.h"
|
#include "net/ipv6/uip-icmp6.h"
|
||||||
|
@ -2332,7 +2333,6 @@ void
|
||||||
uip_send(const void *data, int len)
|
uip_send(const void *data, int len)
|
||||||
{
|
{
|
||||||
int copylen;
|
int copylen;
|
||||||
#define MIN(a,b) ((a) < (b)? (a): (b))
|
|
||||||
|
|
||||||
if(uip_sappdata != NULL) {
|
if(uip_sappdata != NULL) {
|
||||||
copylen = MIN(len, UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN -
|
copylen = MIN(len, UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN -
|
||||||
|
|
|
@ -229,10 +229,6 @@ static struct compower_activity current_packet;
|
||||||
|
|
||||||
#define DEFAULT_STREAM_TIME (4 * CYCLE_TIME)
|
#define DEFAULT_STREAM_TIME (4 * CYCLE_TIME)
|
||||||
|
|
||||||
#ifndef MIN
|
|
||||||
#define MIN(a, b) ((a) < (b)? (a) : (b))
|
|
||||||
#endif /* MIN */
|
|
||||||
|
|
||||||
#if CONTIKIMAC_CONF_BROADCAST_RATE_LIMIT
|
#if CONTIKIMAC_CONF_BROADCAST_RATE_LIMIT
|
||||||
static struct timer broadcast_rate_timer;
|
static struct timer broadcast_rate_timer;
|
||||||
static int broadcast_rate_counter;
|
static int broadcast_rate_counter;
|
||||||
|
|
|
@ -52,6 +52,7 @@
|
||||||
#include "sys/rtimer.h"
|
#include "sys/rtimer.h"
|
||||||
|
|
||||||
#include "contiki-conf.h"
|
#include "contiki-conf.h"
|
||||||
|
#include "sys/cc.h"
|
||||||
|
|
||||||
#ifdef EXPERIMENT_SETUP
|
#ifdef EXPERIMENT_SETUP
|
||||||
#include "experiment-setup.h"
|
#include "experiment-setup.h"
|
||||||
|
@ -215,10 +216,6 @@ static linkaddr_t is_streaming_to, is_streaming_to_too;
|
||||||
static rtimer_clock_t stream_until;
|
static rtimer_clock_t stream_until;
|
||||||
#define DEFAULT_STREAM_TIME (RTIMER_ARCH_SECOND)
|
#define DEFAULT_STREAM_TIME (RTIMER_ARCH_SECOND)
|
||||||
|
|
||||||
#ifndef MIN
|
|
||||||
#define MIN(a, b) ((a) < (b)? (a) : (b))
|
|
||||||
#endif /* MIN */
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void
|
static void
|
||||||
on(void)
|
on(void)
|
||||||
|
|
|
@ -92,8 +92,6 @@ static struct broadcast_announcement_state {
|
||||||
#define PRINTF(...)
|
#define PRINTF(...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MIN(a, b) ((a)<(b)?(a):(b))
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void
|
static void
|
||||||
send_adv(void *ptr)
|
send_adv(void *ptr)
|
||||||
|
|
|
@ -42,20 +42,13 @@
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "sys/cc.h"
|
||||||
#include "net/rime/rime.h"
|
#include "net/rime/rime.h"
|
||||||
#include "net/rime/ipolite.h"
|
#include "net/rime/ipolite.h"
|
||||||
#include "lib/random.h"
|
#include "lib/random.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifndef MAX
|
|
||||||
#define MAX(a, b) ((a) > (b)? (a) : (b))
|
|
||||||
#endif /* MAX */
|
|
||||||
|
|
||||||
#ifndef MIN
|
|
||||||
#define MIN(a, b) ((a) < (b)? (a) : (b))
|
|
||||||
#endif /* MIN */
|
|
||||||
|
|
||||||
#define DEBUG 0
|
#define DEBUG 0
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "contiki.h"
|
#include "contiki.h"
|
||||||
|
#include "sys/cc.h"
|
||||||
#include "lib/list.h"
|
#include "lib/list.h"
|
||||||
#include "net/rime/rime.h"
|
#include "net/rime/rime.h"
|
||||||
#include "net/rime/announcement.h"
|
#include "net/rime/announcement.h"
|
||||||
|
@ -90,8 +90,6 @@ static struct polite_announcement_state {
|
||||||
#define PRINTF(...)
|
#define PRINTF(...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MIN(a, b) ((a)<(b)?(a):(b))
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void
|
static void
|
||||||
send_adv(clock_time_t interval)
|
send_adv(clock_time_t interval)
|
||||||
|
|
|
@ -42,21 +42,13 @@
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "sys/cc.h"
|
||||||
#include "net/rime/rime.h"
|
#include "net/rime/rime.h"
|
||||||
#include "net/rime/polite.h"
|
#include "net/rime/polite.h"
|
||||||
#include "lib/random.h"
|
#include "lib/random.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifndef MAX
|
|
||||||
#define MAX(a,b) ((a) > (b)? (a) : (b))
|
|
||||||
#endif /* MAX */
|
|
||||||
|
|
||||||
#ifndef MIN
|
|
||||||
#define MIN(a, b) ((a) < (b)? (a) : (b))
|
|
||||||
#endif /* MIN */
|
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void
|
static void
|
||||||
recv(struct abc_conn *abc)
|
recv(struct abc_conn *abc)
|
||||||
|
|
|
@ -127,6 +127,19 @@
|
||||||
#define NULL 0
|
#define NULL 0
|
||||||
#endif /* NULL */
|
#endif /* NULL */
|
||||||
|
|
||||||
|
#ifndef MAX
|
||||||
|
#define MAX(n, m) (((n) < (m)) ? (m) : (n))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef MIN
|
||||||
|
#define MIN(n, m) (((n) < (m)) ? (n) : (m))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ABS
|
||||||
|
#define ABS(n) (((n) < 0) ? -(n) : (n))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define CC_CONCAT2(s1, s2) s1##s2
|
#define CC_CONCAT2(s1, s2) s1##s2
|
||||||
/**
|
/**
|
||||||
* A C preprocessing macro for concatenating to
|
* A C preprocessing macro for concatenating to
|
||||||
|
|
|
@ -280,9 +280,6 @@ typedef char r_uart_ptchar;
|
||||||
#define OUT_X(addrx,value) (*addrx = value)
|
#define OUT_X(addrx,value) (*addrx = value)
|
||||||
#define IN_X(addrx) (*addrx)
|
#define IN_X(addrx) (*addrx)
|
||||||
|
|
||||||
# define Max(a, b) ( (a)>(b) ? (a) : (b) ) // Take the max between a and b
|
|
||||||
# define Min(a, b) ( (a)<(b) ? (a) : (b) ) // Take the min between a and b
|
|
||||||
|
|
||||||
// Align on the upper value <val> on a <n> boundary
|
// Align on the upper value <val> on a <n> boundary
|
||||||
// i.e. Upper(0, 4)= 4
|
// i.e. Upper(0, 4)= 4
|
||||||
// Upper(1, 4)= 4
|
// Upper(1, 4)= 4
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
#include "sys/energest.h"
|
#include "sys/energest.h"
|
||||||
#include "sys/clock.h"
|
#include "sys/clock.h"
|
||||||
#include "sys/rtimer.h"
|
#include "sys/rtimer.h"
|
||||||
|
#include "sys/cc.h"
|
||||||
#include "lpm.h"
|
#include "lpm.h"
|
||||||
#include "ti-lib.h"
|
#include "ti-lib.h"
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
@ -76,10 +77,6 @@
|
||||||
while(!(cond) && RTIMER_CLOCK_LT(RTIMER_NOW(), t0 + (max_time))); \
|
while(!(cond) && RTIMER_CLOCK_LT(RTIMER_NOW(), t0 + (max_time))); \
|
||||||
} while(0)
|
} while(0)
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#ifndef MIN
|
|
||||||
#define MIN(n, m) (((n) < (m)) ? (n) : (m))
|
|
||||||
#endif
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
#define CC_ALIGN_ATTR(n) __attribute__ ((aligned(n)))
|
#define CC_ALIGN_ATTR(n) __attribute__ ((aligned(n)))
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
#include "sfrs-ext.h"
|
#include "sfrs-ext.h"
|
||||||
|
|
||||||
#include "contiki.h" /* for clock_wait() and CLOCK_SECOND. */
|
#include "contiki.h" /* for clock_wait() and CLOCK_SECOND. */
|
||||||
|
#include "sys/cc.h"
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/*************************** Macros Definitions *******************************/
|
/*************************** Macros Definitions *******************************/
|
||||||
|
@ -91,9 +92,6 @@
|
||||||
while(condition) { body; break_loop(); } \
|
while(condition) { body; break_loop(); } \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
#undef MIN
|
|
||||||
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/************************ Variables Definitions *******************************/
|
/************************ Variables Definitions *******************************/
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
|
@ -65,6 +65,7 @@
|
||||||
#include "lpm.h"
|
#include "lpm.h"
|
||||||
#include "net-uart.h"
|
#include "net-uart.h"
|
||||||
#include "httpd-simple.h"
|
#include "httpd-simple.h"
|
||||||
|
#include "sys/cc.h"
|
||||||
|
|
||||||
#include "ti-lib.h"
|
#include "ti-lib.h"
|
||||||
|
|
||||||
|
@ -86,10 +87,6 @@
|
||||||
#define ADDRESS_CONVERSION_OK 1
|
#define ADDRESS_CONVERSION_OK 1
|
||||||
#define ADDRESS_CONVERSION_ERROR 0
|
#define ADDRESS_CONVERSION_ERROR 0
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#ifndef MIN
|
|
||||||
#define MIN(n, m) (((n) < (m)) ? (n) : (m))
|
|
||||||
#endif
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
static struct uip_udp_conn *udp_conn = NULL;
|
static struct uip_udp_conn *udp_conn = NULL;
|
||||||
|
|
||||||
static uint8_t buffer[MAX_MSG_SIZE];
|
static uint8_t buffer[MAX_MSG_SIZE];
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include "sys/cc.h"
|
||||||
#include "rest-engine.h"
|
#include "rest-engine.h"
|
||||||
#include "er-coap.h"
|
#include "er-coap.h"
|
||||||
#include "er-plugtest.h"
|
#include "er-plugtest.h"
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "contiki.h"
|
#include "contiki.h"
|
||||||
|
#include "sys/cc.h"
|
||||||
#include "net/netstack.h"
|
#include "net/netstack.h"
|
||||||
#include "net/rime/rime.h"
|
#include "net/rime/rime.h"
|
||||||
#include "net/rime/collect.h"
|
#include "net/rime/collect.h"
|
||||||
|
@ -120,8 +121,6 @@ PROCESS_THREAD(depth_blink_process, ev, data)
|
||||||
PROCESS_END();
|
PROCESS_END();
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#define MAX(a, b) ((a) > (b)? (a): (b))
|
|
||||||
#define MIN(a, b) ((a) < (b)? (a): (b))
|
|
||||||
struct spectrum {
|
struct spectrum {
|
||||||
int channel[16];
|
int channel[16];
|
||||||
};
|
};
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "contiki-net.h"
|
#include "contiki-net.h"
|
||||||
|
#include "sys/cc.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -104,7 +105,6 @@ PROCESS_THREAD(tcp_server_process, ev, data)
|
||||||
while(bytes_to_send > 0) {
|
while(bytes_to_send > 0) {
|
||||||
PROCESS_PAUSE();
|
PROCESS_PAUSE();
|
||||||
int len, tosend;
|
int len, tosend;
|
||||||
#define MIN(a,b) ((a)<(b)?(a):(b))
|
|
||||||
tosend = MIN(bytes_to_send, sizeof(outputbuf));
|
tosend = MIN(bytes_to_send, sizeof(outputbuf));
|
||||||
len = tcp_socket_send(&socket, (uint8_t *)"", tosend);
|
len = tcp_socket_send(&socket, (uint8_t *)"", tosend);
|
||||||
bytes_to_send -= len;
|
bytes_to_send -= len;
|
||||||
|
|
|
@ -411,7 +411,7 @@ lcd_num_putdec(int numb, lcd_padding_t padding)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert to BCD */
|
/* Convert to BCD */
|
||||||
bcd = itobcd(abs(numb));
|
bcd = itobcd(ABS(numb));
|
||||||
|
|
||||||
/* Print */
|
/* Print */
|
||||||
return lcd_num_print(bcd, (bool)(numb<0), padding);
|
return lcd_num_print(bcd, (bool)(numb<0), padding);
|
||||||
|
|
|
@ -48,6 +48,7 @@
|
||||||
|
|
||||||
|
|
||||||
#include "contiki.h"
|
#include "contiki.h"
|
||||||
|
#include "sys/cc.h"
|
||||||
#include "usb_drv.h"
|
#include "usb_drv.h"
|
||||||
#include "usb_descriptors.h"
|
#include "usb_descriptors.h"
|
||||||
#include "usb_specific_request.h"
|
#include "usb_specific_request.h"
|
||||||
|
@ -753,7 +754,7 @@ uint16_t p=(uint16_t)&__bss_end;
|
||||||
radio_get_rssi_value(&RSSI);
|
radio_get_rssi_value(&RSSI);
|
||||||
RSSI*=3;
|
RSSI*=3;
|
||||||
#endif
|
#endif
|
||||||
maxRSSI[i-11]=Max(maxRSSI[i-11],RSSI);
|
maxRSSI[i-11]=MAX(maxRSSI[i-11],RSSI);
|
||||||
accRSSI[i-11]+=RSSI;
|
accRSSI[i-11]+=RSSI;
|
||||||
}
|
}
|
||||||
if(j&(1<<7)) {
|
if(j&(1<<7)) {
|
||||||
|
@ -774,7 +775,7 @@ uint16_t p=(uint16_t)&__bss_end;
|
||||||
#endif
|
#endif
|
||||||
PRINTF_P(PSTR("\n"));
|
PRINTF_P(PSTR("\n"));
|
||||||
for(i=11;i<=26;i++) {
|
for(i=11;i<=26;i++) {
|
||||||
uint8_t activity=Min(maxRSSI[i-11],accRSSI[i-11]/(1<<7));
|
uint8_t activity=MIN(maxRSSI[i-11],accRSSI[i-11]/(1<<7));
|
||||||
PRINTF_P(PSTR(" %d: %02ddB "),i, -91+(maxRSSI[i-11]-1));
|
PRINTF_P(PSTR(" %d: %02ddB "),i, -91+(maxRSSI[i-11]-1));
|
||||||
for(;activity--;maxRSSI[i-11]--) {
|
for(;activity--;maxRSSI[i-11]--) {
|
||||||
PRINTF_P(PSTR("#"));
|
PRINTF_P(PSTR("#"));
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "contiki.h"
|
#include "contiki.h"
|
||||||
|
#include "sys/cc.h"
|
||||||
|
|
||||||
#include "sys/clock.h"
|
#include "sys/clock.h"
|
||||||
#include "sys/etimer.h"
|
#include "sys/etimer.h"
|
||||||
|
@ -136,8 +137,6 @@ long referenceVar;
|
||||||
static struct cooja_mt_thread rtimer_thread;
|
static struct cooja_mt_thread rtimer_thread;
|
||||||
static struct cooja_mt_thread process_run_thread;
|
static struct cooja_mt_thread process_run_thread;
|
||||||
|
|
||||||
#define MIN(a, b) ( (a)<(b) ? (a) : (b) )
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#if NETSTACK_CONF_WITH_IPV4
|
#if NETSTACK_CONF_WITH_IPV4
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -37,18 +37,6 @@
|
||||||
#ifndef HAL_LCD_H
|
#ifndef HAL_LCD_H
|
||||||
#define HAL_LCD_H
|
#define HAL_LCD_H
|
||||||
|
|
||||||
#ifndef MIN
|
|
||||||
# define MIN(n, m) (((n) < (m)) ? (n) : (m))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef MAX
|
|
||||||
# define MAX(n, m) (((n) < (m)) ? (m) : (n))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ABS
|
|
||||||
# define ABS(n) (((n) < 0) ? -(n) : (n))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define LCD_BACKLT_OUT P8OUT
|
#define LCD_BACKLT_OUT P8OUT
|
||||||
#define LCD_BACKLT_DIR P8DIR
|
#define LCD_BACKLT_DIR P8DIR
|
||||||
#define LCD_BACKLT_SEL P8SEL
|
#define LCD_BACKLT_SEL P8SEL
|
||||||
|
|
Loading…
Reference in a new issue