commit
10bd49a71a
12
.gitattributes
vendored
Normal file
12
.gitattributes
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
# Set the default behavior, in case people don't have core.autocrlf set.
|
||||
* text=auto whitespace=trailing-space
|
||||
|
||||
# Explicitly declare text files you want to always be normalized and converted
|
||||
# to native line endings on checkout.
|
||||
*.c text
|
||||
*.h text
|
||||
*.java text
|
||||
|
||||
# Denote all files that are truly binary and should not be modified.
|
||||
*.png binary
|
||||
*.jpg binary
|
|
@ -1,3 +1,3 @@
|
|||
<html><head><link rel="stylesheet" type="text/css" href="s.css"></head><body><center>
|
||||
%! tictac
|
||||
<html><head><link rel="stylesheet" type="text/css" href="s.css"></head><body><center>
|
||||
%! tictac
|
||||
</center></body></html>
|
|
@ -1,3 +1,3 @@
|
|||
<html><head><link rel="stylesheet" type="text/css" href="s.css"></head><body><center>
|
||||
%! tictac
|
||||
<html><head><link rel="stylesheet" type="text/css" href="s.css"></head><body><center>
|
||||
%! tictac
|
||||
</center></body></html>
|
|
@ -1,72 +1,72 @@
|
|||
/*
|
||||
* Copyright (c) 2011, 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.
|
||||
*
|
||||
* Sets up some commands for the RF230 radio.
|
||||
*/
|
||||
|
||||
#include "contiki.h"
|
||||
#include "cmd.h"
|
||||
|
||||
#include "radio/rf230/radio.h"
|
||||
#include "radio/rf230bb/rf230bb.h"
|
||||
|
||||
|
||||
#define DEBUG 0
|
||||
#if DEBUG
|
||||
#include <stdio.h>
|
||||
#define PRINTF(FORMAT,args...) printf_P(PSTR(FORMAT),##args)
|
||||
#define PRINTSHORT(FORMAT,args...) printf_P(PSTR(FORMAT),##args)
|
||||
#else
|
||||
#define PRINTF(...)
|
||||
#define PRINTSHORT(...)
|
||||
#endif
|
||||
|
||||
int
|
||||
cmd_handler_rf230(const uint8_t *data, int len)
|
||||
{
|
||||
if(data[0] == '!') {
|
||||
if(data[1] == 'C') {
|
||||
PRINTF("CMD: Setting channel: %d\n", data[2]);
|
||||
rf230_set_channel(data[2]);
|
||||
return 1;
|
||||
}
|
||||
} else if(data[0] == '?') {
|
||||
if(data[1] == 'C') {
|
||||
uint8_t buf[4];
|
||||
PRINTF("CMD: Getting channel: %d\n", data[2]);
|
||||
buf[0] = '!';
|
||||
buf[1] = 'C';
|
||||
buf[2] = rf230_get_channel();
|
||||
cmd_send(buf, 3);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
* Copyright (c) 2011, 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.
|
||||
*
|
||||
* Sets up some commands for the RF230 radio.
|
||||
*/
|
||||
|
||||
#include "contiki.h"
|
||||
#include "cmd.h"
|
||||
|
||||
#include "radio/rf230/radio.h"
|
||||
#include "radio/rf230bb/rf230bb.h"
|
||||
|
||||
|
||||
#define DEBUG 0
|
||||
#if DEBUG
|
||||
#include <stdio.h>
|
||||
#define PRINTF(FORMAT,args...) printf_P(PSTR(FORMAT),##args)
|
||||
#define PRINTSHORT(FORMAT,args...) printf_P(PSTR(FORMAT),##args)
|
||||
#else
|
||||
#define PRINTF(...)
|
||||
#define PRINTSHORT(...)
|
||||
#endif
|
||||
|
||||
int
|
||||
cmd_handler_rf230(const uint8_t *data, int len)
|
||||
{
|
||||
if(data[0] == '!') {
|
||||
if(data[1] == 'C') {
|
||||
PRINTF("CMD: Setting channel: %d\n", data[2]);
|
||||
rf230_set_channel(data[2]);
|
||||
return 1;
|
||||
}
|
||||
} else if(data[0] == '?') {
|
||||
if(data[1] == 'C') {
|
||||
uint8_t buf[4];
|
||||
PRINTF("CMD: Getting channel: %d\n", data[2]);
|
||||
buf[0] = '!';
|
||||
buf[1] = 'C';
|
||||
buf[2] = rf230_get_channel();
|
||||
cmd_send(buf, 3);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,161 +1,161 @@
|
|||
/*
|
||||
* Copyright (c) 2007, Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2010, University of Luebeck, Germany.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* ViewRSSI java application
|
||||
* \author
|
||||
* Joakim Eriksson <joakime@sics.se>
|
||||
* Carlo Alberto Boano <cboano@iti.uni-luebeck.de>
|
||||
*/
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.io.*;
|
||||
|
||||
public class ViewRSSI extends JPanel{
|
||||
// Constants
|
||||
public static int TOTAL = 86; // Number of channel of 1 MHz sampled
|
||||
public static int DECREASE_RSSI = 2; // How many dBm the grey RSSI falls each sample
|
||||
public static int RSSI_MAX_VALUE = 100; // Maximum value obtainable from RSSI readings of CC2420.
|
||||
public static int MARGIN_BOTTOM = 20; // Margin from the bottom
|
||||
public static int MARGIN_RIGHT = 75; // Margin from the right
|
||||
public static int MARGIN_TOP = 12; // Margin from the top
|
||||
public static int INTERFERED_CHANNEL = 24; // Interfered channel
|
||||
|
||||
public InputStream inputstr;
|
||||
private int[] rssi = new int[TOTAL]; // Array of current Noise floor values (black line)
|
||||
private int[] rssiMax = new int[TOTAL]; // Array with past Noise floor values (grey line)
|
||||
|
||||
|
||||
public ViewRSSI() {
|
||||
}
|
||||
|
||||
public void paint(Graphics g) {
|
||||
Graphics2D g2 = (Graphics2D) g;
|
||||
int h = getHeight();
|
||||
int w = getWidth();
|
||||
double factor = (h - (MARGIN_BOTTOM*1.0)) / RSSI_MAX_VALUE;
|
||||
double sSpacing = (w - MARGIN_RIGHT) / (TOTAL*1.0);
|
||||
int sWidth = (int) (sSpacing - 1);
|
||||
if (sWidth == 0) sWidth = 1;
|
||||
|
||||
// Set white background in the plot
|
||||
g.setColor(Color.white);
|
||||
g.fillRect(0, 0, w, h);
|
||||
|
||||
// Gradient example (ytics background)
|
||||
GradientPaint greytowhite = new GradientPaint(w-MARGIN_RIGHT,0,Color.WHITE,w, 0,Color.lightGray, false);
|
||||
g2.setPaint(greytowhite);
|
||||
g2.fillRect(w-MARGIN_RIGHT, 0, w, h);
|
||||
|
||||
// Draw the light grey channels from 11 to 26
|
||||
double xpos = 10;
|
||||
for(int i=4;i<TOTAL-4;i++){
|
||||
if (i==4+5*(INTERFERED_CHANNEL-11)) g.setColor(Color.cyan);
|
||||
else g.setColor(Color.lightGray);
|
||||
g.fillRect((int) (xpos+i*sSpacing), 0, (int) (sSpacing*3), h-MARGIN_BOTTOM);
|
||||
i = i + 4;
|
||||
g.setColor(Color.blue);
|
||||
g.drawString(String.valueOf(((i-8)/5)+11), (int) (xpos+(i-4)*sSpacing), MARGIN_TOP);
|
||||
}
|
||||
g.drawString(String.valueOf("Channel"), (int) (w-MARGIN_RIGHT+20), MARGIN_TOP);
|
||||
|
||||
// Write the y-axis with dBm
|
||||
int base_dBm = -100; // The bottom corresponds to -100 dBm
|
||||
int ytics = 10; // How many tics on the y-axis
|
||||
for(int i=-ytics;i<=0;i++){
|
||||
g.setColor(Color.red);
|
||||
g.drawString(String.valueOf(((ytics+i)*(base_dBm/ytics))+"dBm"), (int) (w-MARGIN_RIGHT+20), (int) (h+i*(h/ytics))-MARGIN_BOTTOM);
|
||||
// Dashed line for the ytics
|
||||
final float dash1[] = {10.0f};
|
||||
final BasicStroke dashed = new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, dash1, 0.0f);
|
||||
g2.setStroke(dashed);
|
||||
g2.drawLine(0, (int) (h+i*(h/ytics))-MARGIN_BOTTOM, (int) (w-MARGIN_RIGHT+7), (int) (h+i*(h/ytics))-MARGIN_BOTTOM);
|
||||
}
|
||||
|
||||
// Write the x-axis with MHz
|
||||
g.setColor(Color.blue);
|
||||
int start_x_axis = 4;
|
||||
g.drawString(String.valueOf(2400+"MHz"), (int) xpos, (int) h-start_x_axis);
|
||||
g.drawString(String.valueOf(2442.5+"MHz"), (w-119)/2, (int) h-start_x_axis);
|
||||
g.drawString(String.valueOf(2485+"MHz"), w-119, (int) h-start_x_axis);
|
||||
|
||||
// Draw the old RSSI in each MHz channel (grey)
|
||||
g.setColor(Color.gray);
|
||||
double xposition = xpos;
|
||||
for (int i = 0, n = rssi.length; i < n; i++) {
|
||||
int rssi = (int) (rssiMax[i] * factor);
|
||||
g.fillRect((int) xposition, h - MARGIN_BOTTOM - rssi, sWidth, rssi + 1);
|
||||
xposition += sSpacing;
|
||||
}
|
||||
|
||||
// Draw the current RSSI in each MHz channel (black)
|
||||
g.setColor(Color.black);
|
||||
xposition = xpos;
|
||||
for (int i = 0, n = rssi.length; i < n; i++) {
|
||||
int rssiVal = (int) (rssi[i] * factor);
|
||||
g.fillRect((int) xposition, h - MARGIN_BOTTOM - rssiVal, sWidth, rssiVal + 1);
|
||||
xposition += sSpacing;
|
||||
}
|
||||
}
|
||||
|
||||
public void handleInput() throws IOException {
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
|
||||
while(true) {
|
||||
String line = reader.readLine();
|
||||
if (line.startsWith("RSSI:")) {
|
||||
try {
|
||||
String[] parts = line.substring(5).split(" ");
|
||||
for (int i = 0, n = parts.length; i < n; i++) {
|
||||
rssi[i] = Integer.parseInt(parts[i]); // An RSSI=0 corresponds to -100 dBm, an RSSI=100 corresponds to 0 dBm
|
||||
if (rssi[i] > rssiMax[i]) rssiMax[i] = rssi[i];
|
||||
else if (rssiMax[i] > 0) rssiMax[i] = rssiMax[i] - DECREASE_RSSI;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace(); /* Report error, but do not fail... */
|
||||
}
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
JFrame win = new JFrame("RSSI Viewer");
|
||||
ViewRSSI panel;
|
||||
win.setBounds(10, 10, 590, 590);
|
||||
win.getContentPane().add(panel = new ViewRSSI());
|
||||
win.setVisible(true);
|
||||
win.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
panel.handleInput();
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* Copyright (c) 2007, Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2010, University of Luebeck, Germany.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* ViewRSSI java application
|
||||
* \author
|
||||
* Joakim Eriksson <joakime@sics.se>
|
||||
* Carlo Alberto Boano <cboano@iti.uni-luebeck.de>
|
||||
*/
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.io.*;
|
||||
|
||||
public class ViewRSSI extends JPanel{
|
||||
// Constants
|
||||
public static int TOTAL = 86; // Number of channel of 1 MHz sampled
|
||||
public static int DECREASE_RSSI = 2; // How many dBm the grey RSSI falls each sample
|
||||
public static int RSSI_MAX_VALUE = 100; // Maximum value obtainable from RSSI readings of CC2420.
|
||||
public static int MARGIN_BOTTOM = 20; // Margin from the bottom
|
||||
public static int MARGIN_RIGHT = 75; // Margin from the right
|
||||
public static int MARGIN_TOP = 12; // Margin from the top
|
||||
public static int INTERFERED_CHANNEL = 24; // Interfered channel
|
||||
|
||||
public InputStream inputstr;
|
||||
private int[] rssi = new int[TOTAL]; // Array of current Noise floor values (black line)
|
||||
private int[] rssiMax = new int[TOTAL]; // Array with past Noise floor values (grey line)
|
||||
|
||||
|
||||
public ViewRSSI() {
|
||||
}
|
||||
|
||||
public void paint(Graphics g) {
|
||||
Graphics2D g2 = (Graphics2D) g;
|
||||
int h = getHeight();
|
||||
int w = getWidth();
|
||||
double factor = (h - (MARGIN_BOTTOM*1.0)) / RSSI_MAX_VALUE;
|
||||
double sSpacing = (w - MARGIN_RIGHT) / (TOTAL*1.0);
|
||||
int sWidth = (int) (sSpacing - 1);
|
||||
if (sWidth == 0) sWidth = 1;
|
||||
|
||||
// Set white background in the plot
|
||||
g.setColor(Color.white);
|
||||
g.fillRect(0, 0, w, h);
|
||||
|
||||
// Gradient example (ytics background)
|
||||
GradientPaint greytowhite = new GradientPaint(w-MARGIN_RIGHT,0,Color.WHITE,w, 0,Color.lightGray, false);
|
||||
g2.setPaint(greytowhite);
|
||||
g2.fillRect(w-MARGIN_RIGHT, 0, w, h);
|
||||
|
||||
// Draw the light grey channels from 11 to 26
|
||||
double xpos = 10;
|
||||
for(int i=4;i<TOTAL-4;i++){
|
||||
if (i==4+5*(INTERFERED_CHANNEL-11)) g.setColor(Color.cyan);
|
||||
else g.setColor(Color.lightGray);
|
||||
g.fillRect((int) (xpos+i*sSpacing), 0, (int) (sSpacing*3), h-MARGIN_BOTTOM);
|
||||
i = i + 4;
|
||||
g.setColor(Color.blue);
|
||||
g.drawString(String.valueOf(((i-8)/5)+11), (int) (xpos+(i-4)*sSpacing), MARGIN_TOP);
|
||||
}
|
||||
g.drawString(String.valueOf("Channel"), (int) (w-MARGIN_RIGHT+20), MARGIN_TOP);
|
||||
|
||||
// Write the y-axis with dBm
|
||||
int base_dBm = -100; // The bottom corresponds to -100 dBm
|
||||
int ytics = 10; // How many tics on the y-axis
|
||||
for(int i=-ytics;i<=0;i++){
|
||||
g.setColor(Color.red);
|
||||
g.drawString(String.valueOf(((ytics+i)*(base_dBm/ytics))+"dBm"), (int) (w-MARGIN_RIGHT+20), (int) (h+i*(h/ytics))-MARGIN_BOTTOM);
|
||||
// Dashed line for the ytics
|
||||
final float dash1[] = {10.0f};
|
||||
final BasicStroke dashed = new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, dash1, 0.0f);
|
||||
g2.setStroke(dashed);
|
||||
g2.drawLine(0, (int) (h+i*(h/ytics))-MARGIN_BOTTOM, (int) (w-MARGIN_RIGHT+7), (int) (h+i*(h/ytics))-MARGIN_BOTTOM);
|
||||
}
|
||||
|
||||
// Write the x-axis with MHz
|
||||
g.setColor(Color.blue);
|
||||
int start_x_axis = 4;
|
||||
g.drawString(String.valueOf(2400+"MHz"), (int) xpos, (int) h-start_x_axis);
|
||||
g.drawString(String.valueOf(2442.5+"MHz"), (w-119)/2, (int) h-start_x_axis);
|
||||
g.drawString(String.valueOf(2485+"MHz"), w-119, (int) h-start_x_axis);
|
||||
|
||||
// Draw the old RSSI in each MHz channel (grey)
|
||||
g.setColor(Color.gray);
|
||||
double xposition = xpos;
|
||||
for (int i = 0, n = rssi.length; i < n; i++) {
|
||||
int rssi = (int) (rssiMax[i] * factor);
|
||||
g.fillRect((int) xposition, h - MARGIN_BOTTOM - rssi, sWidth, rssi + 1);
|
||||
xposition += sSpacing;
|
||||
}
|
||||
|
||||
// Draw the current RSSI in each MHz channel (black)
|
||||
g.setColor(Color.black);
|
||||
xposition = xpos;
|
||||
for (int i = 0, n = rssi.length; i < n; i++) {
|
||||
int rssiVal = (int) (rssi[i] * factor);
|
||||
g.fillRect((int) xposition, h - MARGIN_BOTTOM - rssiVal, sWidth, rssiVal + 1);
|
||||
xposition += sSpacing;
|
||||
}
|
||||
}
|
||||
|
||||
public void handleInput() throws IOException {
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
|
||||
while(true) {
|
||||
String line = reader.readLine();
|
||||
if (line.startsWith("RSSI:")) {
|
||||
try {
|
||||
String[] parts = line.substring(5).split(" ");
|
||||
for (int i = 0, n = parts.length; i < n; i++) {
|
||||
rssi[i] = Integer.parseInt(parts[i]); // An RSSI=0 corresponds to -100 dBm, an RSSI=100 corresponds to 0 dBm
|
||||
if (rssi[i] > rssiMax[i]) rssiMax[i] = rssi[i];
|
||||
else if (rssiMax[i] > 0) rssiMax[i] = rssiMax[i] - DECREASE_RSSI;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace(); /* Report error, but do not fail... */
|
||||
}
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
JFrame win = new JFrame("RSSI Viewer");
|
||||
ViewRSSI panel;
|
||||
win.setBounds(10, 10, 590, 590);
|
||||
win.getContentPane().add(panel = new ViewRSSI());
|
||||
win.setVisible(true);
|
||||
win.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
panel.handleInput();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,240 +1,240 @@
|
|||
# Doxyfile 1.4.1
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Project related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
PROJECT_NAME = "Contiki 6LoWPAN Menu"
|
||||
PROJECT_NUMBER =
|
||||
OUTPUT_DIRECTORY = .
|
||||
CREATE_SUBDIRS = NO
|
||||
OUTPUT_LANGUAGE = English
|
||||
USE_WINDOWS_ENCODING = NO
|
||||
BRIEF_MEMBER_DESC = YES
|
||||
REPEAT_BRIEF = YES
|
||||
ABBREVIATE_BRIEF =
|
||||
ALWAYS_DETAILED_SEC = NO
|
||||
INLINE_INHERITED_MEMB = NO
|
||||
FULL_PATH_NAMES = YES
|
||||
STRIP_FROM_PATH = ../
|
||||
STRIP_FROM_INC_PATH =
|
||||
SHORT_NAMES = YES
|
||||
JAVADOC_AUTOBRIEF = YES
|
||||
MULTILINE_CPP_IS_BRIEF = NO
|
||||
DETAILS_AT_TOP = YES
|
||||
INHERIT_DOCS = YES
|
||||
DISTRIBUTE_GROUP_DOC = NO
|
||||
TAB_SIZE = 8
|
||||
ALIASES =
|
||||
OPTIMIZE_OUTPUT_FOR_C = YES
|
||||
OPTIMIZE_OUTPUT_JAVA = NO
|
||||
SUBGROUPING = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Build related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
EXTRACT_ALL = NO
|
||||
EXTRACT_PRIVATE = NO
|
||||
EXTRACT_STATIC = YES
|
||||
EXTRACT_LOCAL_CLASSES = NO
|
||||
EXTRACT_LOCAL_METHODS = NO
|
||||
HIDE_UNDOC_MEMBERS = YES
|
||||
HIDE_UNDOC_CLASSES = YES
|
||||
HIDE_FRIEND_COMPOUNDS = NO
|
||||
HIDE_IN_BODY_DOCS = NO
|
||||
INTERNAL_DOCS = NO
|
||||
CASE_SENSE_NAMES = YES
|
||||
HIDE_SCOPE_NAMES = NO
|
||||
SHOW_INCLUDE_FILES = YES
|
||||
INLINE_INFO = YES
|
||||
SORT_MEMBER_DOCS = YES
|
||||
SORT_BRIEF_DOCS = NO
|
||||
SORT_BY_SCOPE_NAME = NO
|
||||
GENERATE_TODOLIST = YES
|
||||
GENERATE_TESTLIST = YES
|
||||
GENERATE_BUGLIST = NO
|
||||
GENERATE_DEPRECATEDLIST= NO
|
||||
ENABLED_SECTIONS =
|
||||
MAX_INITIALIZER_LINES = 30
|
||||
SHOW_USED_FILES = NO
|
||||
SHOW_DIRECTORIES = YES
|
||||
FILE_VERSION_FILTER =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to warning and progress messages
|
||||
#---------------------------------------------------------------------------
|
||||
QUIET = NO
|
||||
WARNINGS = YES
|
||||
WARN_IF_UNDOCUMENTED = NO
|
||||
WARN_IF_DOC_ERROR = YES
|
||||
WARN_NO_PARAMDOC = NO
|
||||
WARN_FORMAT = "$file:$line: $text"
|
||||
WARN_LOGFILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the input files
|
||||
#---------------------------------------------------------------------------
|
||||
INPUT = ../adc.c \
|
||||
../beep.c \
|
||||
../key.c \
|
||||
../lcd.c \
|
||||
../menu.c \
|
||||
../raven3290.c \
|
||||
../sleep.c \
|
||||
../temp.c \
|
||||
../timer.c \
|
||||
../uart.c \
|
||||
../adc.h \
|
||||
../beep.h \
|
||||
../key.h \
|
||||
../lcd.h \
|
||||
../menu.h \
|
||||
../main.h \
|
||||
../sleep.h \
|
||||
../temp.h \
|
||||
../timer.h \
|
||||
../uart.h
|
||||
|
||||
FILE_PATTERNS =
|
||||
RECURSIVE = NO
|
||||
EXCLUDE =
|
||||
EXCLUDE_SYMLINKS = NO
|
||||
EXCLUDE_PATTERNS =
|
||||
EXAMPLE_PATH =
|
||||
EXAMPLE_PATTERNS =
|
||||
EXAMPLE_RECURSIVE = NO
|
||||
IMAGE_PATH = ./pics
|
||||
INPUT_FILTER =
|
||||
FILTER_PATTERNS =
|
||||
FILTER_SOURCE_FILES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to source browsing
|
||||
#---------------------------------------------------------------------------
|
||||
SOURCE_BROWSER = YES
|
||||
INLINE_SOURCES = NO
|
||||
STRIP_CODE_COMMENTS = NO
|
||||
REFERENCED_BY_RELATION = YES
|
||||
REFERENCES_RELATION = YES
|
||||
VERBATIM_HEADERS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the alphabetical class index
|
||||
#---------------------------------------------------------------------------
|
||||
ALPHABETICAL_INDEX = YES
|
||||
COLS_IN_ALPHA_INDEX = 5
|
||||
IGNORE_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the HTML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_HTML = YES
|
||||
HTML_OUTPUT = html
|
||||
HTML_FILE_EXTENSION = .html
|
||||
HTML_HEADER =
|
||||
HTML_FOOTER =
|
||||
HTML_STYLESHEET =
|
||||
HTML_ALIGN_MEMBERS = YES
|
||||
GENERATE_HTMLHELP = YES
|
||||
CHM_FILE =
|
||||
HHC_LOCATION =
|
||||
GENERATE_CHI = YES
|
||||
BINARY_TOC = YES
|
||||
TOC_EXPAND = YES
|
||||
DISABLE_INDEX = NO
|
||||
ENUM_VALUES_PER_LINE = 4
|
||||
GENERATE_TREEVIEW = YES
|
||||
TREEVIEW_WIDTH = 250
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the LaTeX output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_LATEX = YES
|
||||
LATEX_OUTPUT = latex
|
||||
LATEX_CMD_NAME = latex
|
||||
MAKEINDEX_CMD_NAME = makeindex
|
||||
COMPACT_LATEX = YES
|
||||
PAPER_TYPE = a4wide
|
||||
EXTRA_PACKAGES =
|
||||
LATEX_HEADER =
|
||||
PDF_HYPERLINKS = YES
|
||||
USE_PDFLATEX = YES
|
||||
LATEX_BATCHMODE = NO
|
||||
LATEX_HIDE_INDICES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the RTF output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_RTF = NO
|
||||
RTF_OUTPUT = rtf
|
||||
COMPACT_RTF = NO
|
||||
RTF_HYPERLINKS = NO
|
||||
RTF_STYLESHEET_FILE =
|
||||
RTF_EXTENSIONS_FILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the man page output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_MAN = NO
|
||||
MAN_OUTPUT = man
|
||||
MAN_EXTENSION = .3
|
||||
MAN_LINKS = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the XML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_XML = NO
|
||||
XML_OUTPUT = xml
|
||||
XML_SCHEMA =
|
||||
XML_DTD =
|
||||
XML_PROGRAMLISTING = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options for the AutoGen Definitions output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_AUTOGEN_DEF = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the Perl module output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_PERLMOD = NO
|
||||
PERLMOD_LATEX = NO
|
||||
PERLMOD_PRETTY = YES
|
||||
PERLMOD_MAKEVAR_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the preprocessor
|
||||
#---------------------------------------------------------------------------
|
||||
ENABLE_PREPROCESSING = YES
|
||||
MACRO_EXPANSION = NO
|
||||
EXPAND_ONLY_PREDEF = NO
|
||||
SEARCH_INCLUDES = YES
|
||||
INCLUDE_PATH =
|
||||
INCLUDE_FILE_PATTERNS =
|
||||
PREDEFINED = DOXYGEN
|
||||
EXPAND_AS_DEFINED =
|
||||
SKIP_FUNCTION_MACROS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::additions related to external references
|
||||
#---------------------------------------------------------------------------
|
||||
TAGFILES =
|
||||
GENERATE_TAGFILE =
|
||||
ALLEXTERNALS = NO
|
||||
EXTERNAL_GROUPS = YES
|
||||
PERL_PATH = /usr/bin/perl
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the dot tool
|
||||
#---------------------------------------------------------------------------
|
||||
CLASS_DIAGRAMS = NO
|
||||
HIDE_UNDOC_RELATIONS = YES
|
||||
HAVE_DOT = YES
|
||||
CLASS_GRAPH = NO
|
||||
COLLABORATION_GRAPH = NO
|
||||
GROUP_GRAPHS = NO
|
||||
UML_LOOK = NO
|
||||
TEMPLATE_RELATIONS = NO
|
||||
INCLUDE_GRAPH = NO
|
||||
INCLUDED_BY_GRAPH = NO
|
||||
CALL_GRAPH = NO
|
||||
GRAPHICAL_HIERARCHY = NO
|
||||
DIRECTORY_GRAPH = NO
|
||||
DOT_IMAGE_FORMAT = png
|
||||
DOT_PATH =
|
||||
DOTFILE_DIRS =
|
||||
MAX_DOT_GRAPH_WIDTH = 1024
|
||||
MAX_DOT_GRAPH_HEIGHT = 1024
|
||||
MAX_DOT_GRAPH_DEPTH = 0
|
||||
DOT_TRANSPARENT = NO
|
||||
DOT_MULTI_TARGETS = NO
|
||||
GENERATE_LEGEND = YES
|
||||
DOT_CLEANUP = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::additions related to the search engine
|
||||
#---------------------------------------------------------------------------
|
||||
SEARCHENGINE = NO
|
||||
# Doxyfile 1.4.1
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Project related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
PROJECT_NAME = "Contiki 6LoWPAN Menu"
|
||||
PROJECT_NUMBER =
|
||||
OUTPUT_DIRECTORY = .
|
||||
CREATE_SUBDIRS = NO
|
||||
OUTPUT_LANGUAGE = English
|
||||
USE_WINDOWS_ENCODING = NO
|
||||
BRIEF_MEMBER_DESC = YES
|
||||
REPEAT_BRIEF = YES
|
||||
ABBREVIATE_BRIEF =
|
||||
ALWAYS_DETAILED_SEC = NO
|
||||
INLINE_INHERITED_MEMB = NO
|
||||
FULL_PATH_NAMES = YES
|
||||
STRIP_FROM_PATH = ../
|
||||
STRIP_FROM_INC_PATH =
|
||||
SHORT_NAMES = YES
|
||||
JAVADOC_AUTOBRIEF = YES
|
||||
MULTILINE_CPP_IS_BRIEF = NO
|
||||
DETAILS_AT_TOP = YES
|
||||
INHERIT_DOCS = YES
|
||||
DISTRIBUTE_GROUP_DOC = NO
|
||||
TAB_SIZE = 8
|
||||
ALIASES =
|
||||
OPTIMIZE_OUTPUT_FOR_C = YES
|
||||
OPTIMIZE_OUTPUT_JAVA = NO
|
||||
SUBGROUPING = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Build related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
EXTRACT_ALL = NO
|
||||
EXTRACT_PRIVATE = NO
|
||||
EXTRACT_STATIC = YES
|
||||
EXTRACT_LOCAL_CLASSES = NO
|
||||
EXTRACT_LOCAL_METHODS = NO
|
||||
HIDE_UNDOC_MEMBERS = YES
|
||||
HIDE_UNDOC_CLASSES = YES
|
||||
HIDE_FRIEND_COMPOUNDS = NO
|
||||
HIDE_IN_BODY_DOCS = NO
|
||||
INTERNAL_DOCS = NO
|
||||
CASE_SENSE_NAMES = YES
|
||||
HIDE_SCOPE_NAMES = NO
|
||||
SHOW_INCLUDE_FILES = YES
|
||||
INLINE_INFO = YES
|
||||
SORT_MEMBER_DOCS = YES
|
||||
SORT_BRIEF_DOCS = NO
|
||||
SORT_BY_SCOPE_NAME = NO
|
||||
GENERATE_TODOLIST = YES
|
||||
GENERATE_TESTLIST = YES
|
||||
GENERATE_BUGLIST = NO
|
||||
GENERATE_DEPRECATEDLIST= NO
|
||||
ENABLED_SECTIONS =
|
||||
MAX_INITIALIZER_LINES = 30
|
||||
SHOW_USED_FILES = NO
|
||||
SHOW_DIRECTORIES = YES
|
||||
FILE_VERSION_FILTER =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to warning and progress messages
|
||||
#---------------------------------------------------------------------------
|
||||
QUIET = NO
|
||||
WARNINGS = YES
|
||||
WARN_IF_UNDOCUMENTED = NO
|
||||
WARN_IF_DOC_ERROR = YES
|
||||
WARN_NO_PARAMDOC = NO
|
||||
WARN_FORMAT = "$file:$line: $text"
|
||||
WARN_LOGFILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the input files
|
||||
#---------------------------------------------------------------------------
|
||||
INPUT = ../adc.c \
|
||||
../beep.c \
|
||||
../key.c \
|
||||
../lcd.c \
|
||||
../menu.c \
|
||||
../raven3290.c \
|
||||
../sleep.c \
|
||||
../temp.c \
|
||||
../timer.c \
|
||||
../uart.c \
|
||||
../adc.h \
|
||||
../beep.h \
|
||||
../key.h \
|
||||
../lcd.h \
|
||||
../menu.h \
|
||||
../main.h \
|
||||
../sleep.h \
|
||||
../temp.h \
|
||||
../timer.h \
|
||||
../uart.h
|
||||
|
||||
FILE_PATTERNS =
|
||||
RECURSIVE = NO
|
||||
EXCLUDE =
|
||||
EXCLUDE_SYMLINKS = NO
|
||||
EXCLUDE_PATTERNS =
|
||||
EXAMPLE_PATH =
|
||||
EXAMPLE_PATTERNS =
|
||||
EXAMPLE_RECURSIVE = NO
|
||||
IMAGE_PATH = ./pics
|
||||
INPUT_FILTER =
|
||||
FILTER_PATTERNS =
|
||||
FILTER_SOURCE_FILES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to source browsing
|
||||
#---------------------------------------------------------------------------
|
||||
SOURCE_BROWSER = YES
|
||||
INLINE_SOURCES = NO
|
||||
STRIP_CODE_COMMENTS = NO
|
||||
REFERENCED_BY_RELATION = YES
|
||||
REFERENCES_RELATION = YES
|
||||
VERBATIM_HEADERS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the alphabetical class index
|
||||
#---------------------------------------------------------------------------
|
||||
ALPHABETICAL_INDEX = YES
|
||||
COLS_IN_ALPHA_INDEX = 5
|
||||
IGNORE_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the HTML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_HTML = YES
|
||||
HTML_OUTPUT = html
|
||||
HTML_FILE_EXTENSION = .html
|
||||
HTML_HEADER =
|
||||
HTML_FOOTER =
|
||||
HTML_STYLESHEET =
|
||||
HTML_ALIGN_MEMBERS = YES
|
||||
GENERATE_HTMLHELP = YES
|
||||
CHM_FILE =
|
||||
HHC_LOCATION =
|
||||
GENERATE_CHI = YES
|
||||
BINARY_TOC = YES
|
||||
TOC_EXPAND = YES
|
||||
DISABLE_INDEX = NO
|
||||
ENUM_VALUES_PER_LINE = 4
|
||||
GENERATE_TREEVIEW = YES
|
||||
TREEVIEW_WIDTH = 250
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the LaTeX output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_LATEX = YES
|
||||
LATEX_OUTPUT = latex
|
||||
LATEX_CMD_NAME = latex
|
||||
MAKEINDEX_CMD_NAME = makeindex
|
||||
COMPACT_LATEX = YES
|
||||
PAPER_TYPE = a4wide
|
||||
EXTRA_PACKAGES =
|
||||
LATEX_HEADER =
|
||||
PDF_HYPERLINKS = YES
|
||||
USE_PDFLATEX = YES
|
||||
LATEX_BATCHMODE = NO
|
||||
LATEX_HIDE_INDICES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the RTF output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_RTF = NO
|
||||
RTF_OUTPUT = rtf
|
||||
COMPACT_RTF = NO
|
||||
RTF_HYPERLINKS = NO
|
||||
RTF_STYLESHEET_FILE =
|
||||
RTF_EXTENSIONS_FILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the man page output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_MAN = NO
|
||||
MAN_OUTPUT = man
|
||||
MAN_EXTENSION = .3
|
||||
MAN_LINKS = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the XML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_XML = NO
|
||||
XML_OUTPUT = xml
|
||||
XML_SCHEMA =
|
||||
XML_DTD =
|
||||
XML_PROGRAMLISTING = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options for the AutoGen Definitions output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_AUTOGEN_DEF = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the Perl module output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_PERLMOD = NO
|
||||
PERLMOD_LATEX = NO
|
||||
PERLMOD_PRETTY = YES
|
||||
PERLMOD_MAKEVAR_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the preprocessor
|
||||
#---------------------------------------------------------------------------
|
||||
ENABLE_PREPROCESSING = YES
|
||||
MACRO_EXPANSION = NO
|
||||
EXPAND_ONLY_PREDEF = NO
|
||||
SEARCH_INCLUDES = YES
|
||||
INCLUDE_PATH =
|
||||
INCLUDE_FILE_PATTERNS =
|
||||
PREDEFINED = DOXYGEN
|
||||
EXPAND_AS_DEFINED =
|
||||
SKIP_FUNCTION_MACROS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::additions related to external references
|
||||
#---------------------------------------------------------------------------
|
||||
TAGFILES =
|
||||
GENERATE_TAGFILE =
|
||||
ALLEXTERNALS = NO
|
||||
EXTERNAL_GROUPS = YES
|
||||
PERL_PATH = /usr/bin/perl
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the dot tool
|
||||
#---------------------------------------------------------------------------
|
||||
CLASS_DIAGRAMS = NO
|
||||
HIDE_UNDOC_RELATIONS = YES
|
||||
HAVE_DOT = YES
|
||||
CLASS_GRAPH = NO
|
||||
COLLABORATION_GRAPH = NO
|
||||
GROUP_GRAPHS = NO
|
||||
UML_LOOK = NO
|
||||
TEMPLATE_RELATIONS = NO
|
||||
INCLUDE_GRAPH = NO
|
||||
INCLUDED_BY_GRAPH = NO
|
||||
CALL_GRAPH = NO
|
||||
GRAPHICAL_HIERARCHY = NO
|
||||
DIRECTORY_GRAPH = NO
|
||||
DOT_IMAGE_FORMAT = png
|
||||
DOT_PATH =
|
||||
DOTFILE_DIRS =
|
||||
MAX_DOT_GRAPH_WIDTH = 1024
|
||||
MAX_DOT_GRAPH_HEIGHT = 1024
|
||||
MAX_DOT_GRAPH_DEPTH = 0
|
||||
DOT_TRANSPARENT = NO
|
||||
DOT_MULTI_TARGETS = NO
|
||||
GENERATE_LEGEND = YES
|
||||
DOT_CLEANUP = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::additions related to the search engine
|
||||
#---------------------------------------------------------------------------
|
||||
SEARCHENGINE = NO
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,54 +1,54 @@
|
|||
/*
|
||||
* Copyright (c) 2013, Thingsquare, http://www.thingsquare.com/.
|
||||
* 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 copyright holder 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 COPYRIGHT HOLDERS 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
|
||||
* COPYRIGHT HOLDER 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __PLATFORM_CONF_H__
|
||||
#define __PLATFORM_CONF_H__
|
||||
|
||||
#if WITH_IP64
|
||||
#define WITH_SLIP 1
|
||||
#ifndef UIP_FALLBACK_INTERFACE
|
||||
#define UIP_FALLBACK_INTERFACE ip64_uip_fallback_interface
|
||||
#endif
|
||||
#endif /* WITH_IP64 */
|
||||
|
||||
#ifndef UIP_CONF_ND6_RA_RDNSS
|
||||
#define UIP_CONF_ND6_RA_RDNSS 1
|
||||
#endif
|
||||
|
||||
#ifndef UIP_CONF_ND6_SEND_RA
|
||||
#define UIP_CONF_ND6_SEND_RA 1
|
||||
#endif
|
||||
|
||||
#ifndef UIP_CONF_ROUTER
|
||||
#define UIP_CONF_ROUTER 1
|
||||
#endif
|
||||
|
||||
#endif /* __PLATFORM_CONF_H__ */
|
||||
/*
|
||||
* Copyright (c) 2013, Thingsquare, http://www.thingsquare.com/.
|
||||
* 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 copyright holder 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 COPYRIGHT HOLDERS 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
|
||||
* COPYRIGHT HOLDER 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __PLATFORM_CONF_H__
|
||||
#define __PLATFORM_CONF_H__
|
||||
|
||||
#if WITH_IP64
|
||||
#define WITH_SLIP 1
|
||||
#ifndef UIP_FALLBACK_INTERFACE
|
||||
#define UIP_FALLBACK_INTERFACE ip64_uip_fallback_interface
|
||||
#endif
|
||||
#endif /* WITH_IP64 */
|
||||
|
||||
#ifndef UIP_CONF_ND6_RA_RDNSS
|
||||
#define UIP_CONF_ND6_RA_RDNSS 1
|
||||
#endif
|
||||
|
||||
#ifndef UIP_CONF_ND6_SEND_RA
|
||||
#define UIP_CONF_ND6_SEND_RA 1
|
||||
#endif
|
||||
|
||||
#ifndef UIP_CONF_ROUTER
|
||||
#define UIP_CONF_ROUTER 1
|
||||
#endif
|
||||
|
||||
#endif /* __PLATFORM_CONF_H__ */
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
/*******************************************************************************
|
||||
Filename: hal_MSP-EXP430F5438.h
|
||||
|
||||
Copyright 2008 Texas Instruments, Inc.
|
||||
|
||||
This is the master header file and also the only necessary file to be included
|
||||
in order to use MSP-EXP430F548 HAL.
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef HAL_MSP_EXP430F5438_H
|
||||
#define HAL_MSP_EXP430F5438_H
|
||||
|
||||
#include "hal_lcd.h"
|
||||
|
||||
#endif
|
||||
/*******************************************************************************
|
||||
Filename: hal_MSP-EXP430F5438.h
|
||||
|
||||
Copyright 2008 Texas Instruments, Inc.
|
||||
|
||||
This is the master header file and also the only necessary file to be included
|
||||
in order to use MSP-EXP430F548 HAL.
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef HAL_MSP_EXP430F5438_H
|
||||
#define HAL_MSP_EXP430F5438_H
|
||||
|
||||
#include "hal_lcd.h"
|
||||
|
||||
#endif
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,147 +1,147 @@
|
|||
/*******************************************************************************
|
||||
*
|
||||
* hal_lcd.h
|
||||
*
|
||||
* Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Neither the name of Texas Instruments Incorporated 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 COPYRIGHT HOLDERS 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 COPYRIGHT
|
||||
* OWNER 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef HAL_LCD_H
|
||||
#define HAL_LCD_H
|
||||
|
||||
#define LCD_BACKLT_OUT P8OUT
|
||||
#define LCD_BACKLT_DIR P8DIR
|
||||
#define LCD_BACKLT_SEL P8SEL
|
||||
#define LCD_BACKLIGHT_PIN BIT3
|
||||
#define LCD_CS_RST_DIR P9DIR
|
||||
#define LCD_CS_RST_OUT P9OUT
|
||||
#define LCD_CS_PIN BIT6
|
||||
#define LCD_RESET_PIN BIT7
|
||||
#define LCD_SPI_SEL P9SEL
|
||||
#define LCD_SPI_DIR P9DIR
|
||||
#define LCD_MOSI_PIN BIT1
|
||||
#define LCD_MISO_PIN BIT2
|
||||
#define LCD_CLK_PIN BIT3
|
||||
|
||||
#define LCD_ROW 110
|
||||
#define LCD_COL 138
|
||||
#define LCD_Size 3505
|
||||
#define LCD_MEM_Size 110 * 17
|
||||
#define LCD_Max_Column_Offset 0x10
|
||||
|
||||
#define LCD_Last_Pixel 3505
|
||||
|
||||
#define LCD_MEM_Row 0x11
|
||||
#define LCD_Row 0x20
|
||||
|
||||
// Grayscale level definitions
|
||||
#define PIXEL_OFF 0
|
||||
#define PIXEL_LIGHT 1
|
||||
#define PIXEL_DARK 2
|
||||
#define PIXEL_ON 3
|
||||
|
||||
#define INVERT_TEXT BIT0
|
||||
#define OVERWRITE_TEXT BIT2
|
||||
#define GRAYSCALE_TEXT BIT1
|
||||
|
||||
/*-------------------------------------------------------------
|
||||
* Function Prototypes
|
||||
* ------------------------------------------------------------*/
|
||||
extern void halLcdInit(void);
|
||||
extern void halLcdShutDown(void);
|
||||
extern void halLcdBackLightInit(void);
|
||||
extern void halLcdSetBackLight(unsigned char BackLightLevel);
|
||||
extern unsigned int halLcdGetBackLight(void);
|
||||
extern void halLcdShutDownBackLight(void);
|
||||
|
||||
extern void halLcdSendCommand(unsigned char Data[]);
|
||||
extern void halLcdSetContrast(unsigned char ContrastLevel);
|
||||
extern unsigned char halLcdGetContrast(void);
|
||||
extern void halLcdStandby(void);
|
||||
extern void halLcdActive(void);
|
||||
|
||||
//Move to specified LCD address
|
||||
extern void halLcdSetAddress(int Address);
|
||||
|
||||
//Draw at current segment location
|
||||
extern void halLcdDrawCurrentBlock(unsigned int Value);
|
||||
extern void halLcdDrawCurrentLine(const unsigned int *value, int length);
|
||||
|
||||
//Draw at specified location by calling
|
||||
//LCD_Set_Address(Address) & LCD_Draw_Current_Block( value )
|
||||
extern void halLcdDrawBlock(unsigned int Address, unsigned int Value);
|
||||
|
||||
//Read value from LCD CGRAM
|
||||
extern int halLcdReadBlock(unsigned int Address);
|
||||
|
||||
//Clear LCD Screen
|
||||
extern void halLcdClearScreen(void);
|
||||
|
||||
//Invert black to white and vice versa
|
||||
extern void halLcdReverse(void);
|
||||
|
||||
// Draw a Pixel @ (x,y) with GrayScale level
|
||||
extern void halLcdPixel(int x, int y, unsigned char GrayScale);
|
||||
|
||||
//Draw Line from (x1,y1) to (x2,y2) with GrayScale level
|
||||
extern void halLcdLine(int x1, int y1, int x2, int y2, unsigned char GrayScale);
|
||||
extern void halLcdHLine(int x1, int x2, int y, unsigned char GrayScale);
|
||||
extern void halLcdVLine(int x1, int x2, int y, unsigned char GrayScale);
|
||||
|
||||
extern void halLcdCircle(int x, int y, int Radius, int GrayScale);
|
||||
|
||||
extern void halLcdImage(const unsigned int Image[], int Columns, int Rows, int x, int y);
|
||||
extern void halLcdClearImage(int Columns, int Rows, int x, int y);
|
||||
|
||||
//Print String of Length starting at current LCD location
|
||||
extern void halLcdPrint(char String[], unsigned char TextStyle);
|
||||
|
||||
//Print String of Length starting at (x,y)
|
||||
extern void halLcdPrintXY(char String[], int x, int y, unsigned char TextStyle);
|
||||
|
||||
//Print String of Length starting at (x,y)
|
||||
extern void halLcdPrintLine(char String[], unsigned char Line, unsigned char TextStyle);
|
||||
extern void halLcdPrintLineCol(char String[], unsigned char Line, unsigned char Col,
|
||||
unsigned char TextStyle);
|
||||
|
||||
extern void halLcdCursor(void);
|
||||
extern void halLcdCursorOff(void);
|
||||
|
||||
//Scroll a single row of pixels
|
||||
extern void halLcdScrollRow(int y);
|
||||
|
||||
//Scroll a number of consecutive rows from yStart to yEnd
|
||||
extern void halLcdHScroll(int yStart, int yEnd);
|
||||
|
||||
//Scroll a line of text
|
||||
extern void halLcdScrollLine(int Line);
|
||||
|
||||
#endif /* HAL_LCD_H */
|
||||
/*******************************************************************************
|
||||
*
|
||||
* hal_lcd.h
|
||||
*
|
||||
* Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Neither the name of Texas Instruments Incorporated 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 COPYRIGHT HOLDERS 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 COPYRIGHT
|
||||
* OWNER 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef HAL_LCD_H
|
||||
#define HAL_LCD_H
|
||||
|
||||
#define LCD_BACKLT_OUT P8OUT
|
||||
#define LCD_BACKLT_DIR P8DIR
|
||||
#define LCD_BACKLT_SEL P8SEL
|
||||
#define LCD_BACKLIGHT_PIN BIT3
|
||||
#define LCD_CS_RST_DIR P9DIR
|
||||
#define LCD_CS_RST_OUT P9OUT
|
||||
#define LCD_CS_PIN BIT6
|
||||
#define LCD_RESET_PIN BIT7
|
||||
#define LCD_SPI_SEL P9SEL
|
||||
#define LCD_SPI_DIR P9DIR
|
||||
#define LCD_MOSI_PIN BIT1
|
||||
#define LCD_MISO_PIN BIT2
|
||||
#define LCD_CLK_PIN BIT3
|
||||
|
||||
#define LCD_ROW 110
|
||||
#define LCD_COL 138
|
||||
#define LCD_Size 3505
|
||||
#define LCD_MEM_Size 110 * 17
|
||||
#define LCD_Max_Column_Offset 0x10
|
||||
|
||||
#define LCD_Last_Pixel 3505
|
||||
|
||||
#define LCD_MEM_Row 0x11
|
||||
#define LCD_Row 0x20
|
||||
|
||||
// Grayscale level definitions
|
||||
#define PIXEL_OFF 0
|
||||
#define PIXEL_LIGHT 1
|
||||
#define PIXEL_DARK 2
|
||||
#define PIXEL_ON 3
|
||||
|
||||
#define INVERT_TEXT BIT0
|
||||
#define OVERWRITE_TEXT BIT2
|
||||
#define GRAYSCALE_TEXT BIT1
|
||||
|
||||
/*-------------------------------------------------------------
|
||||
* Function Prototypes
|
||||
* ------------------------------------------------------------*/
|
||||
extern void halLcdInit(void);
|
||||
extern void halLcdShutDown(void);
|
||||
extern void halLcdBackLightInit(void);
|
||||
extern void halLcdSetBackLight(unsigned char BackLightLevel);
|
||||
extern unsigned int halLcdGetBackLight(void);
|
||||
extern void halLcdShutDownBackLight(void);
|
||||
|
||||
extern void halLcdSendCommand(unsigned char Data[]);
|
||||
extern void halLcdSetContrast(unsigned char ContrastLevel);
|
||||
extern unsigned char halLcdGetContrast(void);
|
||||
extern void halLcdStandby(void);
|
||||
extern void halLcdActive(void);
|
||||
|
||||
//Move to specified LCD address
|
||||
extern void halLcdSetAddress(int Address);
|
||||
|
||||
//Draw at current segment location
|
||||
extern void halLcdDrawCurrentBlock(unsigned int Value);
|
||||
extern void halLcdDrawCurrentLine(const unsigned int *value, int length);
|
||||
|
||||
//Draw at specified location by calling
|
||||
//LCD_Set_Address(Address) & LCD_Draw_Current_Block( value )
|
||||
extern void halLcdDrawBlock(unsigned int Address, unsigned int Value);
|
||||
|
||||
//Read value from LCD CGRAM
|
||||
extern int halLcdReadBlock(unsigned int Address);
|
||||
|
||||
//Clear LCD Screen
|
||||
extern void halLcdClearScreen(void);
|
||||
|
||||
//Invert black to white and vice versa
|
||||
extern void halLcdReverse(void);
|
||||
|
||||
// Draw a Pixel @ (x,y) with GrayScale level
|
||||
extern void halLcdPixel(int x, int y, unsigned char GrayScale);
|
||||
|
||||
//Draw Line from (x1,y1) to (x2,y2) with GrayScale level
|
||||
extern void halLcdLine(int x1, int y1, int x2, int y2, unsigned char GrayScale);
|
||||
extern void halLcdHLine(int x1, int x2, int y, unsigned char GrayScale);
|
||||
extern void halLcdVLine(int x1, int x2, int y, unsigned char GrayScale);
|
||||
|
||||
extern void halLcdCircle(int x, int y, int Radius, int GrayScale);
|
||||
|
||||
extern void halLcdImage(const unsigned int Image[], int Columns, int Rows, int x, int y);
|
||||
extern void halLcdClearImage(int Columns, int Rows, int x, int y);
|
||||
|
||||
//Print String of Length starting at current LCD location
|
||||
extern void halLcdPrint(char String[], unsigned char TextStyle);
|
||||
|
||||
//Print String of Length starting at (x,y)
|
||||
extern void halLcdPrintXY(char String[], int x, int y, unsigned char TextStyle);
|
||||
|
||||
//Print String of Length starting at (x,y)
|
||||
extern void halLcdPrintLine(char String[], unsigned char Line, unsigned char TextStyle);
|
||||
extern void halLcdPrintLineCol(char String[], unsigned char Line, unsigned char Col,
|
||||
unsigned char TextStyle);
|
||||
|
||||
extern void halLcdCursor(void);
|
||||
extern void halLcdCursorOff(void);
|
||||
|
||||
//Scroll a single row of pixels
|
||||
extern void halLcdScrollRow(int y);
|
||||
|
||||
//Scroll a number of consecutive rows from yStart to yEnd
|
||||
extern void halLcdHScroll(int yStart, int yEnd);
|
||||
|
||||
//Scroll a line of text
|
||||
extern void halLcdScrollLine(int Line);
|
||||
|
||||
#endif /* HAL_LCD_H */
|
||||
|
|
|
@ -1,353 +1,353 @@
|
|||
/*******************************************************************************
|
||||
*
|
||||
* hal_lcd_fonts.c
|
||||
*
|
||||
* Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Neither the name of Texas Instruments Incorporated 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 COPYRIGHT HOLDERS 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 COPYRIGHT
|
||||
* OWNER 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
const unsigned char fonts_lookup[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
64, 65, 0, 69, 0, 68, 67, 0, 0, 1, //'0' = 48 = 0x30
|
||||
2, 3, 4, 5, 6, 7, 8, 9, 66, 0, //'9' = 57 = 0x39
|
||||
0, 70, 0, 62, 0, 10, 11, 12, 13, 14, //'A' --> 'Z'
|
||||
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
|
||||
25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
|
||||
35, 0, 0, 0, 71, 0, 0, 36, 37, 38, //'a' = 97
|
||||
39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
|
||||
49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
|
||||
59, 60, 61, 62, 0, 0, 0, 72, 73, 74,
|
||||
75, 76, 77, 78, 79, 80, 81 //'z' = 122
|
||||
};
|
||||
|
||||
const unsigned int fonts[] = {
|
||||
0x0000, 0x0ffc, 0x3c0f, 0x3f0f, 0x3fcf, 0x3ccf, 0x3cff, 0x3c3f,
|
||||
0x3c0f, 0x0ffc, 0x0000, 0x0000, 0x0000, 0x0000, 0x00c0, 0x00f0,
|
||||
0x00ff, 0x00f0, 0x00f0, 0x00f0, 0x00f0, 0x00f0, 0x0fff, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x03fc, 0x0f0f, 0x0f0f, 0x0f00, 0x03c0,
|
||||
0x00f0, 0x003c, 0x0f0f, 0x0fff, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x03fc, 0x0f0f, 0x0f00, 0x0f00, 0x03f0, 0x0f00, 0x0f00, 0x0f0f,
|
||||
0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, 0x0f00, 0x0fc0, 0x0ff0,
|
||||
0x0f3c, 0x0f0f, 0x3fff, 0x0f00, 0x0f00, 0x3fc0, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0fff, 0x000f, 0x000f, 0x000f, 0x03ff, 0x0f00,
|
||||
0x0f00, 0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, 0x03f0,
|
||||
0x003c, 0x000f, 0x000f, 0x03ff, 0x0f0f, 0x0f0f, 0x0f0f, 0x03fc,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x3fff, 0x3c0f, 0x3c0f, 0x3c00,
|
||||
0x0f00, 0x03c0, 0x00f0, 0x00f0, 0x00f0, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x03fc, 0x0f0f, 0x0f0f, 0x0f3f, 0x03fc, 0x0fcf, 0x0f0f,
|
||||
0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, 0x03fc, 0x0f0f,
|
||||
0x0f0f, 0x0f0f, 0x0ffc, 0x03c0, 0x03c0, 0x00f0, 0x00fc, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x00f0, 0x03fc, 0x0f0f, 0x0f0f, 0x0f0f,
|
||||
0x0fff, 0x0f0f, 0x0f0f, 0x0f0f, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0fff, 0x3c3c, 0x3c3c, 0x3c3c, 0x0ffc, 0x3c3c, 0x3c3c, 0x3c3c,
|
||||
0x0fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0ff0, 0x3c3c, 0x3c0f,
|
||||
0x000f, 0x000f, 0x000f, 0x3c0f, 0x3c3c, 0x0ff0, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x03ff, 0x0f3c, 0x3c3c, 0x3c3c, 0x3c3c, 0x3c3c,
|
||||
0x3c3c, 0x0f3c, 0x03ff, 0x0000, 0x0000, 0x0000, 0x0000, 0x3fff,
|
||||
0x303c, 0x003c, 0x0c3c, 0x0ffc, 0x0c3c, 0x003c, 0x303c, 0x3fff,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x3fff, 0x3c3c, 0x303c, 0x0c3c,
|
||||
0x0ffc, 0x0c3c, 0x003c, 0x003c, 0x00ff, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0ff0, 0x3c3c, 0x3c0f, 0x000f, 0x000f, 0x3f0f, 0x3c0f,
|
||||
0x3c3c, 0x3ff0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0f0f, 0x0f0f,
|
||||
0x0f0f, 0x0f0f, 0x0fff, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x03fc, 0x00f0, 0x00f0, 0x00f0, 0x00f0,
|
||||
0x00f0, 0x00f0, 0x00f0, 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x3fc0, 0x0f00, 0x0f00, 0x0f00, 0x0f00, 0x0f0f, 0x0f0f, 0x0f0f,
|
||||
0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, 0x3c3f, 0x3c3c, 0x0f3c,
|
||||
0x0f3c, 0x03fc, 0x0f3c, 0x0f3c, 0x3c3c, 0x3c3f, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x00ff, 0x003c, 0x003c, 0x003c, 0x003c, 0x303c,
|
||||
0x3c3c, 0x3c3c, 0x3fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x3c0f,
|
||||
0x3f3f, 0x3fff, 0x3fff, 0x3ccf, 0x3c0f, 0x3c0f, 0x3c0f, 0x3c0f,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x3c0f, 0x3c0f, 0x3c3f, 0x3cff,
|
||||
0x3fff, 0x3fcf, 0x3f0f, 0x3c0f, 0x3c0f, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x03f0, 0x0f3c, 0x3c0f, 0x3c0f, 0x3c0f, 0x3c0f, 0x3c0f,
|
||||
0x0f3c, 0x03f0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0fff, 0x3c3c,
|
||||
0x3c3c, 0x3c3c, 0x0ffc, 0x003c, 0x003c, 0x003c, 0x00ff, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x03f0, 0x0f3c, 0x3c0f, 0x3c0f, 0x3c0f,
|
||||
0x3f0f, 0x3fcf, 0x0ffc, 0x0f00, 0x3fc0, 0x0000, 0x0000, 0x0000,
|
||||
0x0fff, 0x3c3c, 0x3c3c, 0x3c3c, 0x0ffc, 0x0f3c, 0x3c3c, 0x3c3c,
|
||||
0x3c3f, 0x0000, 0x0000, 0x0000, 0x0000, 0x03fc, 0x0f0f, 0x0f0f,
|
||||
0x000f, 0x00fc, 0x03c0, 0x0f0f, 0x0f0f, 0x03fc, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0fff, 0x0cf3, 0x00f0, 0x00f0, 0x00f0, 0x00f0,
|
||||
0x00f0, 0x00f0, 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, 0x0f0f,
|
||||
0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x03fc,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f,
|
||||
0x0f0f, 0x0f0f, 0x0f0f, 0x03fc, 0x00f0, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x3c0f, 0x3c0f, 0x3c0f, 0x3c0f, 0x3ccf, 0x3ccf, 0x0f3c,
|
||||
0x0f3c, 0x0f3c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0f0f, 0x0f0f,
|
||||
0x0f0f, 0x03fc, 0x00f0, 0x03fc, 0x0f0f, 0x0f0f, 0x0f0f, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x03fc,
|
||||
0x00f0, 0x00f0, 0x00f0, 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x3fff, 0x3f0f, 0x03c3, 0x03c0, 0x00f0, 0x003c, 0x303c, 0x3c0f,
|
||||
0x3fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x03fc, 0x0f00, 0x0ffc, 0x0f0f, 0x0f0f, 0x3cfc, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x003f, 0x003c, 0x003c, 0x0ffc, 0x3c3c, 0x3c3c,
|
||||
0x3c3c, 0x3c3c, 0x0fcf, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x03fc, 0x0f0f, 0x000f, 0x000f, 0x0f0f, 0x03fc,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0fc0, 0x0f00, 0x0f00, 0x0ffc,
|
||||
0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x3cfc, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x03fc, 0x0f0f, 0x0fff, 0x000f,
|
||||
0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, 0x03f0, 0x0f3c,
|
||||
0x003c, 0x003c, 0x03ff, 0x003c, 0x003c, 0x003c, 0x00ff, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3cfc, 0x0f0f,
|
||||
0x0f0f, 0x0f0f, 0x0ffc, 0x0f00, 0x0f0f, 0x03fc, 0x0000, 0x0000,
|
||||
0x003f, 0x003c, 0x003c, 0x0f3c, 0x3cfc, 0x3c3c, 0x3c3c, 0x3c3c,
|
||||
0x3c3f, 0x0000, 0x0000, 0x0000, 0x0000, 0x03c0, 0x03c0, 0x0000,
|
||||
0x03fc, 0x03c0, 0x03c0, 0x03c0, 0x03c0, 0x3ffc, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0f00, 0x0f00, 0x0000, 0x0ff0, 0x0f00, 0x0f00,
|
||||
0x0f00, 0x0f00, 0x0f0f, 0x0f0f, 0x03fc, 0x0000, 0x0000, 0x003f,
|
||||
0x003c, 0x003c, 0x3c3c, 0x0f3c, 0x03fc, 0x0f3c, 0x3c3c, 0x3c3f,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x03fc, 0x03c0, 0x03c0, 0x03c0,
|
||||
0x03c0, 0x03c0, 0x03c0, 0x03c0, 0x3ffc, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0fff, 0x3ccf, 0x3ccf, 0x3ccf,
|
||||
0x3ccf, 0x3c0f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x03ff, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03fc, 0x0f0f,
|
||||
0x0f0f, 0x0f0f, 0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0fcf, 0x3c3c, 0x3c3c, 0x3c3c, 0x3c3c,
|
||||
0x0ffc, 0x003c, 0x00ff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x3cfc, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0ffc, 0x0f00, 0x3fc0,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0f3f, 0x3f3c, 0x3cfc,
|
||||
0x003c, 0x003c, 0x00ff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x03fc, 0x0f0f, 0x003c, 0x03c0, 0x0f0f, 0x03fc,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0030, 0x003c, 0x0fff,
|
||||
0x003c, 0x003c, 0x003c, 0x0f3c, 0x03f0, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f,
|
||||
0x0f0f, 0x3cfc, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x03fc, 0x00f0, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3c0f, 0x3c0f,
|
||||
0x3ccf, 0x3ccf, 0x0f3c, 0x0f3c, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x3c0f, 0x0f3c, 0x03f0, 0x03f0, 0x0f3c,
|
||||
0x3c0f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x3c3c, 0x3c3c, 0x3c3c, 0x3c3c, 0x0ff0, 0x0f00, 0x03c0, 0x00ff,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0fff, 0x0f03, 0x03c0,
|
||||
0x003c, 0x0c0f, 0x0fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x03fc,
|
||||
0x0f0f, 0x0f00, 0x03c0, 0x00f0, 0x00f0, 0x0000, 0x00f0, 0x00f0,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0f00, 0x03c0, 0x00f0, 0x003c, 0x003c, 0x003c, 0x00f0,
|
||||
0x03c0, 0x0f00, 0x0000, 0x0000, 0x0000, 0x0000, 0x003c, 0x00f0,
|
||||
0x03c0, 0x0f00, 0x0f00, 0x0f00, 0x03c0, 0x00f0, 0x003c, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03f0, 0x03f0, 0x0000,
|
||||
0x0000, 0x03f0, 0x03f0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03f0,
|
||||
0x03f0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x3ffc, 0x3ffc, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x03c0, 0x03c0, 0x3ffc, 0x3ffc,
|
||||
0x03c0, 0x03c0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x3ffc, 0x0000, 0x0000, 0x3ffc, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x03fc, 0x0f0f, 0x0f0f, 0x0f0f,
|
||||
0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
//0---------------------------
|
||||
0x0000, 0x0ffc, 0x3c0f, 0x3f0f, 0x3fcf, 0x3ccf, 0x3cff, 0x3c3f,
|
||||
0x3c0f, 0x0ffc, 0x0000, 0x0000, 0x0000,
|
||||
//1---------------------------
|
||||
0x0000, 0x00c0, 0x00f0, 0x00ff, 0x00f0, 0x00f0, 0x00f0, 0x00f0,
|
||||
0x00f0, 0x0fff, 0x0000, 0x0000, 0x0000,
|
||||
//2---------------------------
|
||||
0x0000, 0x03fc, 0x0f0f, 0x0f0f, 0x0f00, 0x03c0, 0x00f0, 0x003c,
|
||||
0x0f0f, 0x0fff, 0x0000, 0x0000, 0x0000,
|
||||
//3---------------------------
|
||||
0x0000, 0x03fc, 0x0f0f, 0x0f00, 0x0f00, 0x03f0, 0x0f00, 0x0f00,
|
||||
0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000,
|
||||
//4---------------------------
|
||||
0x0000, 0x0f00, 0x0fc0, 0x0ff0, 0x0f3c, 0x0f0f, 0x3fff, 0x0f00,
|
||||
0x0f00, 0x3fc0, 0x0000, 0x0000, 0x0000,
|
||||
//5---------------------------
|
||||
0x0000, 0x0fff, 0x000f, 0x000f, 0x000f, 0x03ff, 0x0f00, 0x0f00,
|
||||
0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000,
|
||||
//6---------------------------
|
||||
0x0000, 0x03f0, 0x003c, 0x000f, 0x000f, 0x03ff, 0x0f0f, 0x0f0f,
|
||||
0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000,
|
||||
//7---------------------------
|
||||
0x0000, 0x3fff, 0x3c0f, 0x3c0f, 0x3c00, 0x0f00, 0x03c0, 0x00f0,
|
||||
0x00f0, 0x00f0, 0x0000, 0x0000, 0x0000,
|
||||
//8---------------------------
|
||||
0x0000, 0x03fc, 0x0f0f, 0x0f0f, 0x0f3f, 0x03fc, 0x0fcf, 0x0f0f,
|
||||
0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000,
|
||||
//9---------------------------
|
||||
0x0000, 0x03fc, 0x0f0f, 0x0f0f, 0x0f0f, 0x0ffc, 0x03c0, 0x03c0,
|
||||
0x00f0, 0x00fc, 0x0000, 0x0000, 0x0000,
|
||||
};
|
||||
|
||||
|
||||
const unsigned int GrayScale_fonts[] = {
|
||||
0x0000, 0x0aa8, 0x280a, 0x2a0a, 0x2a8a, 0x288a, 0x28aa, 0x282a,
|
||||
0x280a, 0x0aa8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0080, 0x00a0,
|
||||
0x00aa, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x0aaa, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x02a8, 0x0a0a, 0x0a0a, 0x0a00, 0x0280,
|
||||
0x00a0, 0x0028, 0x0a0a, 0x0aaa, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x02a8, 0x0a0a, 0x0a00, 0x0a00, 0x02a0, 0x0a00, 0x0a00, 0x0a0a,
|
||||
0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0a00, 0x0a80, 0x0aa0,
|
||||
0x0a28, 0x0a0a, 0x2aaa, 0x0a00, 0x0a00, 0x2a80, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0aaa, 0x000a, 0x000a, 0x000a, 0x02aa, 0x0a00,
|
||||
0x0a00, 0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a0,
|
||||
0x0028, 0x000a, 0x000a, 0x02aa, 0x0a0a, 0x0a0a, 0x0a0a, 0x02a8,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x2aaa, 0x280a, 0x280a, 0x2800,
|
||||
0x0a00, 0x0280, 0x00a0, 0x00a0, 0x00a0, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x02a8, 0x0a0a, 0x0a0a, 0x0a2a, 0x02a8, 0x0a8a, 0x0a0a,
|
||||
0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a8, 0x0a0a,
|
||||
0x0a0a, 0x0a0a, 0x0aa8, 0x0280, 0x0280, 0x00a0, 0x00a8, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x00a0, 0x02a8, 0x0a0a, 0x0a0a, 0x0a0a,
|
||||
0x0aaa, 0x0a0a, 0x0a0a, 0x0a0a, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0aaa, 0x2828, 0x2828, 0x2828, 0x0aa8, 0x2828, 0x2828, 0x2828,
|
||||
0x0aaa, 0x0000, 0x0000, 0x0000, 0x0000, 0x0aa0, 0x2828, 0x280a,
|
||||
0x000a, 0x000a, 0x000a, 0x280a, 0x2828, 0x0aa0, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x02aa, 0x0a28, 0x2828, 0x2828, 0x2828, 0x2828,
|
||||
0x2828, 0x0a28, 0x02aa, 0x0000, 0x0000, 0x0000, 0x0000, 0x2aaa,
|
||||
0x2028, 0x0028, 0x0828, 0x0aa8, 0x0828, 0x0028, 0x2028, 0x2aaa,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x2aaa, 0x2828, 0x2028, 0x0828,
|
||||
0x0aa8, 0x0828, 0x0028, 0x0028, 0x00aa, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0aa0, 0x2828, 0x280a, 0x000a, 0x000a, 0x2a0a, 0x280a,
|
||||
0x2828, 0x2aa0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0a0a, 0x0a0a,
|
||||
0x0a0a, 0x0a0a, 0x0aaa, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x02a8, 0x00a0, 0x00a0, 0x00a0, 0x00a0,
|
||||
0x00a0, 0x00a0, 0x00a0, 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x2a80, 0x0a00, 0x0a00, 0x0a00, 0x0a00, 0x0a0a, 0x0a0a, 0x0a0a,
|
||||
0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x282a, 0x2828, 0x0a28,
|
||||
0x0a28, 0x02a8, 0x0a28, 0x0a28, 0x2828, 0x282a, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x00aa, 0x0028, 0x0028, 0x0028, 0x0028, 0x2028,
|
||||
0x2828, 0x2828, 0x2aaa, 0x0000, 0x0000, 0x0000, 0x0000, 0x280a,
|
||||
0x2a2a, 0x2aaa, 0x2aaa, 0x288a, 0x280a, 0x280a, 0x280a, 0x280a,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x280a, 0x280a, 0x282a, 0x28aa,
|
||||
0x2aaa, 0x2a8a, 0x2a0a, 0x280a, 0x280a, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x02a0, 0x0a28, 0x280a, 0x280a, 0x280a, 0x280a, 0x280a,
|
||||
0x0a28, 0x02a0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0aaa, 0x2828,
|
||||
0x2828, 0x2828, 0x0aa8, 0x0028, 0x0028, 0x0028, 0x00aa, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x02a0, 0x0a28, 0x280a, 0x280a, 0x280a,
|
||||
0x2a0a, 0x2a8a, 0x0aa8, 0x0a00, 0x2a80, 0x0000, 0x0000, 0x0000,
|
||||
0x0aaa, 0x2828, 0x2828, 0x2828, 0x0aa8, 0x0a28, 0x2828, 0x2828,
|
||||
0x282a, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a8, 0x0a0a, 0x0a0a,
|
||||
0x000a, 0x00a8, 0x0280, 0x0a0a, 0x0a0a, 0x02a8, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0aaa, 0x08a2, 0x00a0, 0x00a0, 0x00a0, 0x00a0,
|
||||
0x00a0, 0x00a0, 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0a0a,
|
||||
0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x02a8,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a,
|
||||
0x0a0a, 0x0a0a, 0x0a0a, 0x02a8, 0x00a0, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x280a, 0x280a, 0x280a, 0x280a, 0x288a, 0x288a, 0x0a28,
|
||||
0x0a28, 0x0a28, 0x0000, 0x0000, 0x0000, 0x0000, 0x0a0a, 0x0a0a,
|
||||
0x0a0a, 0x02a8, 0x00a0, 0x02a8, 0x0a0a, 0x0a0a, 0x0a0a, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x02a8,
|
||||
0x00a0, 0x00a0, 0x00a0, 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x2aaa, 0x2a0a, 0x0282, 0x0280, 0x00a0, 0x0028, 0x2028, 0x280a,
|
||||
0x2aaa, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x02a8, 0x0a00, 0x0aa8, 0x0a0a, 0x0a0a, 0x28a8, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x002a, 0x0028, 0x0028, 0x0aa8, 0x2828, 0x2828,
|
||||
0x2828, 0x2828, 0x0a8a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x02a8, 0x0a0a, 0x000a, 0x000a, 0x0a0a, 0x02a8,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0a80, 0x0a00, 0x0a00, 0x0aa8,
|
||||
0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x28a8, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x02a8, 0x0a0a, 0x0aaa, 0x000a,
|
||||
0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a0, 0x0a28,
|
||||
0x0028, 0x0028, 0x02aa, 0x0028, 0x0028, 0x0028, 0x00aa, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x28a8, 0x0a0a,
|
||||
0x0a0a, 0x0a0a, 0x0aa8, 0x0a00, 0x0a0a, 0x02a8, 0x0000, 0x0000,
|
||||
0x002a, 0x0028, 0x0028, 0x0a28, 0x28a8, 0x2828, 0x2828, 0x2828,
|
||||
0x282a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0280, 0x0280, 0x0000,
|
||||
0x02a8, 0x0280, 0x0280, 0x0280, 0x0280, 0x2aa8, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0a00, 0x0a00, 0x0000, 0x0aa0, 0x0a00, 0x0a00,
|
||||
0x0a00, 0x0a00, 0x0a0a, 0x0a0a, 0x02a8, 0x0000, 0x0000, 0x002a,
|
||||
0x0028, 0x0028, 0x2828, 0x0a28, 0x02a8, 0x0a28, 0x2828, 0x282a,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x02a8, 0x0280, 0x0280, 0x0280,
|
||||
0x0280, 0x0280, 0x0280, 0x0280, 0x2aa8, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0aaa, 0x288a, 0x288a, 0x288a,
|
||||
0x288a, 0x280a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x02aa, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a8, 0x0a0a,
|
||||
0x0a0a, 0x0a0a, 0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0a8a, 0x2828, 0x2828, 0x2828, 0x2828,
|
||||
0x0aa8, 0x0028, 0x00aa, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x28a8, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x0aa8, 0x0a00, 0x2a80,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0a2a, 0x2a28, 0x28a8,
|
||||
0x0028, 0x0028, 0x00aa, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x02a8, 0x0a0a, 0x0028, 0x0280, 0x0a0a, 0x02a8,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0020, 0x0028, 0x0aaa,
|
||||
0x0028, 0x0028, 0x0028, 0x0a28, 0x02a0, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a,
|
||||
0x0a0a, 0x28a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x02a8, 0x00a0, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x280a, 0x280a,
|
||||
0x288a, 0x288a, 0x0a28, 0x0a28, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x280a, 0x0a28, 0x02a0, 0x02a0, 0x0a28,
|
||||
0x280a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x2828, 0x2828, 0x2828, 0x2828, 0x0aa0, 0x0a00, 0x0280, 0x00aa,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0aaa, 0x0a02, 0x0280,
|
||||
0x0028, 0x080a, 0x0aaa, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a8,
|
||||
0x0a0a, 0x0a00, 0x0280, 0x00a0, 0x00a0, 0x0000, 0x00a0, 0x00a0,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0a00, 0x0280, 0x00a0, 0x0028, 0x0028, 0x0028, 0x00a0,
|
||||
0x0280, 0x0a00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0028, 0x00a0,
|
||||
0x0280, 0x0a00, 0x0a00, 0x0a00, 0x0280, 0x00a0, 0x0028, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a0, 0x02a0, 0x0000,
|
||||
0x0000, 0x02a0, 0x02a0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a0,
|
||||
0x02a0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x2aa8, 0x2aa8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0280, 0x0280, 0x2aa8, 0x2aa8,
|
||||
0x0280, 0x0280, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x2aa8, 0x0000, 0x0000, 0x2aa8, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x02a8, 0x0a0a, 0x0a0a, 0x0a0a,
|
||||
0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
//0---------------------------
|
||||
0x0000, 0x0aa8, 0x280a, 0x2a0a, 0x2a8a, 0x288a, 0x28aa, 0x282a,
|
||||
0x280a, 0x0aa8, 0x0000, 0x0000, 0x0000,
|
||||
//1---------------------------
|
||||
0x0000, 0x0080, 0x00a0, 0x00aa, 0x00a0, 0x00a0, 0x00a0, 0x00a0,
|
||||
0x00a0, 0x0aaa, 0x0000, 0x0000, 0x0000,
|
||||
//2---------------------------
|
||||
0x0000, 0x02a8, 0x0a0a, 0x0a0a, 0x0a00, 0x0280, 0x00a0, 0x0028,
|
||||
0x0a0a, 0x0aaa, 0x0000, 0x0000, 0x0000,
|
||||
//2---------------------------
|
||||
0x0000, 0x02a8, 0x0a0a, 0x0a00, 0x0a00, 0x02a0, 0x0a00, 0x0a00,
|
||||
0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000,
|
||||
//4---------------------------
|
||||
0x0000, 0x0a00, 0x0a80, 0x0aa0, 0x0a28, 0x0a0a, 0x2aaa, 0x0a00,
|
||||
0x0a00, 0x2a80, 0x0000, 0x0000, 0x0000,
|
||||
//5---------------------------
|
||||
0x0000, 0x0aaa, 0x000a, 0x000a, 0x000a, 0x02aa, 0x0a00, 0x0a00,
|
||||
0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000,
|
||||
//6---------------------------
|
||||
0x0000, 0x02a0, 0x0028, 0x000a, 0x000a, 0x02aa, 0x0a0a, 0x0a0a,
|
||||
0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000,
|
||||
//7---------------------------
|
||||
0x0000, 0x2aaa, 0x280a, 0x280a, 0x2800, 0x0a00, 0x0280, 0x00a0,
|
||||
0x00a0, 0x00a0, 0x0000, 0x0000, 0x0000,
|
||||
//8---------------------------
|
||||
0x0000, 0x02a8, 0x0a0a, 0x0a0a, 0x0a2a, 0x02a8, 0x0a8a, 0x0a0a,
|
||||
0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000,
|
||||
//9---------------------------
|
||||
0x0000, 0x02a8, 0x0a0a, 0x0a0a, 0x0a0a, 0x0aa8, 0x0280, 0x0280,
|
||||
0x00a0, 0x00a8, 0x0000, 0x0000, 0x0000,
|
||||
};
|
||||
/*******************************************************************************
|
||||
*
|
||||
* hal_lcd_fonts.c
|
||||
*
|
||||
* Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Neither the name of Texas Instruments Incorporated 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 COPYRIGHT HOLDERS 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 COPYRIGHT
|
||||
* OWNER 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
const unsigned char fonts_lookup[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
64, 65, 0, 69, 0, 68, 67, 0, 0, 1, //'0' = 48 = 0x30
|
||||
2, 3, 4, 5, 6, 7, 8, 9, 66, 0, //'9' = 57 = 0x39
|
||||
0, 70, 0, 62, 0, 10, 11, 12, 13, 14, //'A' --> 'Z'
|
||||
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
|
||||
25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
|
||||
35, 0, 0, 0, 71, 0, 0, 36, 37, 38, //'a' = 97
|
||||
39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
|
||||
49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
|
||||
59, 60, 61, 62, 0, 0, 0, 72, 73, 74,
|
||||
75, 76, 77, 78, 79, 80, 81 //'z' = 122
|
||||
};
|
||||
|
||||
const unsigned int fonts[] = {
|
||||
0x0000, 0x0ffc, 0x3c0f, 0x3f0f, 0x3fcf, 0x3ccf, 0x3cff, 0x3c3f,
|
||||
0x3c0f, 0x0ffc, 0x0000, 0x0000, 0x0000, 0x0000, 0x00c0, 0x00f0,
|
||||
0x00ff, 0x00f0, 0x00f0, 0x00f0, 0x00f0, 0x00f0, 0x0fff, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x03fc, 0x0f0f, 0x0f0f, 0x0f00, 0x03c0,
|
||||
0x00f0, 0x003c, 0x0f0f, 0x0fff, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x03fc, 0x0f0f, 0x0f00, 0x0f00, 0x03f0, 0x0f00, 0x0f00, 0x0f0f,
|
||||
0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, 0x0f00, 0x0fc0, 0x0ff0,
|
||||
0x0f3c, 0x0f0f, 0x3fff, 0x0f00, 0x0f00, 0x3fc0, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0fff, 0x000f, 0x000f, 0x000f, 0x03ff, 0x0f00,
|
||||
0x0f00, 0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, 0x03f0,
|
||||
0x003c, 0x000f, 0x000f, 0x03ff, 0x0f0f, 0x0f0f, 0x0f0f, 0x03fc,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x3fff, 0x3c0f, 0x3c0f, 0x3c00,
|
||||
0x0f00, 0x03c0, 0x00f0, 0x00f0, 0x00f0, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x03fc, 0x0f0f, 0x0f0f, 0x0f3f, 0x03fc, 0x0fcf, 0x0f0f,
|
||||
0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, 0x03fc, 0x0f0f,
|
||||
0x0f0f, 0x0f0f, 0x0ffc, 0x03c0, 0x03c0, 0x00f0, 0x00fc, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x00f0, 0x03fc, 0x0f0f, 0x0f0f, 0x0f0f,
|
||||
0x0fff, 0x0f0f, 0x0f0f, 0x0f0f, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0fff, 0x3c3c, 0x3c3c, 0x3c3c, 0x0ffc, 0x3c3c, 0x3c3c, 0x3c3c,
|
||||
0x0fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0ff0, 0x3c3c, 0x3c0f,
|
||||
0x000f, 0x000f, 0x000f, 0x3c0f, 0x3c3c, 0x0ff0, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x03ff, 0x0f3c, 0x3c3c, 0x3c3c, 0x3c3c, 0x3c3c,
|
||||
0x3c3c, 0x0f3c, 0x03ff, 0x0000, 0x0000, 0x0000, 0x0000, 0x3fff,
|
||||
0x303c, 0x003c, 0x0c3c, 0x0ffc, 0x0c3c, 0x003c, 0x303c, 0x3fff,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x3fff, 0x3c3c, 0x303c, 0x0c3c,
|
||||
0x0ffc, 0x0c3c, 0x003c, 0x003c, 0x00ff, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0ff0, 0x3c3c, 0x3c0f, 0x000f, 0x000f, 0x3f0f, 0x3c0f,
|
||||
0x3c3c, 0x3ff0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0f0f, 0x0f0f,
|
||||
0x0f0f, 0x0f0f, 0x0fff, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x03fc, 0x00f0, 0x00f0, 0x00f0, 0x00f0,
|
||||
0x00f0, 0x00f0, 0x00f0, 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x3fc0, 0x0f00, 0x0f00, 0x0f00, 0x0f00, 0x0f0f, 0x0f0f, 0x0f0f,
|
||||
0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, 0x3c3f, 0x3c3c, 0x0f3c,
|
||||
0x0f3c, 0x03fc, 0x0f3c, 0x0f3c, 0x3c3c, 0x3c3f, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x00ff, 0x003c, 0x003c, 0x003c, 0x003c, 0x303c,
|
||||
0x3c3c, 0x3c3c, 0x3fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x3c0f,
|
||||
0x3f3f, 0x3fff, 0x3fff, 0x3ccf, 0x3c0f, 0x3c0f, 0x3c0f, 0x3c0f,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x3c0f, 0x3c0f, 0x3c3f, 0x3cff,
|
||||
0x3fff, 0x3fcf, 0x3f0f, 0x3c0f, 0x3c0f, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x03f0, 0x0f3c, 0x3c0f, 0x3c0f, 0x3c0f, 0x3c0f, 0x3c0f,
|
||||
0x0f3c, 0x03f0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0fff, 0x3c3c,
|
||||
0x3c3c, 0x3c3c, 0x0ffc, 0x003c, 0x003c, 0x003c, 0x00ff, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x03f0, 0x0f3c, 0x3c0f, 0x3c0f, 0x3c0f,
|
||||
0x3f0f, 0x3fcf, 0x0ffc, 0x0f00, 0x3fc0, 0x0000, 0x0000, 0x0000,
|
||||
0x0fff, 0x3c3c, 0x3c3c, 0x3c3c, 0x0ffc, 0x0f3c, 0x3c3c, 0x3c3c,
|
||||
0x3c3f, 0x0000, 0x0000, 0x0000, 0x0000, 0x03fc, 0x0f0f, 0x0f0f,
|
||||
0x000f, 0x00fc, 0x03c0, 0x0f0f, 0x0f0f, 0x03fc, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0fff, 0x0cf3, 0x00f0, 0x00f0, 0x00f0, 0x00f0,
|
||||
0x00f0, 0x00f0, 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, 0x0f0f,
|
||||
0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x03fc,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f,
|
||||
0x0f0f, 0x0f0f, 0x0f0f, 0x03fc, 0x00f0, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x3c0f, 0x3c0f, 0x3c0f, 0x3c0f, 0x3ccf, 0x3ccf, 0x0f3c,
|
||||
0x0f3c, 0x0f3c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0f0f, 0x0f0f,
|
||||
0x0f0f, 0x03fc, 0x00f0, 0x03fc, 0x0f0f, 0x0f0f, 0x0f0f, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x03fc,
|
||||
0x00f0, 0x00f0, 0x00f0, 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x3fff, 0x3f0f, 0x03c3, 0x03c0, 0x00f0, 0x003c, 0x303c, 0x3c0f,
|
||||
0x3fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x03fc, 0x0f00, 0x0ffc, 0x0f0f, 0x0f0f, 0x3cfc, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x003f, 0x003c, 0x003c, 0x0ffc, 0x3c3c, 0x3c3c,
|
||||
0x3c3c, 0x3c3c, 0x0fcf, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x03fc, 0x0f0f, 0x000f, 0x000f, 0x0f0f, 0x03fc,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0fc0, 0x0f00, 0x0f00, 0x0ffc,
|
||||
0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x3cfc, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x03fc, 0x0f0f, 0x0fff, 0x000f,
|
||||
0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, 0x03f0, 0x0f3c,
|
||||
0x003c, 0x003c, 0x03ff, 0x003c, 0x003c, 0x003c, 0x00ff, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3cfc, 0x0f0f,
|
||||
0x0f0f, 0x0f0f, 0x0ffc, 0x0f00, 0x0f0f, 0x03fc, 0x0000, 0x0000,
|
||||
0x003f, 0x003c, 0x003c, 0x0f3c, 0x3cfc, 0x3c3c, 0x3c3c, 0x3c3c,
|
||||
0x3c3f, 0x0000, 0x0000, 0x0000, 0x0000, 0x03c0, 0x03c0, 0x0000,
|
||||
0x03fc, 0x03c0, 0x03c0, 0x03c0, 0x03c0, 0x3ffc, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0f00, 0x0f00, 0x0000, 0x0ff0, 0x0f00, 0x0f00,
|
||||
0x0f00, 0x0f00, 0x0f0f, 0x0f0f, 0x03fc, 0x0000, 0x0000, 0x003f,
|
||||
0x003c, 0x003c, 0x3c3c, 0x0f3c, 0x03fc, 0x0f3c, 0x3c3c, 0x3c3f,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x03fc, 0x03c0, 0x03c0, 0x03c0,
|
||||
0x03c0, 0x03c0, 0x03c0, 0x03c0, 0x3ffc, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0fff, 0x3ccf, 0x3ccf, 0x3ccf,
|
||||
0x3ccf, 0x3c0f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x03ff, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03fc, 0x0f0f,
|
||||
0x0f0f, 0x0f0f, 0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0fcf, 0x3c3c, 0x3c3c, 0x3c3c, 0x3c3c,
|
||||
0x0ffc, 0x003c, 0x00ff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x3cfc, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0ffc, 0x0f00, 0x3fc0,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0f3f, 0x3f3c, 0x3cfc,
|
||||
0x003c, 0x003c, 0x00ff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x03fc, 0x0f0f, 0x003c, 0x03c0, 0x0f0f, 0x03fc,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0030, 0x003c, 0x0fff,
|
||||
0x003c, 0x003c, 0x003c, 0x0f3c, 0x03f0, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f,
|
||||
0x0f0f, 0x3cfc, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x03fc, 0x00f0, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3c0f, 0x3c0f,
|
||||
0x3ccf, 0x3ccf, 0x0f3c, 0x0f3c, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x3c0f, 0x0f3c, 0x03f0, 0x03f0, 0x0f3c,
|
||||
0x3c0f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x3c3c, 0x3c3c, 0x3c3c, 0x3c3c, 0x0ff0, 0x0f00, 0x03c0, 0x00ff,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0fff, 0x0f03, 0x03c0,
|
||||
0x003c, 0x0c0f, 0x0fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x03fc,
|
||||
0x0f0f, 0x0f00, 0x03c0, 0x00f0, 0x00f0, 0x0000, 0x00f0, 0x00f0,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0f00, 0x03c0, 0x00f0, 0x003c, 0x003c, 0x003c, 0x00f0,
|
||||
0x03c0, 0x0f00, 0x0000, 0x0000, 0x0000, 0x0000, 0x003c, 0x00f0,
|
||||
0x03c0, 0x0f00, 0x0f00, 0x0f00, 0x03c0, 0x00f0, 0x003c, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03f0, 0x03f0, 0x0000,
|
||||
0x0000, 0x03f0, 0x03f0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03f0,
|
||||
0x03f0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x3ffc, 0x3ffc, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x03c0, 0x03c0, 0x3ffc, 0x3ffc,
|
||||
0x03c0, 0x03c0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x3ffc, 0x0000, 0x0000, 0x3ffc, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x03fc, 0x0f0f, 0x0f0f, 0x0f0f,
|
||||
0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
//0---------------------------
|
||||
0x0000, 0x0ffc, 0x3c0f, 0x3f0f, 0x3fcf, 0x3ccf, 0x3cff, 0x3c3f,
|
||||
0x3c0f, 0x0ffc, 0x0000, 0x0000, 0x0000,
|
||||
//1---------------------------
|
||||
0x0000, 0x00c0, 0x00f0, 0x00ff, 0x00f0, 0x00f0, 0x00f0, 0x00f0,
|
||||
0x00f0, 0x0fff, 0x0000, 0x0000, 0x0000,
|
||||
//2---------------------------
|
||||
0x0000, 0x03fc, 0x0f0f, 0x0f0f, 0x0f00, 0x03c0, 0x00f0, 0x003c,
|
||||
0x0f0f, 0x0fff, 0x0000, 0x0000, 0x0000,
|
||||
//3---------------------------
|
||||
0x0000, 0x03fc, 0x0f0f, 0x0f00, 0x0f00, 0x03f0, 0x0f00, 0x0f00,
|
||||
0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000,
|
||||
//4---------------------------
|
||||
0x0000, 0x0f00, 0x0fc0, 0x0ff0, 0x0f3c, 0x0f0f, 0x3fff, 0x0f00,
|
||||
0x0f00, 0x3fc0, 0x0000, 0x0000, 0x0000,
|
||||
//5---------------------------
|
||||
0x0000, 0x0fff, 0x000f, 0x000f, 0x000f, 0x03ff, 0x0f00, 0x0f00,
|
||||
0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000,
|
||||
//6---------------------------
|
||||
0x0000, 0x03f0, 0x003c, 0x000f, 0x000f, 0x03ff, 0x0f0f, 0x0f0f,
|
||||
0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000,
|
||||
//7---------------------------
|
||||
0x0000, 0x3fff, 0x3c0f, 0x3c0f, 0x3c00, 0x0f00, 0x03c0, 0x00f0,
|
||||
0x00f0, 0x00f0, 0x0000, 0x0000, 0x0000,
|
||||
//8---------------------------
|
||||
0x0000, 0x03fc, 0x0f0f, 0x0f0f, 0x0f3f, 0x03fc, 0x0fcf, 0x0f0f,
|
||||
0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000,
|
||||
//9---------------------------
|
||||
0x0000, 0x03fc, 0x0f0f, 0x0f0f, 0x0f0f, 0x0ffc, 0x03c0, 0x03c0,
|
||||
0x00f0, 0x00fc, 0x0000, 0x0000, 0x0000,
|
||||
};
|
||||
|
||||
|
||||
const unsigned int GrayScale_fonts[] = {
|
||||
0x0000, 0x0aa8, 0x280a, 0x2a0a, 0x2a8a, 0x288a, 0x28aa, 0x282a,
|
||||
0x280a, 0x0aa8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0080, 0x00a0,
|
||||
0x00aa, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x0aaa, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x02a8, 0x0a0a, 0x0a0a, 0x0a00, 0x0280,
|
||||
0x00a0, 0x0028, 0x0a0a, 0x0aaa, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x02a8, 0x0a0a, 0x0a00, 0x0a00, 0x02a0, 0x0a00, 0x0a00, 0x0a0a,
|
||||
0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0a00, 0x0a80, 0x0aa0,
|
||||
0x0a28, 0x0a0a, 0x2aaa, 0x0a00, 0x0a00, 0x2a80, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0aaa, 0x000a, 0x000a, 0x000a, 0x02aa, 0x0a00,
|
||||
0x0a00, 0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a0,
|
||||
0x0028, 0x000a, 0x000a, 0x02aa, 0x0a0a, 0x0a0a, 0x0a0a, 0x02a8,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x2aaa, 0x280a, 0x280a, 0x2800,
|
||||
0x0a00, 0x0280, 0x00a0, 0x00a0, 0x00a0, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x02a8, 0x0a0a, 0x0a0a, 0x0a2a, 0x02a8, 0x0a8a, 0x0a0a,
|
||||
0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a8, 0x0a0a,
|
||||
0x0a0a, 0x0a0a, 0x0aa8, 0x0280, 0x0280, 0x00a0, 0x00a8, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x00a0, 0x02a8, 0x0a0a, 0x0a0a, 0x0a0a,
|
||||
0x0aaa, 0x0a0a, 0x0a0a, 0x0a0a, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0aaa, 0x2828, 0x2828, 0x2828, 0x0aa8, 0x2828, 0x2828, 0x2828,
|
||||
0x0aaa, 0x0000, 0x0000, 0x0000, 0x0000, 0x0aa0, 0x2828, 0x280a,
|
||||
0x000a, 0x000a, 0x000a, 0x280a, 0x2828, 0x0aa0, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x02aa, 0x0a28, 0x2828, 0x2828, 0x2828, 0x2828,
|
||||
0x2828, 0x0a28, 0x02aa, 0x0000, 0x0000, 0x0000, 0x0000, 0x2aaa,
|
||||
0x2028, 0x0028, 0x0828, 0x0aa8, 0x0828, 0x0028, 0x2028, 0x2aaa,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x2aaa, 0x2828, 0x2028, 0x0828,
|
||||
0x0aa8, 0x0828, 0x0028, 0x0028, 0x00aa, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0aa0, 0x2828, 0x280a, 0x000a, 0x000a, 0x2a0a, 0x280a,
|
||||
0x2828, 0x2aa0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0a0a, 0x0a0a,
|
||||
0x0a0a, 0x0a0a, 0x0aaa, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x02a8, 0x00a0, 0x00a0, 0x00a0, 0x00a0,
|
||||
0x00a0, 0x00a0, 0x00a0, 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x2a80, 0x0a00, 0x0a00, 0x0a00, 0x0a00, 0x0a0a, 0x0a0a, 0x0a0a,
|
||||
0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x282a, 0x2828, 0x0a28,
|
||||
0x0a28, 0x02a8, 0x0a28, 0x0a28, 0x2828, 0x282a, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x00aa, 0x0028, 0x0028, 0x0028, 0x0028, 0x2028,
|
||||
0x2828, 0x2828, 0x2aaa, 0x0000, 0x0000, 0x0000, 0x0000, 0x280a,
|
||||
0x2a2a, 0x2aaa, 0x2aaa, 0x288a, 0x280a, 0x280a, 0x280a, 0x280a,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x280a, 0x280a, 0x282a, 0x28aa,
|
||||
0x2aaa, 0x2a8a, 0x2a0a, 0x280a, 0x280a, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x02a0, 0x0a28, 0x280a, 0x280a, 0x280a, 0x280a, 0x280a,
|
||||
0x0a28, 0x02a0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0aaa, 0x2828,
|
||||
0x2828, 0x2828, 0x0aa8, 0x0028, 0x0028, 0x0028, 0x00aa, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x02a0, 0x0a28, 0x280a, 0x280a, 0x280a,
|
||||
0x2a0a, 0x2a8a, 0x0aa8, 0x0a00, 0x2a80, 0x0000, 0x0000, 0x0000,
|
||||
0x0aaa, 0x2828, 0x2828, 0x2828, 0x0aa8, 0x0a28, 0x2828, 0x2828,
|
||||
0x282a, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a8, 0x0a0a, 0x0a0a,
|
||||
0x000a, 0x00a8, 0x0280, 0x0a0a, 0x0a0a, 0x02a8, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0aaa, 0x08a2, 0x00a0, 0x00a0, 0x00a0, 0x00a0,
|
||||
0x00a0, 0x00a0, 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0a0a,
|
||||
0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x02a8,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a,
|
||||
0x0a0a, 0x0a0a, 0x0a0a, 0x02a8, 0x00a0, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x280a, 0x280a, 0x280a, 0x280a, 0x288a, 0x288a, 0x0a28,
|
||||
0x0a28, 0x0a28, 0x0000, 0x0000, 0x0000, 0x0000, 0x0a0a, 0x0a0a,
|
||||
0x0a0a, 0x02a8, 0x00a0, 0x02a8, 0x0a0a, 0x0a0a, 0x0a0a, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x02a8,
|
||||
0x00a0, 0x00a0, 0x00a0, 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x2aaa, 0x2a0a, 0x0282, 0x0280, 0x00a0, 0x0028, 0x2028, 0x280a,
|
||||
0x2aaa, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x02a8, 0x0a00, 0x0aa8, 0x0a0a, 0x0a0a, 0x28a8, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x002a, 0x0028, 0x0028, 0x0aa8, 0x2828, 0x2828,
|
||||
0x2828, 0x2828, 0x0a8a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x02a8, 0x0a0a, 0x000a, 0x000a, 0x0a0a, 0x02a8,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0a80, 0x0a00, 0x0a00, 0x0aa8,
|
||||
0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x28a8, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x02a8, 0x0a0a, 0x0aaa, 0x000a,
|
||||
0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a0, 0x0a28,
|
||||
0x0028, 0x0028, 0x02aa, 0x0028, 0x0028, 0x0028, 0x00aa, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x28a8, 0x0a0a,
|
||||
0x0a0a, 0x0a0a, 0x0aa8, 0x0a00, 0x0a0a, 0x02a8, 0x0000, 0x0000,
|
||||
0x002a, 0x0028, 0x0028, 0x0a28, 0x28a8, 0x2828, 0x2828, 0x2828,
|
||||
0x282a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0280, 0x0280, 0x0000,
|
||||
0x02a8, 0x0280, 0x0280, 0x0280, 0x0280, 0x2aa8, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0a00, 0x0a00, 0x0000, 0x0aa0, 0x0a00, 0x0a00,
|
||||
0x0a00, 0x0a00, 0x0a0a, 0x0a0a, 0x02a8, 0x0000, 0x0000, 0x002a,
|
||||
0x0028, 0x0028, 0x2828, 0x0a28, 0x02a8, 0x0a28, 0x2828, 0x282a,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x02a8, 0x0280, 0x0280, 0x0280,
|
||||
0x0280, 0x0280, 0x0280, 0x0280, 0x2aa8, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0aaa, 0x288a, 0x288a, 0x288a,
|
||||
0x288a, 0x280a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x02aa, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a8, 0x0a0a,
|
||||
0x0a0a, 0x0a0a, 0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0a8a, 0x2828, 0x2828, 0x2828, 0x2828,
|
||||
0x0aa8, 0x0028, 0x00aa, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x28a8, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x0aa8, 0x0a00, 0x2a80,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0a2a, 0x2a28, 0x28a8,
|
||||
0x0028, 0x0028, 0x00aa, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x02a8, 0x0a0a, 0x0028, 0x0280, 0x0a0a, 0x02a8,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0020, 0x0028, 0x0aaa,
|
||||
0x0028, 0x0028, 0x0028, 0x0a28, 0x02a0, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a,
|
||||
0x0a0a, 0x28a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x02a8, 0x00a0, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x280a, 0x280a,
|
||||
0x288a, 0x288a, 0x0a28, 0x0a28, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x280a, 0x0a28, 0x02a0, 0x02a0, 0x0a28,
|
||||
0x280a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x2828, 0x2828, 0x2828, 0x2828, 0x0aa0, 0x0a00, 0x0280, 0x00aa,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0aaa, 0x0a02, 0x0280,
|
||||
0x0028, 0x080a, 0x0aaa, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a8,
|
||||
0x0a0a, 0x0a00, 0x0280, 0x00a0, 0x00a0, 0x0000, 0x00a0, 0x00a0,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0a00, 0x0280, 0x00a0, 0x0028, 0x0028, 0x0028, 0x00a0,
|
||||
0x0280, 0x0a00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0028, 0x00a0,
|
||||
0x0280, 0x0a00, 0x0a00, 0x0a00, 0x0280, 0x00a0, 0x0028, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a0, 0x02a0, 0x0000,
|
||||
0x0000, 0x02a0, 0x02a0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a0,
|
||||
0x02a0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x2aa8, 0x2aa8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0280, 0x0280, 0x2aa8, 0x2aa8,
|
||||
0x0280, 0x0280, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x2aa8, 0x0000, 0x0000, 0x2aa8, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x02a8, 0x0a0a, 0x0a0a, 0x0a0a,
|
||||
0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
//0---------------------------
|
||||
0x0000, 0x0aa8, 0x280a, 0x2a0a, 0x2a8a, 0x288a, 0x28aa, 0x282a,
|
||||
0x280a, 0x0aa8, 0x0000, 0x0000, 0x0000,
|
||||
//1---------------------------
|
||||
0x0000, 0x0080, 0x00a0, 0x00aa, 0x00a0, 0x00a0, 0x00a0, 0x00a0,
|
||||
0x00a0, 0x0aaa, 0x0000, 0x0000, 0x0000,
|
||||
//2---------------------------
|
||||
0x0000, 0x02a8, 0x0a0a, 0x0a0a, 0x0a00, 0x0280, 0x00a0, 0x0028,
|
||||
0x0a0a, 0x0aaa, 0x0000, 0x0000, 0x0000,
|
||||
//2---------------------------
|
||||
0x0000, 0x02a8, 0x0a0a, 0x0a00, 0x0a00, 0x02a0, 0x0a00, 0x0a00,
|
||||
0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000,
|
||||
//4---------------------------
|
||||
0x0000, 0x0a00, 0x0a80, 0x0aa0, 0x0a28, 0x0a0a, 0x2aaa, 0x0a00,
|
||||
0x0a00, 0x2a80, 0x0000, 0x0000, 0x0000,
|
||||
//5---------------------------
|
||||
0x0000, 0x0aaa, 0x000a, 0x000a, 0x000a, 0x02aa, 0x0a00, 0x0a00,
|
||||
0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000,
|
||||
//6---------------------------
|
||||
0x0000, 0x02a0, 0x0028, 0x000a, 0x000a, 0x02aa, 0x0a0a, 0x0a0a,
|
||||
0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000,
|
||||
//7---------------------------
|
||||
0x0000, 0x2aaa, 0x280a, 0x280a, 0x2800, 0x0a00, 0x0280, 0x00a0,
|
||||
0x00a0, 0x00a0, 0x0000, 0x0000, 0x0000,
|
||||
//8---------------------------
|
||||
0x0000, 0x02a8, 0x0a0a, 0x0a0a, 0x0a2a, 0x02a8, 0x0a8a, 0x0a0a,
|
||||
0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000,
|
||||
//9---------------------------
|
||||
0x0000, 0x02a8, 0x0a0a, 0x0a0a, 0x0a0a, 0x0aa8, 0x0280, 0x0280,
|
||||
0x00a0, 0x00a8, 0x0000, 0x0000, 0x0000,
|
||||
};
|
||||
|
|
|
@ -1,46 +1,46 @@
|
|||
/*******************************************************************************
|
||||
*
|
||||
* hal_lcd_fonts.h
|
||||
*
|
||||
* Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Neither the name of Texas Instruments Incorporated 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 COPYRIGHT HOLDERS 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 COPYRIGHT
|
||||
* OWNER 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef FONTS_H
|
||||
#define FONTS_H
|
||||
|
||||
#define FONT_HEIGHT 12 // Each character has 13 lines
|
||||
|
||||
extern const unsigned char fonts_lookup[];
|
||||
extern const unsigned int fonts[];
|
||||
extern const unsigned int GrayScale_fonts[];
|
||||
|
||||
#endif /* FONTS_H */
|
||||
/*******************************************************************************
|
||||
*
|
||||
* hal_lcd_fonts.h
|
||||
*
|
||||
* Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Neither the name of Texas Instruments Incorporated 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 COPYRIGHT HOLDERS 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 COPYRIGHT
|
||||
* OWNER 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef FONTS_H
|
||||
#define FONTS_H
|
||||
|
||||
#define FONT_HEIGHT 12 // Each character has 13 lines
|
||||
|
||||
extern const unsigned char fonts_lookup[];
|
||||
extern const unsigned int fonts[];
|
||||
extern const unsigned int GrayScale_fonts[];
|
||||
|
||||
#endif /* FONTS_H */
|
||||
|
|
|
@ -1,224 +1,224 @@
|
|||
/*
|
||||
* Copyright (c) 2014, TU Braunschweig. All rights reserved.
|
||||
* Copyright (c) 2009, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.contikios.cooja.avrmote;
|
||||
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import avrora.arch.avr.AVRProperties;
|
||||
import avrora.core.SourceMapping;
|
||||
import avrora.core.SourceMapping.Location;
|
||||
import avrora.sim.AtmelInterpreter;
|
||||
import avrora.sim.Simulator.Watch;
|
||||
import avrora.sim.State;
|
||||
import java.nio.ByteOrder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import org.contikios.cooja.mote.memory.MemoryInterface;
|
||||
import org.contikios.cooja.mote.memory.MemoryInterface.SegmentMonitor.EventType;
|
||||
import org.contikios.cooja.mote.memory.MemoryLayout;
|
||||
/**
|
||||
* @author Joakim Eriksson, Fredrik Osterlind, David Kopf, Enrico Jorns
|
||||
*/
|
||||
public class AvrMoteMemory implements MemoryInterface {
|
||||
private static Logger logger = Logger.getLogger(AvrMoteMemory.class);
|
||||
private static final boolean DEBUG = logger.isDebugEnabled();
|
||||
|
||||
private final SourceMapping memoryMap;
|
||||
private final AVRProperties avrProperties;
|
||||
private final AtmelInterpreter interpreter;
|
||||
private final ArrayList<AvrByteMonitor> memoryMonitors = new ArrayList<>();
|
||||
private final MemoryLayout memLayout = new MemoryLayout(ByteOrder.LITTLE_ENDIAN, MemoryLayout.ARCH_8BIT, 2);
|
||||
|
||||
private boolean coojaIsAccessingMemory;
|
||||
|
||||
public AvrMoteMemory(SourceMapping map, AVRProperties avrProperties, AtmelInterpreter interpreter) {
|
||||
memoryMap = map;
|
||||
this.interpreter = interpreter;
|
||||
this.avrProperties = avrProperties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTotalSize() {
|
||||
return avrProperties.sram_size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getMemory() throws MoteMemoryException {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getMemorySegment(long address, int size) throws MoteMemoryException {
|
||||
/*logger.info("getMemorySegment(" + String.format("0x%04x", address) +
|
||||
", " + size + ")");*/
|
||||
if (!accessInRange(address, size)) {
|
||||
throw new MoteMemoryException(
|
||||
"Getting memory segment [0x%x,0x%x] failed: Out of range",
|
||||
address, address + size - 1);
|
||||
}
|
||||
|
||||
/* XXX Unsure whether this is the appropriate method to use, as it
|
||||
* triggers memoryRead monitor. Right now I'm using a flag to indicate
|
||||
* that Cooja (as opposed to Contiki) read the memory, to avoid infinite
|
||||
* recursion. */
|
||||
coojaIsAccessingMemory = true;
|
||||
byte[] data = new byte[(int) size];
|
||||
for (int i = 0; i < size; i++) {
|
||||
data[i] = (byte) (interpreter.getDataByte((int) address + i) & 0xff);
|
||||
}
|
||||
coojaIsAccessingMemory = false;
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMemorySegment(long address, byte[] data) throws MoteMemoryException {
|
||||
if (!accessInRange(address, data.length)) {
|
||||
throw new MoteMemoryException(
|
||||
"Writing memory segment [0x%x,0x%x] failed: Out of range",
|
||||
address, address + data.length - 1);
|
||||
}
|
||||
|
||||
/* XXX See comment in getMemorySegment. */
|
||||
coojaIsAccessingMemory = true;
|
||||
for (int i = 0; i < data.length; i++) {
|
||||
interpreter.writeDataByte((int) address + i, data[i]);
|
||||
}
|
||||
coojaIsAccessingMemory = false;
|
||||
if (DEBUG) {
|
||||
logger.debug(String.format(
|
||||
"Wrote memory segment [0x%x,0x%x]",
|
||||
address, address + data.length - 1));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearMemory() {
|
||||
setMemorySegment(0L, new byte[avrProperties.sram_size]);
|
||||
}
|
||||
|
||||
private boolean accessInRange(long address, int size) {
|
||||
return (address >= 0) && (address + size <= avrProperties.sram_size);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getStartAddr() {
|
||||
return 0;// XXX
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Symbol> getSymbolMap() {
|
||||
// XXX do not fetch in function!
|
||||
Map<String, Symbol> symbols = new HashMap<>();
|
||||
for (Iterator<Location> iter = memoryMap.getIterator(); iter.hasNext();) {
|
||||
Location loc = iter.next();
|
||||
if (loc == null || (loc.section.equals(".text"))) {
|
||||
continue;
|
||||
}
|
||||
symbols.put(loc.name, new Symbol(Symbol.Type.VARIABLE, loc.name, loc.section, loc.vma_addr & 0x7fffff, -1));
|
||||
}
|
||||
return symbols;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public MemoryLayout getLayout() {
|
||||
return memLayout;
|
||||
}
|
||||
|
||||
class AvrByteMonitor extends Watch.Empty {
|
||||
|
||||
/** start address to monitor */
|
||||
final long address;
|
||||
/** size to monitor */
|
||||
final int size;
|
||||
/** Segment monitor to notify */
|
||||
final SegmentMonitor mm;
|
||||
/** MonitorType we are listening to */
|
||||
final EventType flag;
|
||||
|
||||
public AvrByteMonitor(long address, int size, SegmentMonitor mm, EventType flag) {
|
||||
this.address = address;
|
||||
this.size = size;
|
||||
this.mm = mm;
|
||||
this.flag = flag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fireAfterRead(State state, int data_addr, byte value) {
|
||||
if (flag == EventType.WRITE || coojaIsAccessingMemory) {
|
||||
return;
|
||||
}
|
||||
mm.memoryChanged(AvrMoteMemory.this, EventType.READ, data_addr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fireAfterWrite(State state, int data_addr, byte value) {
|
||||
if (flag == EventType.READ || coojaIsAccessingMemory) {
|
||||
return;
|
||||
}
|
||||
mm.memoryChanged(AvrMoteMemory.this, EventType.WRITE, data_addr);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addSegmentMonitor(EventType flag, long address, int size, SegmentMonitor mm) {
|
||||
AvrByteMonitor mon = new AvrByteMonitor(address, size, mm, flag);
|
||||
|
||||
memoryMonitors.add(mon);
|
||||
/* logger.debug("Added AvrByteMonitor " + Integer.toString(mon.hashCode()) + " for addr " + mon.address + " size " + mon.size + " with watch" + mon.watch); */
|
||||
|
||||
/* Add byte monitor (watch) for every byte in range */
|
||||
for (int idx = 0; idx < mon.size; idx++) {
|
||||
interpreter.getSimulator().insertWatch(mon, (int) mon.address + idx);
|
||||
/* logger.debug("Inserted watch " + Integer.toString(mon.watch.hashCode()) + " for " + (mon.address + idx)); */
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeSegmentMonitor(long address, int size, SegmentMonitor mm) {
|
||||
for (AvrByteMonitor mcm : memoryMonitors) {
|
||||
if (mcm.mm != mm || mcm.address != address || mcm.size != size) {
|
||||
continue;
|
||||
}
|
||||
for (int idx = 0; idx < mcm.size; idx++) {
|
||||
interpreter.getSimulator().removeWatch(mcm, (int) mcm.address + idx);
|
||||
/* logger.debug("Removed watch " + Integer.toString(mcm.watch.hashCode()) + " for " + (mcm.address + idx)); */
|
||||
}
|
||||
memoryMonitors.remove(mcm);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* Copyright (c) 2014, TU Braunschweig. All rights reserved.
|
||||
* Copyright (c) 2009, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.contikios.cooja.avrmote;
|
||||
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import avrora.arch.avr.AVRProperties;
|
||||
import avrora.core.SourceMapping;
|
||||
import avrora.core.SourceMapping.Location;
|
||||
import avrora.sim.AtmelInterpreter;
|
||||
import avrora.sim.Simulator.Watch;
|
||||
import avrora.sim.State;
|
||||
import java.nio.ByteOrder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import org.contikios.cooja.mote.memory.MemoryInterface;
|
||||
import org.contikios.cooja.mote.memory.MemoryInterface.SegmentMonitor.EventType;
|
||||
import org.contikios.cooja.mote.memory.MemoryLayout;
|
||||
/**
|
||||
* @author Joakim Eriksson, Fredrik Osterlind, David Kopf, Enrico Jorns
|
||||
*/
|
||||
public class AvrMoteMemory implements MemoryInterface {
|
||||
private static Logger logger = Logger.getLogger(AvrMoteMemory.class);
|
||||
private static final boolean DEBUG = logger.isDebugEnabled();
|
||||
|
||||
private final SourceMapping memoryMap;
|
||||
private final AVRProperties avrProperties;
|
||||
private final AtmelInterpreter interpreter;
|
||||
private final ArrayList<AvrByteMonitor> memoryMonitors = new ArrayList<>();
|
||||
private final MemoryLayout memLayout = new MemoryLayout(ByteOrder.LITTLE_ENDIAN, MemoryLayout.ARCH_8BIT, 2);
|
||||
|
||||
private boolean coojaIsAccessingMemory;
|
||||
|
||||
public AvrMoteMemory(SourceMapping map, AVRProperties avrProperties, AtmelInterpreter interpreter) {
|
||||
memoryMap = map;
|
||||
this.interpreter = interpreter;
|
||||
this.avrProperties = avrProperties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTotalSize() {
|
||||
return avrProperties.sram_size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getMemory() throws MoteMemoryException {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getMemorySegment(long address, int size) throws MoteMemoryException {
|
||||
/*logger.info("getMemorySegment(" + String.format("0x%04x", address) +
|
||||
", " + size + ")");*/
|
||||
if (!accessInRange(address, size)) {
|
||||
throw new MoteMemoryException(
|
||||
"Getting memory segment [0x%x,0x%x] failed: Out of range",
|
||||
address, address + size - 1);
|
||||
}
|
||||
|
||||
/* XXX Unsure whether this is the appropriate method to use, as it
|
||||
* triggers memoryRead monitor. Right now I'm using a flag to indicate
|
||||
* that Cooja (as opposed to Contiki) read the memory, to avoid infinite
|
||||
* recursion. */
|
||||
coojaIsAccessingMemory = true;
|
||||
byte[] data = new byte[(int) size];
|
||||
for (int i = 0; i < size; i++) {
|
||||
data[i] = (byte) (interpreter.getDataByte((int) address + i) & 0xff);
|
||||
}
|
||||
coojaIsAccessingMemory = false;
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMemorySegment(long address, byte[] data) throws MoteMemoryException {
|
||||
if (!accessInRange(address, data.length)) {
|
||||
throw new MoteMemoryException(
|
||||
"Writing memory segment [0x%x,0x%x] failed: Out of range",
|
||||
address, address + data.length - 1);
|
||||
}
|
||||
|
||||
/* XXX See comment in getMemorySegment. */
|
||||
coojaIsAccessingMemory = true;
|
||||
for (int i = 0; i < data.length; i++) {
|
||||
interpreter.writeDataByte((int) address + i, data[i]);
|
||||
}
|
||||
coojaIsAccessingMemory = false;
|
||||
if (DEBUG) {
|
||||
logger.debug(String.format(
|
||||
"Wrote memory segment [0x%x,0x%x]",
|
||||
address, address + data.length - 1));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearMemory() {
|
||||
setMemorySegment(0L, new byte[avrProperties.sram_size]);
|
||||
}
|
||||
|
||||
private boolean accessInRange(long address, int size) {
|
||||
return (address >= 0) && (address + size <= avrProperties.sram_size);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getStartAddr() {
|
||||
return 0;// XXX
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Symbol> getSymbolMap() {
|
||||
// XXX do not fetch in function!
|
||||
Map<String, Symbol> symbols = new HashMap<>();
|
||||
for (Iterator<Location> iter = memoryMap.getIterator(); iter.hasNext();) {
|
||||
Location loc = iter.next();
|
||||
if (loc == null || (loc.section.equals(".text"))) {
|
||||
continue;
|
||||
}
|
||||
symbols.put(loc.name, new Symbol(Symbol.Type.VARIABLE, loc.name, loc.section, loc.vma_addr & 0x7fffff, -1));
|
||||
}
|
||||
return symbols;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public MemoryLayout getLayout() {
|
||||
return memLayout;
|
||||
}
|
||||
|
||||
class AvrByteMonitor extends Watch.Empty {
|
||||
|
||||
/** start address to monitor */
|
||||
final long address;
|
||||
/** size to monitor */
|
||||
final int size;
|
||||
/** Segment monitor to notify */
|
||||
final SegmentMonitor mm;
|
||||
/** MonitorType we are listening to */
|
||||
final EventType flag;
|
||||
|
||||
public AvrByteMonitor(long address, int size, SegmentMonitor mm, EventType flag) {
|
||||
this.address = address;
|
||||
this.size = size;
|
||||
this.mm = mm;
|
||||
this.flag = flag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fireAfterRead(State state, int data_addr, byte value) {
|
||||
if (flag == EventType.WRITE || coojaIsAccessingMemory) {
|
||||
return;
|
||||
}
|
||||
mm.memoryChanged(AvrMoteMemory.this, EventType.READ, data_addr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fireAfterWrite(State state, int data_addr, byte value) {
|
||||
if (flag == EventType.READ || coojaIsAccessingMemory) {
|
||||
return;
|
||||
}
|
||||
mm.memoryChanged(AvrMoteMemory.this, EventType.WRITE, data_addr);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addSegmentMonitor(EventType flag, long address, int size, SegmentMonitor mm) {
|
||||
AvrByteMonitor mon = new AvrByteMonitor(address, size, mm, flag);
|
||||
|
||||
memoryMonitors.add(mon);
|
||||
/* logger.debug("Added AvrByteMonitor " + Integer.toString(mon.hashCode()) + " for addr " + mon.address + " size " + mon.size + " with watch" + mon.watch); */
|
||||
|
||||
/* Add byte monitor (watch) for every byte in range */
|
||||
for (int idx = 0; idx < mon.size; idx++) {
|
||||
interpreter.getSimulator().insertWatch(mon, (int) mon.address + idx);
|
||||
/* logger.debug("Inserted watch " + Integer.toString(mon.watch.hashCode()) + " for " + (mon.address + idx)); */
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeSegmentMonitor(long address, int size, SegmentMonitor mm) {
|
||||
for (AvrByteMonitor mcm : memoryMonitors) {
|
||||
if (mcm.mm != mm || mcm.address != address || mcm.size != size) {
|
||||
continue;
|
||||
}
|
||||
for (int idx = 0; idx < mcm.size; idx++) {
|
||||
interpreter.getSimulator().removeWatch(mcm, (int) mcm.address + idx);
|
||||
/* logger.debug("Removed watch " + Integer.toString(mcm.watch.hashCode()) + " for " + (mcm.address + idx)); */
|
||||
}
|
||||
memoryMonitors.remove(mcm);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
MSPSim support for the COOJA Simulator
|
||||
--------------------------------------
|
||||
|
||||
MSPSim source code access: Standalone MSPSim is available from
|
||||
[http://sourceforge.net/projects/mspsim](http://sourceforge.net/projects/mspsim).
|
||||
|
||||
-- Fredrik Österlind, 18/3 2008
|
||||
MSPSim support for the COOJA Simulator
|
||||
--------------------------------------
|
||||
|
||||
MSPSim source code access: Standalone MSPSim is available from
|
||||
[http://sourceforge.net/projects/mspsim](http://sourceforge.net/projects/mspsim).
|
||||
|
||||
-- Fredrik Österlind, 18/3 2008
|
||||
|
|
|
@ -1,422 +1,422 @@
|
|||
/*
|
||||
* Copyright (c) 2012, Thingsquare.
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.contikios.cooja.mspmote.interfaces;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.jdom.Element;
|
||||
|
||||
import org.contikios.cooja.ClassDescription;
|
||||
import org.contikios.cooja.Mote;
|
||||
import org.contikios.cooja.RadioPacket;
|
||||
import org.contikios.cooja.Simulation;
|
||||
import org.contikios.cooja.interfaces.CustomDataRadio;
|
||||
import org.contikios.cooja.interfaces.Position;
|
||||
import org.contikios.cooja.interfaces.Radio;
|
||||
import org.contikios.cooja.mspmote.MspMote;
|
||||
import org.contikios.cooja.mspmote.MspMoteTimeEvent;
|
||||
import se.sics.mspsim.chip.CC1101;
|
||||
import se.sics.mspsim.chip.CC1101.ReceiverListener;
|
||||
import se.sics.mspsim.chip.ChannelListener;
|
||||
import se.sics.mspsim.chip.RFListener;
|
||||
import se.sics.mspsim.chip.Radio802154;
|
||||
|
||||
/**
|
||||
* @author Fredrik Osterlind
|
||||
*/
|
||||
@ClassDescription("TI CC1101")
|
||||
public class CC1101Radio extends Radio implements CustomDataRadio {
|
||||
private static Logger logger = Logger.getLogger(CC1101Radio.class);
|
||||
|
||||
/**
|
||||
* Cross-level:
|
||||
* Inter-byte delay for delivering cross-level packet bytes.
|
||||
*/
|
||||
public static final long DELAY_BETWEEN_BYTES =
|
||||
(long) (1000.0*Simulation.MILLISECOND/(250000.0/8.0)); /* us. Corresponds to 250kbit/s */
|
||||
|
||||
private RadioEvent lastEvent = RadioEvent.UNKNOWN;
|
||||
|
||||
private final MspMote mote;
|
||||
private final CC1101 cc1101;
|
||||
|
||||
private boolean isInterfered = false;
|
||||
private boolean isTransmitting = false;
|
||||
private boolean isReceiving = false;
|
||||
|
||||
private byte lastOutgoingByte;
|
||||
private byte lastIncomingByte;
|
||||
|
||||
private RadioPacket lastOutgoingPacket = null;
|
||||
private RadioPacket lastIncomingPacket = null;
|
||||
|
||||
public CC1101Radio(Mote m) {
|
||||
this.mote = (MspMote)m;
|
||||
Radio802154 r = this.mote.getCPU().getChip(Radio802154.class);
|
||||
if (r == null || !(r instanceof CC1101)) {
|
||||
throw new IllegalStateException("Mote is not equipped with an CC1101 radio");
|
||||
}
|
||||
this.cc1101 = (CC1101) r;
|
||||
|
||||
cc1101.addRFListener(new RFListener() {
|
||||
int len = 0;
|
||||
int expLen = 0;
|
||||
byte[] buffer = new byte[256 + 15];
|
||||
private boolean gotSynchbyte = false;
|
||||
public void receivedByte(byte data) {
|
||||
if (!isTransmitting()) {
|
||||
/* Start transmission */
|
||||
lastEvent = RadioEvent.TRANSMISSION_STARTED;
|
||||
isTransmitting = true;
|
||||
len = 0;
|
||||
gotSynchbyte = false;
|
||||
/*logger.debug("----- CC1101 TRANSMISSION STARTED -----");*/
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
if (len >= buffer.length) {
|
||||
/* Bad size packet, too large */
|
||||
logger.debug("Error: bad size: " + len + ", dropping outgoing byte: " + data);
|
||||
return;
|
||||
}
|
||||
|
||||
/* send this byte to all nodes */
|
||||
lastOutgoingByte = data;
|
||||
lastEvent = RadioEvent.CUSTOM_DATA_TRANSMITTED;
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
|
||||
/* Await synch byte */
|
||||
if (!gotSynchbyte) {
|
||||
if (lastOutgoingByte == CC1101.SYNCH_BYTE_LAST) {
|
||||
gotSynchbyte = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
final int HEADERLEN = 1; /* 1x Length byte */
|
||||
final int FOOTERLEN = 2; /* TODO Fix CRC in Mspsim's CC1101.java */
|
||||
if (len == 0) {
|
||||
expLen = (0xff&data) + HEADERLEN + FOOTERLEN;
|
||||
}
|
||||
buffer[len++] = data;
|
||||
|
||||
if (len == expLen) {
|
||||
/*logger.debug("----- CC1101 CUSTOM DATA TRANSMITTED -----");*/
|
||||
|
||||
final byte[] buf = new byte[expLen];
|
||||
System.arraycopy(buffer, 0, buf, 0, expLen);
|
||||
lastOutgoingPacket = new RadioPacket() {
|
||||
public byte[] getPacketData() {
|
||||
return buf;
|
||||
}
|
||||
};
|
||||
|
||||
lastEvent = RadioEvent.PACKET_TRANSMITTED;
|
||||
/*logger.debug("----- CC1101 PACKET TRANSMITTED -----");*/
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
|
||||
/*logger.debug("----- CC1101 TRANSMISSION FINISHED -----");*/
|
||||
isTransmitting = false;
|
||||
lastEvent = RadioEvent.TRANSMISSION_FINISHED;
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
len = 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
cc1101.setReceiverListener(new ReceiverListener() {
|
||||
public void newState(boolean on) {
|
||||
if (cc1101.isReadyToReceive()) {
|
||||
lastEvent = RadioEvent.HW_ON;
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
} else {
|
||||
radioOff();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
cc1101.addChannelListener(new ChannelListener() {
|
||||
public void channelChanged(int channel) {
|
||||
/* XXX Currently assumes zero channel switch time */
|
||||
lastEvent = RadioEvent.UNKNOWN;
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void radioOff() {
|
||||
/* Radio was turned off during transmission.
|
||||
* May for example happen if watchdog triggers */
|
||||
if (isTransmitting()) {
|
||||
logger.warn("Turning off radio while transmitting, ending packet prematurely");
|
||||
|
||||
/* Simulate end of packet */
|
||||
lastOutgoingPacket = new RadioPacket() {
|
||||
public byte[] getPacketData() {
|
||||
return new byte[0];
|
||||
}
|
||||
};
|
||||
|
||||
lastEvent = RadioEvent.PACKET_TRANSMITTED;
|
||||
/*logger.debug("----- CC1101 PACKET TRANSMITTED -----");*/
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
|
||||
/* Register that transmission ended in radio medium */
|
||||
/*logger.debug("----- CC1101 TRANSMISSION FINISHED -----");*/
|
||||
isTransmitting = false;
|
||||
lastEvent = RadioEvent.TRANSMISSION_FINISHED;
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
|
||||
lastEvent = RadioEvent.HW_OFF;
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
|
||||
/* Packet radio support */
|
||||
public RadioPacket getLastPacketTransmitted() {
|
||||
return lastOutgoingPacket;
|
||||
}
|
||||
|
||||
public RadioPacket getLastPacketReceived() {
|
||||
return lastIncomingPacket;
|
||||
}
|
||||
|
||||
public void setReceivedPacket(RadioPacket packet) {
|
||||
lastIncomingPacket = packet;
|
||||
|
||||
/* TODO XXX Need support in CC1101.java */
|
||||
/*if (!radio.isReadyToReceive()) {
|
||||
logger.warn("Radio receiver not ready, dropping packet data");
|
||||
return;
|
||||
}*/
|
||||
|
||||
/* Delivering packet bytes with delays */
|
||||
byte[] packetData = packet.getPacketData();
|
||||
long deliveryTime = getMote().getSimulation().getSimulationTime();
|
||||
for (byte b: packetData) {
|
||||
if (isInterfered()) {
|
||||
b = (byte) 0xFF;
|
||||
}
|
||||
|
||||
final byte byteToDeliver = b;
|
||||
getMote().getSimulation().scheduleEvent(new MspMoteTimeEvent(mote, 0) {
|
||||
public void execute(long t) {
|
||||
super.execute(t);
|
||||
cc1101.receivedByte(byteToDeliver);
|
||||
mote.requestImmediateWakeup();
|
||||
}
|
||||
}, deliveryTime);
|
||||
deliveryTime += DELAY_BETWEEN_BYTES;
|
||||
}
|
||||
}
|
||||
|
||||
/* Custom data radio support */
|
||||
public Object getLastCustomDataTransmitted() {
|
||||
return lastOutgoingByte;
|
||||
}
|
||||
|
||||
public Object getLastCustomDataReceived() {
|
||||
return lastIncomingByte;
|
||||
}
|
||||
|
||||
public void receiveCustomData(Object data) {
|
||||
if (!(data instanceof Byte)) {
|
||||
logger.fatal("Bad custom data: " + data);
|
||||
return;
|
||||
}
|
||||
lastIncomingByte = (Byte) data;
|
||||
|
||||
final byte inputByte;
|
||||
if (isInterfered()) {
|
||||
inputByte = (byte)0xFF;
|
||||
} else {
|
||||
inputByte = lastIncomingByte;
|
||||
}
|
||||
mote.getSimulation().scheduleEvent(new MspMoteTimeEvent(mote, 0) {
|
||||
public void execute(long t) {
|
||||
super.execute(t);
|
||||
cc1101.receivedByte(inputByte);
|
||||
mote.requestImmediateWakeup();
|
||||
}
|
||||
}, mote.getSimulation().getSimulationTime());
|
||||
|
||||
}
|
||||
|
||||
/* General radio support */
|
||||
public boolean isTransmitting() {
|
||||
return isTransmitting;
|
||||
}
|
||||
|
||||
public boolean isReceiving() {
|
||||
return isReceiving;
|
||||
}
|
||||
|
||||
public boolean isInterfered() {
|
||||
return isInterfered;
|
||||
}
|
||||
|
||||
public int getChannel() {
|
||||
return cc1101.getActiveChannel();
|
||||
}
|
||||
|
||||
public int getFrequency() {
|
||||
return cc1101.getActiveFrequency();
|
||||
}
|
||||
|
||||
public void signalReceptionStart() {
|
||||
isReceiving = true;
|
||||
|
||||
lastEvent = RadioEvent.RECEPTION_STARTED;
|
||||
/*logger.debug("----- CC1101 RECEPTION STARTED -----");*/
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
|
||||
public void signalReceptionEnd() {
|
||||
/* Deliver packet data */
|
||||
isReceiving = false;
|
||||
isInterfered = false;
|
||||
|
||||
lastEvent = RadioEvent.RECEPTION_FINISHED;
|
||||
/*logger.debug("----- CC1101 RECEPTION FINISHED -----");*/
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
|
||||
public RadioEvent getLastEvent() {
|
||||
return lastEvent;
|
||||
}
|
||||
|
||||
public void interfereAnyReception() {
|
||||
isInterfered = true;
|
||||
isReceiving = false;
|
||||
lastIncomingPacket = null;
|
||||
|
||||
lastEvent = RadioEvent.RECEPTION_INTERFERED;
|
||||
/*logger.debug("----- CC1101 RECEPTION INTERFERED -----");*/
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
|
||||
public double getCurrentOutputPower() {
|
||||
/* TODO XXX Need support in CC1101.java */
|
||||
return 1;
|
||||
}
|
||||
public int getCurrentOutputPowerIndicator() {
|
||||
/* TODO XXX Need support in CC1101.java */
|
||||
return 10;
|
||||
}
|
||||
public int getOutputPowerIndicatorMax() {
|
||||
/* TODO XXX Need support in CC1101.java */
|
||||
return 10;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Last 8 received signal strengths
|
||||
*/
|
||||
double currentSignalStrength = 0;
|
||||
private double[] rssiLast = new double[8];
|
||||
private int rssiLastCounter = 0;
|
||||
|
||||
public double getCurrentSignalStrength() {
|
||||
return currentSignalStrength;
|
||||
}
|
||||
|
||||
public void setCurrentSignalStrength(final double signalStrength) {
|
||||
if (signalStrength == currentSignalStrength) {
|
||||
return; /* ignored */
|
||||
}
|
||||
currentSignalStrength = signalStrength;
|
||||
if (rssiLastCounter == 0) {
|
||||
getMote().getSimulation().scheduleEvent(new MspMoteTimeEvent(mote, 0) {
|
||||
public void execute(long t) {
|
||||
super.execute(t);
|
||||
|
||||
/* Update average */
|
||||
System.arraycopy(rssiLast, 1, rssiLast, 0, 7);
|
||||
rssiLast[7] = currentSignalStrength;
|
||||
double avg = 0;
|
||||
for (double v: rssiLast) {
|
||||
avg += v;
|
||||
}
|
||||
avg /= rssiLast.length;
|
||||
|
||||
cc1101.setRSSI((int) avg);
|
||||
|
||||
rssiLastCounter--;
|
||||
if (rssiLastCounter > 0) {
|
||||
mote.getSimulation().scheduleEvent(this, t+DELAY_BETWEEN_BYTES/2);
|
||||
}
|
||||
}
|
||||
}, mote.getSimulation().getSimulationTime());
|
||||
}
|
||||
rssiLastCounter = 8;
|
||||
}
|
||||
|
||||
public Mote getMote() {
|
||||
return mote;
|
||||
}
|
||||
|
||||
public Position getPosition() {
|
||||
return mote.getInterfaces().getPosition();
|
||||
}
|
||||
|
||||
public Collection<Element> getConfigXML() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setConfigXML(Collection<Element> configXML, boolean visAvailable) {
|
||||
}
|
||||
|
||||
public boolean isRadioOn() {
|
||||
return cc1101.isReadyToReceive();
|
||||
}
|
||||
|
||||
public boolean canReceiveFrom(CustomDataRadio radio) {
|
||||
if (radio.getClass().equals(this.getClass())) {
|
||||
return true;
|
||||
}
|
||||
if (radio.getClass().equals(CC430Radio.class)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (c) 2012, Thingsquare.
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.contikios.cooja.mspmote.interfaces;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.jdom.Element;
|
||||
|
||||
import org.contikios.cooja.ClassDescription;
|
||||
import org.contikios.cooja.Mote;
|
||||
import org.contikios.cooja.RadioPacket;
|
||||
import org.contikios.cooja.Simulation;
|
||||
import org.contikios.cooja.interfaces.CustomDataRadio;
|
||||
import org.contikios.cooja.interfaces.Position;
|
||||
import org.contikios.cooja.interfaces.Radio;
|
||||
import org.contikios.cooja.mspmote.MspMote;
|
||||
import org.contikios.cooja.mspmote.MspMoteTimeEvent;
|
||||
import se.sics.mspsim.chip.CC1101;
|
||||
import se.sics.mspsim.chip.CC1101.ReceiverListener;
|
||||
import se.sics.mspsim.chip.ChannelListener;
|
||||
import se.sics.mspsim.chip.RFListener;
|
||||
import se.sics.mspsim.chip.Radio802154;
|
||||
|
||||
/**
|
||||
* @author Fredrik Osterlind
|
||||
*/
|
||||
@ClassDescription("TI CC1101")
|
||||
public class CC1101Radio extends Radio implements CustomDataRadio {
|
||||
private static Logger logger = Logger.getLogger(CC1101Radio.class);
|
||||
|
||||
/**
|
||||
* Cross-level:
|
||||
* Inter-byte delay for delivering cross-level packet bytes.
|
||||
*/
|
||||
public static final long DELAY_BETWEEN_BYTES =
|
||||
(long) (1000.0*Simulation.MILLISECOND/(250000.0/8.0)); /* us. Corresponds to 250kbit/s */
|
||||
|
||||
private RadioEvent lastEvent = RadioEvent.UNKNOWN;
|
||||
|
||||
private final MspMote mote;
|
||||
private final CC1101 cc1101;
|
||||
|
||||
private boolean isInterfered = false;
|
||||
private boolean isTransmitting = false;
|
||||
private boolean isReceiving = false;
|
||||
|
||||
private byte lastOutgoingByte;
|
||||
private byte lastIncomingByte;
|
||||
|
||||
private RadioPacket lastOutgoingPacket = null;
|
||||
private RadioPacket lastIncomingPacket = null;
|
||||
|
||||
public CC1101Radio(Mote m) {
|
||||
this.mote = (MspMote)m;
|
||||
Radio802154 r = this.mote.getCPU().getChip(Radio802154.class);
|
||||
if (r == null || !(r instanceof CC1101)) {
|
||||
throw new IllegalStateException("Mote is not equipped with an CC1101 radio");
|
||||
}
|
||||
this.cc1101 = (CC1101) r;
|
||||
|
||||
cc1101.addRFListener(new RFListener() {
|
||||
int len = 0;
|
||||
int expLen = 0;
|
||||
byte[] buffer = new byte[256 + 15];
|
||||
private boolean gotSynchbyte = false;
|
||||
public void receivedByte(byte data) {
|
||||
if (!isTransmitting()) {
|
||||
/* Start transmission */
|
||||
lastEvent = RadioEvent.TRANSMISSION_STARTED;
|
||||
isTransmitting = true;
|
||||
len = 0;
|
||||
gotSynchbyte = false;
|
||||
/*logger.debug("----- CC1101 TRANSMISSION STARTED -----");*/
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
if (len >= buffer.length) {
|
||||
/* Bad size packet, too large */
|
||||
logger.debug("Error: bad size: " + len + ", dropping outgoing byte: " + data);
|
||||
return;
|
||||
}
|
||||
|
||||
/* send this byte to all nodes */
|
||||
lastOutgoingByte = data;
|
||||
lastEvent = RadioEvent.CUSTOM_DATA_TRANSMITTED;
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
|
||||
/* Await synch byte */
|
||||
if (!gotSynchbyte) {
|
||||
if (lastOutgoingByte == CC1101.SYNCH_BYTE_LAST) {
|
||||
gotSynchbyte = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
final int HEADERLEN = 1; /* 1x Length byte */
|
||||
final int FOOTERLEN = 2; /* TODO Fix CRC in Mspsim's CC1101.java */
|
||||
if (len == 0) {
|
||||
expLen = (0xff&data) + HEADERLEN + FOOTERLEN;
|
||||
}
|
||||
buffer[len++] = data;
|
||||
|
||||
if (len == expLen) {
|
||||
/*logger.debug("----- CC1101 CUSTOM DATA TRANSMITTED -----");*/
|
||||
|
||||
final byte[] buf = new byte[expLen];
|
||||
System.arraycopy(buffer, 0, buf, 0, expLen);
|
||||
lastOutgoingPacket = new RadioPacket() {
|
||||
public byte[] getPacketData() {
|
||||
return buf;
|
||||
}
|
||||
};
|
||||
|
||||
lastEvent = RadioEvent.PACKET_TRANSMITTED;
|
||||
/*logger.debug("----- CC1101 PACKET TRANSMITTED -----");*/
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
|
||||
/*logger.debug("----- CC1101 TRANSMISSION FINISHED -----");*/
|
||||
isTransmitting = false;
|
||||
lastEvent = RadioEvent.TRANSMISSION_FINISHED;
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
len = 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
cc1101.setReceiverListener(new ReceiverListener() {
|
||||
public void newState(boolean on) {
|
||||
if (cc1101.isReadyToReceive()) {
|
||||
lastEvent = RadioEvent.HW_ON;
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
} else {
|
||||
radioOff();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
cc1101.addChannelListener(new ChannelListener() {
|
||||
public void channelChanged(int channel) {
|
||||
/* XXX Currently assumes zero channel switch time */
|
||||
lastEvent = RadioEvent.UNKNOWN;
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void radioOff() {
|
||||
/* Radio was turned off during transmission.
|
||||
* May for example happen if watchdog triggers */
|
||||
if (isTransmitting()) {
|
||||
logger.warn("Turning off radio while transmitting, ending packet prematurely");
|
||||
|
||||
/* Simulate end of packet */
|
||||
lastOutgoingPacket = new RadioPacket() {
|
||||
public byte[] getPacketData() {
|
||||
return new byte[0];
|
||||
}
|
||||
};
|
||||
|
||||
lastEvent = RadioEvent.PACKET_TRANSMITTED;
|
||||
/*logger.debug("----- CC1101 PACKET TRANSMITTED -----");*/
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
|
||||
/* Register that transmission ended in radio medium */
|
||||
/*logger.debug("----- CC1101 TRANSMISSION FINISHED -----");*/
|
||||
isTransmitting = false;
|
||||
lastEvent = RadioEvent.TRANSMISSION_FINISHED;
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
|
||||
lastEvent = RadioEvent.HW_OFF;
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
|
||||
/* Packet radio support */
|
||||
public RadioPacket getLastPacketTransmitted() {
|
||||
return lastOutgoingPacket;
|
||||
}
|
||||
|
||||
public RadioPacket getLastPacketReceived() {
|
||||
return lastIncomingPacket;
|
||||
}
|
||||
|
||||
public void setReceivedPacket(RadioPacket packet) {
|
||||
lastIncomingPacket = packet;
|
||||
|
||||
/* TODO XXX Need support in CC1101.java */
|
||||
/*if (!radio.isReadyToReceive()) {
|
||||
logger.warn("Radio receiver not ready, dropping packet data");
|
||||
return;
|
||||
}*/
|
||||
|
||||
/* Delivering packet bytes with delays */
|
||||
byte[] packetData = packet.getPacketData();
|
||||
long deliveryTime = getMote().getSimulation().getSimulationTime();
|
||||
for (byte b: packetData) {
|
||||
if (isInterfered()) {
|
||||
b = (byte) 0xFF;
|
||||
}
|
||||
|
||||
final byte byteToDeliver = b;
|
||||
getMote().getSimulation().scheduleEvent(new MspMoteTimeEvent(mote, 0) {
|
||||
public void execute(long t) {
|
||||
super.execute(t);
|
||||
cc1101.receivedByte(byteToDeliver);
|
||||
mote.requestImmediateWakeup();
|
||||
}
|
||||
}, deliveryTime);
|
||||
deliveryTime += DELAY_BETWEEN_BYTES;
|
||||
}
|
||||
}
|
||||
|
||||
/* Custom data radio support */
|
||||
public Object getLastCustomDataTransmitted() {
|
||||
return lastOutgoingByte;
|
||||
}
|
||||
|
||||
public Object getLastCustomDataReceived() {
|
||||
return lastIncomingByte;
|
||||
}
|
||||
|
||||
public void receiveCustomData(Object data) {
|
||||
if (!(data instanceof Byte)) {
|
||||
logger.fatal("Bad custom data: " + data);
|
||||
return;
|
||||
}
|
||||
lastIncomingByte = (Byte) data;
|
||||
|
||||
final byte inputByte;
|
||||
if (isInterfered()) {
|
||||
inputByte = (byte)0xFF;
|
||||
} else {
|
||||
inputByte = lastIncomingByte;
|
||||
}
|
||||
mote.getSimulation().scheduleEvent(new MspMoteTimeEvent(mote, 0) {
|
||||
public void execute(long t) {
|
||||
super.execute(t);
|
||||
cc1101.receivedByte(inputByte);
|
||||
mote.requestImmediateWakeup();
|
||||
}
|
||||
}, mote.getSimulation().getSimulationTime());
|
||||
|
||||
}
|
||||
|
||||
/* General radio support */
|
||||
public boolean isTransmitting() {
|
||||
return isTransmitting;
|
||||
}
|
||||
|
||||
public boolean isReceiving() {
|
||||
return isReceiving;
|
||||
}
|
||||
|
||||
public boolean isInterfered() {
|
||||
return isInterfered;
|
||||
}
|
||||
|
||||
public int getChannel() {
|
||||
return cc1101.getActiveChannel();
|
||||
}
|
||||
|
||||
public int getFrequency() {
|
||||
return cc1101.getActiveFrequency();
|
||||
}
|
||||
|
||||
public void signalReceptionStart() {
|
||||
isReceiving = true;
|
||||
|
||||
lastEvent = RadioEvent.RECEPTION_STARTED;
|
||||
/*logger.debug("----- CC1101 RECEPTION STARTED -----");*/
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
|
||||
public void signalReceptionEnd() {
|
||||
/* Deliver packet data */
|
||||
isReceiving = false;
|
||||
isInterfered = false;
|
||||
|
||||
lastEvent = RadioEvent.RECEPTION_FINISHED;
|
||||
/*logger.debug("----- CC1101 RECEPTION FINISHED -----");*/
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
|
||||
public RadioEvent getLastEvent() {
|
||||
return lastEvent;
|
||||
}
|
||||
|
||||
public void interfereAnyReception() {
|
||||
isInterfered = true;
|
||||
isReceiving = false;
|
||||
lastIncomingPacket = null;
|
||||
|
||||
lastEvent = RadioEvent.RECEPTION_INTERFERED;
|
||||
/*logger.debug("----- CC1101 RECEPTION INTERFERED -----");*/
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
|
||||
public double getCurrentOutputPower() {
|
||||
/* TODO XXX Need support in CC1101.java */
|
||||
return 1;
|
||||
}
|
||||
public int getCurrentOutputPowerIndicator() {
|
||||
/* TODO XXX Need support in CC1101.java */
|
||||
return 10;
|
||||
}
|
||||
public int getOutputPowerIndicatorMax() {
|
||||
/* TODO XXX Need support in CC1101.java */
|
||||
return 10;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Last 8 received signal strengths
|
||||
*/
|
||||
double currentSignalStrength = 0;
|
||||
private double[] rssiLast = new double[8];
|
||||
private int rssiLastCounter = 0;
|
||||
|
||||
public double getCurrentSignalStrength() {
|
||||
return currentSignalStrength;
|
||||
}
|
||||
|
||||
public void setCurrentSignalStrength(final double signalStrength) {
|
||||
if (signalStrength == currentSignalStrength) {
|
||||
return; /* ignored */
|
||||
}
|
||||
currentSignalStrength = signalStrength;
|
||||
if (rssiLastCounter == 0) {
|
||||
getMote().getSimulation().scheduleEvent(new MspMoteTimeEvent(mote, 0) {
|
||||
public void execute(long t) {
|
||||
super.execute(t);
|
||||
|
||||
/* Update average */
|
||||
System.arraycopy(rssiLast, 1, rssiLast, 0, 7);
|
||||
rssiLast[7] = currentSignalStrength;
|
||||
double avg = 0;
|
||||
for (double v: rssiLast) {
|
||||
avg += v;
|
||||
}
|
||||
avg /= rssiLast.length;
|
||||
|
||||
cc1101.setRSSI((int) avg);
|
||||
|
||||
rssiLastCounter--;
|
||||
if (rssiLastCounter > 0) {
|
||||
mote.getSimulation().scheduleEvent(this, t+DELAY_BETWEEN_BYTES/2);
|
||||
}
|
||||
}
|
||||
}, mote.getSimulation().getSimulationTime());
|
||||
}
|
||||
rssiLastCounter = 8;
|
||||
}
|
||||
|
||||
public Mote getMote() {
|
||||
return mote;
|
||||
}
|
||||
|
||||
public Position getPosition() {
|
||||
return mote.getInterfaces().getPosition();
|
||||
}
|
||||
|
||||
public Collection<Element> getConfigXML() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setConfigXML(Collection<Element> configXML, boolean visAvailable) {
|
||||
}
|
||||
|
||||
public boolean isRadioOn() {
|
||||
return cc1101.isReadyToReceive();
|
||||
}
|
||||
|
||||
public boolean canReceiveFrom(CustomDataRadio radio) {
|
||||
if (radio.getClass().equals(this.getClass())) {
|
||||
return true;
|
||||
}
|
||||
if (radio.getClass().equals(CC430Radio.class)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,421 +1,421 @@
|
|||
/*
|
||||
* Copyright (c) 2012, Thingsquare.
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.contikios.cooja.mspmote.interfaces;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.jdom.Element;
|
||||
|
||||
import org.contikios.cooja.ClassDescription;
|
||||
import org.contikios.cooja.Mote;
|
||||
import org.contikios.cooja.RadioPacket;
|
||||
import org.contikios.cooja.Simulation;
|
||||
import org.contikios.cooja.interfaces.CustomDataRadio;
|
||||
import org.contikios.cooja.interfaces.Position;
|
||||
import org.contikios.cooja.interfaces.Radio;
|
||||
import org.contikios.cooja.mspmote.MspMote;
|
||||
import org.contikios.cooja.mspmote.MspMoteTimeEvent;
|
||||
import se.sics.mspsim.chip.CC1120;
|
||||
import se.sics.mspsim.chip.CC1120.ReceiverListener;
|
||||
import se.sics.mspsim.chip.ChannelListener;
|
||||
import se.sics.mspsim.chip.RFListener;
|
||||
import se.sics.mspsim.chip.Radio802154;
|
||||
|
||||
/**
|
||||
* @author Fredrik Osterlind
|
||||
*/
|
||||
@ClassDescription("TI CC1120")
|
||||
public class CC1120Radio extends Radio implements CustomDataRadio {
|
||||
private static Logger logger = Logger.getLogger(CC1120Radio.class);
|
||||
|
||||
/**
|
||||
* Cross-level:
|
||||
* Inter-byte delay for delivering cross-level packet bytes.
|
||||
*/
|
||||
/* TODO XXX Fix me as well as symbol duration in CC1120.java */
|
||||
public static final long DELAY_BETWEEN_BYTES =
|
||||
(long) (1000.0*Simulation.MILLISECOND/(200000.0/8.0)); /* us. Corresponds to 200kbit/s */
|
||||
|
||||
private RadioEvent lastEvent = RadioEvent.UNKNOWN;
|
||||
|
||||
private final MspMote mote;
|
||||
private final CC1120 cc1120;
|
||||
|
||||
private boolean isInterfered = false;
|
||||
private boolean isTransmitting = false;
|
||||
private boolean isReceiving = false;
|
||||
|
||||
private byte lastOutgoingByte;
|
||||
private byte lastIncomingByte;
|
||||
|
||||
private RadioPacket lastOutgoingPacket = null;
|
||||
private RadioPacket lastIncomingPacket = null;
|
||||
|
||||
public CC1120Radio(Mote m) {
|
||||
this.mote = (MspMote)m;
|
||||
Radio802154 r = this.mote.getCPU().getChip(Radio802154.class);
|
||||
if (r == null || !(r instanceof CC1120)) {
|
||||
throw new IllegalStateException("Mote is not equipped with an CC1120 radio");
|
||||
}
|
||||
this.cc1120 = (CC1120) r;
|
||||
|
||||
cc1120.addRFListener(new RFListener() {
|
||||
int len = 0;
|
||||
int expLen = 0;
|
||||
byte[] buffer = new byte[256 + 15];
|
||||
private boolean gotSynchbyte = false;
|
||||
public void receivedByte(byte data) {
|
||||
if (!isTransmitting()) {
|
||||
/* Start transmission */
|
||||
lastEvent = RadioEvent.TRANSMISSION_STARTED;
|
||||
isTransmitting = true;
|
||||
len = 0;
|
||||
gotSynchbyte = false;
|
||||
/*logger.debug("----- CCC1120 TRANSMISSION STARTED -----");*/
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
if (len >= buffer.length) {
|
||||
/* Bad size packet, too large */
|
||||
logger.debug("Error: bad size: " + len + ", dropping outgoing byte: " + data);
|
||||
return;
|
||||
}
|
||||
|
||||
/* send this byte to all nodes */
|
||||
lastOutgoingByte = data;
|
||||
lastEvent = RadioEvent.CUSTOM_DATA_TRANSMITTED;
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
|
||||
/* Await synch byte */
|
||||
if (!gotSynchbyte) {
|
||||
if (lastOutgoingByte == CC1120.SYNCH_BYTE_LAST) {
|
||||
gotSynchbyte = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
final int HEADERLEN = 1; /* 1x Length byte */
|
||||
final int FOOTERLEN = 2; /* TODO Fix CRC in Mspsim's CCC1120.java */
|
||||
if (len == 0) {
|
||||
expLen = (0xff&data) + HEADERLEN + FOOTERLEN;
|
||||
}
|
||||
buffer[len++] = data;
|
||||
|
||||
if (len == expLen) {
|
||||
/*logger.debug("----- CCC1120 CUSTOM DATA TRANSMITTED -----");*/
|
||||
|
||||
final byte[] buf = new byte[expLen];
|
||||
System.arraycopy(buffer, 0, buf, 0, expLen);
|
||||
lastOutgoingPacket = new RadioPacket() {
|
||||
public byte[] getPacketData() {
|
||||
return buf;
|
||||
}
|
||||
};
|
||||
|
||||
lastEvent = RadioEvent.PACKET_TRANSMITTED;
|
||||
/*logger.debug("----- CCC1120 PACKET TRANSMITTED -----");*/
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
|
||||
/*logger.debug("----- CCC1120 TRANSMISSION FINISHED -----");*/
|
||||
isTransmitting = false;
|
||||
lastEvent = RadioEvent.TRANSMISSION_FINISHED;
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
len = 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
cc1120.setReceiverListener(new ReceiverListener() {
|
||||
public void newState(boolean on) {
|
||||
if (cc1120.isReadyToReceive()) {
|
||||
lastEvent = RadioEvent.HW_ON;
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
} else {
|
||||
radioOff();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
cc1120.addChannelListener(new ChannelListener() {
|
||||
public void channelChanged(int channel) {
|
||||
/* XXX Currently assumes zero channel switch time */
|
||||
lastEvent = RadioEvent.UNKNOWN;
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void radioOff() {
|
||||
/* Radio was turned off during transmission.
|
||||
* May for example happen if watchdog triggers */
|
||||
if (isTransmitting()) {
|
||||
logger.warn("Turning off radio while transmitting, ending packet prematurely");
|
||||
|
||||
/* Simulate end of packet */
|
||||
lastOutgoingPacket = new RadioPacket() {
|
||||
public byte[] getPacketData() {
|
||||
return new byte[0];
|
||||
}
|
||||
};
|
||||
|
||||
lastEvent = RadioEvent.PACKET_TRANSMITTED;
|
||||
/*logger.debug("----- CCC1120 PACKET TRANSMITTED -----");*/
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
|
||||
/* Register that transmission ended in radio medium */
|
||||
/*logger.debug("----- CCC1120 TRANSMISSION FINISHED -----");*/
|
||||
isTransmitting = false;
|
||||
lastEvent = RadioEvent.TRANSMISSION_FINISHED;
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
|
||||
lastEvent = RadioEvent.HW_OFF;
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
|
||||
/* Packet radio support */
|
||||
public RadioPacket getLastPacketTransmitted() {
|
||||
return lastOutgoingPacket;
|
||||
}
|
||||
|
||||
public RadioPacket getLastPacketReceived() {
|
||||
return lastIncomingPacket;
|
||||
}
|
||||
|
||||
public void setReceivedPacket(RadioPacket packet) {
|
||||
lastIncomingPacket = packet;
|
||||
|
||||
/* TODO XXX Need support in CCC1120.java */
|
||||
/*if (!radio.isReadyToReceive()) {
|
||||
logger.warn("Radio receiver not ready, dropping packet data");
|
||||
return;
|
||||
}*/
|
||||
|
||||
/* Delivering packet bytes with delays */
|
||||
byte[] packetData = packet.getPacketData();
|
||||
long deliveryTime = getMote().getSimulation().getSimulationTime();
|
||||
for (byte b: packetData) {
|
||||
if (isInterfered()) {
|
||||
b = (byte) 0xFF;
|
||||
}
|
||||
|
||||
final byte byteToDeliver = b;
|
||||
getMote().getSimulation().scheduleEvent(new MspMoteTimeEvent(mote, 0) {
|
||||
public void execute(long t) {
|
||||
super.execute(t);
|
||||
cc1120.receivedByte(byteToDeliver);
|
||||
mote.requestImmediateWakeup();
|
||||
}
|
||||
}, deliveryTime);
|
||||
deliveryTime += DELAY_BETWEEN_BYTES;
|
||||
}
|
||||
}
|
||||
|
||||
/* Custom data radio support */
|
||||
public Object getLastCustomDataTransmitted() {
|
||||
return lastOutgoingByte;
|
||||
}
|
||||
|
||||
public Object getLastCustomDataReceived() {
|
||||
return lastIncomingByte;
|
||||
}
|
||||
|
||||
public void receiveCustomData(Object data) {
|
||||
if (!(data instanceof Byte)) {
|
||||
logger.fatal("Bad custom data: " + data);
|
||||
return;
|
||||
}
|
||||
lastIncomingByte = (Byte) data;
|
||||
|
||||
final byte inputByte;
|
||||
if (isInterfered()) {
|
||||
inputByte = (byte)0xFF;
|
||||
} else {
|
||||
inputByte = lastIncomingByte;
|
||||
}
|
||||
mote.getSimulation().scheduleEvent(new MspMoteTimeEvent(mote, 0) {
|
||||
public void execute(long t) {
|
||||
super.execute(t);
|
||||
cc1120.receivedByte(inputByte);
|
||||
mote.requestImmediateWakeup();
|
||||
}
|
||||
}, mote.getSimulation().getSimulationTime());
|
||||
|
||||
}
|
||||
|
||||
/* General radio support */
|
||||
public boolean isTransmitting() {
|
||||
return isTransmitting;
|
||||
}
|
||||
|
||||
public boolean isReceiving() {
|
||||
return isReceiving;
|
||||
}
|
||||
|
||||
public boolean isInterfered() {
|
||||
return isInterfered;
|
||||
}
|
||||
|
||||
public int getChannel() {
|
||||
return cc1120.getActiveChannel()+1000;
|
||||
}
|
||||
|
||||
public int getFrequency() {
|
||||
return cc1120.getActiveFrequency();
|
||||
}
|
||||
|
||||
public void signalReceptionStart() {
|
||||
isReceiving = true;
|
||||
|
||||
lastEvent = RadioEvent.RECEPTION_STARTED;
|
||||
/*logger.debug("----- CCC1120 RECEPTION STARTED -----");*/
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
|
||||
public void signalReceptionEnd() {
|
||||
/* Deliver packet data */
|
||||
isReceiving = false;
|
||||
isInterfered = false;
|
||||
|
||||
lastEvent = RadioEvent.RECEPTION_FINISHED;
|
||||
/*logger.debug("----- CCC1120 RECEPTION FINISHED -----");*/
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
|
||||
public RadioEvent getLastEvent() {
|
||||
return lastEvent;
|
||||
}
|
||||
|
||||
public void interfereAnyReception() {
|
||||
isInterfered = true;
|
||||
isReceiving = false;
|
||||
lastIncomingPacket = null;
|
||||
|
||||
lastEvent = RadioEvent.RECEPTION_INTERFERED;
|
||||
/*logger.debug("----- CCC1120 RECEPTION INTERFERED -----");*/
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
|
||||
public double getCurrentOutputPower() {
|
||||
/* TODO XXX Need support in CCC1120.java */
|
||||
return 1;
|
||||
}
|
||||
public int getCurrentOutputPowerIndicator() {
|
||||
/* TODO XXX Need support in CCC1120.java */
|
||||
return 10;
|
||||
}
|
||||
public int getOutputPowerIndicatorMax() {
|
||||
/* TODO XXX Need support in CCC1120.java */
|
||||
return 10;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Last 8 received signal strengths
|
||||
*/
|
||||
double currentSignalStrength = 0;
|
||||
private double[] rssiLast = new double[8];
|
||||
private int rssiLastCounter = 0;
|
||||
|
||||
public double getCurrentSignalStrength() {
|
||||
return currentSignalStrength;
|
||||
}
|
||||
|
||||
public void setCurrentSignalStrength(final double signalStrength) {
|
||||
if (signalStrength == currentSignalStrength) {
|
||||
return; /* ignored */
|
||||
}
|
||||
currentSignalStrength = signalStrength;
|
||||
if (rssiLastCounter == 0) {
|
||||
getMote().getSimulation().scheduleEvent(new MspMoteTimeEvent(mote, 0) {
|
||||
public void execute(long t) {
|
||||
super.execute(t);
|
||||
|
||||
/* Update average */
|
||||
System.arraycopy(rssiLast, 1, rssiLast, 0, 7);
|
||||
rssiLast[7] = currentSignalStrength;
|
||||
double avg = 0;
|
||||
for (double v: rssiLast) {
|
||||
avg += v;
|
||||
}
|
||||
avg /= rssiLast.length;
|
||||
|
||||
cc1120.setRSSI((int) avg);
|
||||
|
||||
rssiLastCounter--;
|
||||
if (rssiLastCounter > 0) {
|
||||
mote.getSimulation().scheduleEvent(this, t+DELAY_BETWEEN_BYTES/2);
|
||||
}
|
||||
}
|
||||
}, mote.getSimulation().getSimulationTime());
|
||||
}
|
||||
rssiLastCounter = 8;
|
||||
}
|
||||
|
||||
public Mote getMote() {
|
||||
return mote;
|
||||
}
|
||||
|
||||
public Position getPosition() {
|
||||
return mote.getInterfaces().getPosition();
|
||||
}
|
||||
|
||||
public Collection<Element> getConfigXML() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setConfigXML(Collection<Element> configXML, boolean visAvailable) {
|
||||
}
|
||||
|
||||
public boolean isRadioOn() {
|
||||
return cc1120.isReadyToReceive();
|
||||
}
|
||||
|
||||
public boolean canReceiveFrom(CustomDataRadio radio) {
|
||||
if (radio.getClass().equals(this.getClass())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* Copyright (c) 2012, Thingsquare.
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.contikios.cooja.mspmote.interfaces;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.jdom.Element;
|
||||
|
||||
import org.contikios.cooja.ClassDescription;
|
||||
import org.contikios.cooja.Mote;
|
||||
import org.contikios.cooja.RadioPacket;
|
||||
import org.contikios.cooja.Simulation;
|
||||
import org.contikios.cooja.interfaces.CustomDataRadio;
|
||||
import org.contikios.cooja.interfaces.Position;
|
||||
import org.contikios.cooja.interfaces.Radio;
|
||||
import org.contikios.cooja.mspmote.MspMote;
|
||||
import org.contikios.cooja.mspmote.MspMoteTimeEvent;
|
||||
import se.sics.mspsim.chip.CC1120;
|
||||
import se.sics.mspsim.chip.CC1120.ReceiverListener;
|
||||
import se.sics.mspsim.chip.ChannelListener;
|
||||
import se.sics.mspsim.chip.RFListener;
|
||||
import se.sics.mspsim.chip.Radio802154;
|
||||
|
||||
/**
|
||||
* @author Fredrik Osterlind
|
||||
*/
|
||||
@ClassDescription("TI CC1120")
|
||||
public class CC1120Radio extends Radio implements CustomDataRadio {
|
||||
private static Logger logger = Logger.getLogger(CC1120Radio.class);
|
||||
|
||||
/**
|
||||
* Cross-level:
|
||||
* Inter-byte delay for delivering cross-level packet bytes.
|
||||
*/
|
||||
/* TODO XXX Fix me as well as symbol duration in CC1120.java */
|
||||
public static final long DELAY_BETWEEN_BYTES =
|
||||
(long) (1000.0*Simulation.MILLISECOND/(200000.0/8.0)); /* us. Corresponds to 200kbit/s */
|
||||
|
||||
private RadioEvent lastEvent = RadioEvent.UNKNOWN;
|
||||
|
||||
private final MspMote mote;
|
||||
private final CC1120 cc1120;
|
||||
|
||||
private boolean isInterfered = false;
|
||||
private boolean isTransmitting = false;
|
||||
private boolean isReceiving = false;
|
||||
|
||||
private byte lastOutgoingByte;
|
||||
private byte lastIncomingByte;
|
||||
|
||||
private RadioPacket lastOutgoingPacket = null;
|
||||
private RadioPacket lastIncomingPacket = null;
|
||||
|
||||
public CC1120Radio(Mote m) {
|
||||
this.mote = (MspMote)m;
|
||||
Radio802154 r = this.mote.getCPU().getChip(Radio802154.class);
|
||||
if (r == null || !(r instanceof CC1120)) {
|
||||
throw new IllegalStateException("Mote is not equipped with an CC1120 radio");
|
||||
}
|
||||
this.cc1120 = (CC1120) r;
|
||||
|
||||
cc1120.addRFListener(new RFListener() {
|
||||
int len = 0;
|
||||
int expLen = 0;
|
||||
byte[] buffer = new byte[256 + 15];
|
||||
private boolean gotSynchbyte = false;
|
||||
public void receivedByte(byte data) {
|
||||
if (!isTransmitting()) {
|
||||
/* Start transmission */
|
||||
lastEvent = RadioEvent.TRANSMISSION_STARTED;
|
||||
isTransmitting = true;
|
||||
len = 0;
|
||||
gotSynchbyte = false;
|
||||
/*logger.debug("----- CCC1120 TRANSMISSION STARTED -----");*/
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
if (len >= buffer.length) {
|
||||
/* Bad size packet, too large */
|
||||
logger.debug("Error: bad size: " + len + ", dropping outgoing byte: " + data);
|
||||
return;
|
||||
}
|
||||
|
||||
/* send this byte to all nodes */
|
||||
lastOutgoingByte = data;
|
||||
lastEvent = RadioEvent.CUSTOM_DATA_TRANSMITTED;
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
|
||||
/* Await synch byte */
|
||||
if (!gotSynchbyte) {
|
||||
if (lastOutgoingByte == CC1120.SYNCH_BYTE_LAST) {
|
||||
gotSynchbyte = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
final int HEADERLEN = 1; /* 1x Length byte */
|
||||
final int FOOTERLEN = 2; /* TODO Fix CRC in Mspsim's CCC1120.java */
|
||||
if (len == 0) {
|
||||
expLen = (0xff&data) + HEADERLEN + FOOTERLEN;
|
||||
}
|
||||
buffer[len++] = data;
|
||||
|
||||
if (len == expLen) {
|
||||
/*logger.debug("----- CCC1120 CUSTOM DATA TRANSMITTED -----");*/
|
||||
|
||||
final byte[] buf = new byte[expLen];
|
||||
System.arraycopy(buffer, 0, buf, 0, expLen);
|
||||
lastOutgoingPacket = new RadioPacket() {
|
||||
public byte[] getPacketData() {
|
||||
return buf;
|
||||
}
|
||||
};
|
||||
|
||||
lastEvent = RadioEvent.PACKET_TRANSMITTED;
|
||||
/*logger.debug("----- CCC1120 PACKET TRANSMITTED -----");*/
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
|
||||
/*logger.debug("----- CCC1120 TRANSMISSION FINISHED -----");*/
|
||||
isTransmitting = false;
|
||||
lastEvent = RadioEvent.TRANSMISSION_FINISHED;
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
len = 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
cc1120.setReceiverListener(new ReceiverListener() {
|
||||
public void newState(boolean on) {
|
||||
if (cc1120.isReadyToReceive()) {
|
||||
lastEvent = RadioEvent.HW_ON;
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
} else {
|
||||
radioOff();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
cc1120.addChannelListener(new ChannelListener() {
|
||||
public void channelChanged(int channel) {
|
||||
/* XXX Currently assumes zero channel switch time */
|
||||
lastEvent = RadioEvent.UNKNOWN;
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void radioOff() {
|
||||
/* Radio was turned off during transmission.
|
||||
* May for example happen if watchdog triggers */
|
||||
if (isTransmitting()) {
|
||||
logger.warn("Turning off radio while transmitting, ending packet prematurely");
|
||||
|
||||
/* Simulate end of packet */
|
||||
lastOutgoingPacket = new RadioPacket() {
|
||||
public byte[] getPacketData() {
|
||||
return new byte[0];
|
||||
}
|
||||
};
|
||||
|
||||
lastEvent = RadioEvent.PACKET_TRANSMITTED;
|
||||
/*logger.debug("----- CCC1120 PACKET TRANSMITTED -----");*/
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
|
||||
/* Register that transmission ended in radio medium */
|
||||
/*logger.debug("----- CCC1120 TRANSMISSION FINISHED -----");*/
|
||||
isTransmitting = false;
|
||||
lastEvent = RadioEvent.TRANSMISSION_FINISHED;
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
|
||||
lastEvent = RadioEvent.HW_OFF;
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
|
||||
/* Packet radio support */
|
||||
public RadioPacket getLastPacketTransmitted() {
|
||||
return lastOutgoingPacket;
|
||||
}
|
||||
|
||||
public RadioPacket getLastPacketReceived() {
|
||||
return lastIncomingPacket;
|
||||
}
|
||||
|
||||
public void setReceivedPacket(RadioPacket packet) {
|
||||
lastIncomingPacket = packet;
|
||||
|
||||
/* TODO XXX Need support in CCC1120.java */
|
||||
/*if (!radio.isReadyToReceive()) {
|
||||
logger.warn("Radio receiver not ready, dropping packet data");
|
||||
return;
|
||||
}*/
|
||||
|
||||
/* Delivering packet bytes with delays */
|
||||
byte[] packetData = packet.getPacketData();
|
||||
long deliveryTime = getMote().getSimulation().getSimulationTime();
|
||||
for (byte b: packetData) {
|
||||
if (isInterfered()) {
|
||||
b = (byte) 0xFF;
|
||||
}
|
||||
|
||||
final byte byteToDeliver = b;
|
||||
getMote().getSimulation().scheduleEvent(new MspMoteTimeEvent(mote, 0) {
|
||||
public void execute(long t) {
|
||||
super.execute(t);
|
||||
cc1120.receivedByte(byteToDeliver);
|
||||
mote.requestImmediateWakeup();
|
||||
}
|
||||
}, deliveryTime);
|
||||
deliveryTime += DELAY_BETWEEN_BYTES;
|
||||
}
|
||||
}
|
||||
|
||||
/* Custom data radio support */
|
||||
public Object getLastCustomDataTransmitted() {
|
||||
return lastOutgoingByte;
|
||||
}
|
||||
|
||||
public Object getLastCustomDataReceived() {
|
||||
return lastIncomingByte;
|
||||
}
|
||||
|
||||
public void receiveCustomData(Object data) {
|
||||
if (!(data instanceof Byte)) {
|
||||
logger.fatal("Bad custom data: " + data);
|
||||
return;
|
||||
}
|
||||
lastIncomingByte = (Byte) data;
|
||||
|
||||
final byte inputByte;
|
||||
if (isInterfered()) {
|
||||
inputByte = (byte)0xFF;
|
||||
} else {
|
||||
inputByte = lastIncomingByte;
|
||||
}
|
||||
mote.getSimulation().scheduleEvent(new MspMoteTimeEvent(mote, 0) {
|
||||
public void execute(long t) {
|
||||
super.execute(t);
|
||||
cc1120.receivedByte(inputByte);
|
||||
mote.requestImmediateWakeup();
|
||||
}
|
||||
}, mote.getSimulation().getSimulationTime());
|
||||
|
||||
}
|
||||
|
||||
/* General radio support */
|
||||
public boolean isTransmitting() {
|
||||
return isTransmitting;
|
||||
}
|
||||
|
||||
public boolean isReceiving() {
|
||||
return isReceiving;
|
||||
}
|
||||
|
||||
public boolean isInterfered() {
|
||||
return isInterfered;
|
||||
}
|
||||
|
||||
public int getChannel() {
|
||||
return cc1120.getActiveChannel()+1000;
|
||||
}
|
||||
|
||||
public int getFrequency() {
|
||||
return cc1120.getActiveFrequency();
|
||||
}
|
||||
|
||||
public void signalReceptionStart() {
|
||||
isReceiving = true;
|
||||
|
||||
lastEvent = RadioEvent.RECEPTION_STARTED;
|
||||
/*logger.debug("----- CCC1120 RECEPTION STARTED -----");*/
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
|
||||
public void signalReceptionEnd() {
|
||||
/* Deliver packet data */
|
||||
isReceiving = false;
|
||||
isInterfered = false;
|
||||
|
||||
lastEvent = RadioEvent.RECEPTION_FINISHED;
|
||||
/*logger.debug("----- CCC1120 RECEPTION FINISHED -----");*/
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
|
||||
public RadioEvent getLastEvent() {
|
||||
return lastEvent;
|
||||
}
|
||||
|
||||
public void interfereAnyReception() {
|
||||
isInterfered = true;
|
||||
isReceiving = false;
|
||||
lastIncomingPacket = null;
|
||||
|
||||
lastEvent = RadioEvent.RECEPTION_INTERFERED;
|
||||
/*logger.debug("----- CCC1120 RECEPTION INTERFERED -----");*/
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
|
||||
public double getCurrentOutputPower() {
|
||||
/* TODO XXX Need support in CCC1120.java */
|
||||
return 1;
|
||||
}
|
||||
public int getCurrentOutputPowerIndicator() {
|
||||
/* TODO XXX Need support in CCC1120.java */
|
||||
return 10;
|
||||
}
|
||||
public int getOutputPowerIndicatorMax() {
|
||||
/* TODO XXX Need support in CCC1120.java */
|
||||
return 10;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Last 8 received signal strengths
|
||||
*/
|
||||
double currentSignalStrength = 0;
|
||||
private double[] rssiLast = new double[8];
|
||||
private int rssiLastCounter = 0;
|
||||
|
||||
public double getCurrentSignalStrength() {
|
||||
return currentSignalStrength;
|
||||
}
|
||||
|
||||
public void setCurrentSignalStrength(final double signalStrength) {
|
||||
if (signalStrength == currentSignalStrength) {
|
||||
return; /* ignored */
|
||||
}
|
||||
currentSignalStrength = signalStrength;
|
||||
if (rssiLastCounter == 0) {
|
||||
getMote().getSimulation().scheduleEvent(new MspMoteTimeEvent(mote, 0) {
|
||||
public void execute(long t) {
|
||||
super.execute(t);
|
||||
|
||||
/* Update average */
|
||||
System.arraycopy(rssiLast, 1, rssiLast, 0, 7);
|
||||
rssiLast[7] = currentSignalStrength;
|
||||
double avg = 0;
|
||||
for (double v: rssiLast) {
|
||||
avg += v;
|
||||
}
|
||||
avg /= rssiLast.length;
|
||||
|
||||
cc1120.setRSSI((int) avg);
|
||||
|
||||
rssiLastCounter--;
|
||||
if (rssiLastCounter > 0) {
|
||||
mote.getSimulation().scheduleEvent(this, t+DELAY_BETWEEN_BYTES/2);
|
||||
}
|
||||
}
|
||||
}, mote.getSimulation().getSimulationTime());
|
||||
}
|
||||
rssiLastCounter = 8;
|
||||
}
|
||||
|
||||
public Mote getMote() {
|
||||
return mote;
|
||||
}
|
||||
|
||||
public Position getPosition() {
|
||||
return mote.getInterfaces().getPosition();
|
||||
}
|
||||
|
||||
public Collection<Element> getConfigXML() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setConfigXML(Collection<Element> configXML, boolean visAvailable) {
|
||||
}
|
||||
|
||||
public boolean isRadioOn() {
|
||||
return cc1120.isReadyToReceive();
|
||||
}
|
||||
|
||||
public boolean canReceiveFrom(CustomDataRadio radio) {
|
||||
if (radio.getClass().equals(this.getClass())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,378 +1,378 @@
|
|||
|
||||
package org.contikios.cooja.mspmote.interfaces;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.jdom.Element;
|
||||
|
||||
import org.contikios.cooja.ClassDescription;
|
||||
import org.contikios.cooja.Mote;
|
||||
import org.contikios.cooja.RadioPacket;
|
||||
import org.contikios.cooja.Simulation;
|
||||
import org.contikios.cooja.interfaces.CustomDataRadio;
|
||||
import org.contikios.cooja.interfaces.Position;
|
||||
import org.contikios.cooja.interfaces.Radio;
|
||||
import org.contikios.cooja.mspmote.MspMote;
|
||||
import org.contikios.cooja.mspmote.MspMoteTimeEvent;
|
||||
import org.contikios.cooja.mspmote.interfaces.CC2420RadioPacketConverter;
|
||||
import se.sics.mspsim.chip.CC2520;
|
||||
import se.sics.mspsim.chip.ChannelListener;
|
||||
import se.sics.mspsim.chip.RFListener;
|
||||
import se.sics.mspsim.core.Chip;
|
||||
import se.sics.mspsim.core.OperatingModeListener;
|
||||
|
||||
/**
|
||||
* MSPSim CC2520 radio to COOJA wrapper.
|
||||
*
|
||||
* @author Fredrik Osterlind
|
||||
*/
|
||||
@ClassDescription("IEEE CC2520 Radio")
|
||||
public class CC2520Radio extends Radio implements CustomDataRadio {
|
||||
private static Logger logger = Logger.getLogger(CC2520Radio.class);
|
||||
|
||||
/**
|
||||
* Cross-level:
|
||||
* Inter-byte delay for delivering cross-level packet bytes.
|
||||
*/
|
||||
public static final long DELAY_BETWEEN_BYTES =
|
||||
(long) (1000.0*Simulation.MILLISECOND/(250000.0/8.0)); /* us. Corresponds to 250kbit/s */
|
||||
|
||||
private RadioEvent lastEvent = RadioEvent.UNKNOWN;
|
||||
|
||||
private final MspMote mote;
|
||||
private final CC2520 radio;
|
||||
|
||||
private boolean isInterfered = false;
|
||||
private boolean isTransmitting = false;
|
||||
private boolean isReceiving = false;
|
||||
|
||||
private byte lastOutgoingByte;
|
||||
private byte lastIncomingByte;
|
||||
|
||||
private RadioPacket lastOutgoingPacket = null;
|
||||
private RadioPacket lastIncomingPacket = null;
|
||||
|
||||
public CC2520Radio(Mote m) {
|
||||
this.mote = (MspMote)m;
|
||||
this.radio = this.mote.getCPU().getChip(CC2520.class);
|
||||
if (radio == null) {
|
||||
throw new IllegalStateException("Mote is not equipped with an IEEE CC2520 radio");
|
||||
}
|
||||
|
||||
radio.addRFListener(new RFListener() {
|
||||
int len = 0;
|
||||
int expLen = 0;
|
||||
byte[] buffer = new byte[127 + 15];
|
||||
public void receivedByte(byte data) {
|
||||
if (!isTransmitting()) {
|
||||
lastEvent = RadioEvent.TRANSMISSION_STARTED;
|
||||
isTransmitting = true;
|
||||
len = 0;
|
||||
/*logger.debug("----- CC2520 TRANSMISSION STARTED -----");*/
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
|
||||
if (len >= buffer.length) {
|
||||
/* Bad size packet, too large */
|
||||
logger.debug("Error: bad size: " + len + ", dropping outgoing byte: " + data);
|
||||
return;
|
||||
}
|
||||
|
||||
/* send this byte to all nodes */
|
||||
lastOutgoingByte = data;
|
||||
lastEvent = RadioEvent.CUSTOM_DATA_TRANSMITTED;
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
|
||||
buffer[len++] = data;
|
||||
|
||||
if (len == 6) {
|
||||
// System.out.println("## CC2520 Packet of length: " + data + " expected...");
|
||||
expLen = data + 6;
|
||||
}
|
||||
|
||||
if (len == expLen) {
|
||||
/*logger.debug("----- CC2520 CUSTOM DATA TRANSMITTED -----");*/
|
||||
len -= 4; /* preamble */
|
||||
len -= 1; /* synch */
|
||||
len -= radio.getFooterLength(); /* footer */
|
||||
final byte[] packetdata = new byte[len];
|
||||
System.arraycopy(buffer, 4+1, packetdata, 0, len);
|
||||
lastOutgoingPacket = new RadioPacket() {
|
||||
public byte[] getPacketData() {
|
||||
return packetdata;
|
||||
}
|
||||
};
|
||||
|
||||
/*logger.debug("----- CC2520 PACKET TRANSMITTED -----");*/
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
|
||||
/*logger.debug("----- CC2520 TRANSMISSION FINISHED -----");*/
|
||||
isTransmitting = false;
|
||||
lastEvent = RadioEvent.TRANSMISSION_FINISHED;
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
len = 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
radio.addOperatingModeListener(new OperatingModeListener() {
|
||||
public void modeChanged(Chip source, int mode) {
|
||||
if (radio.isReadyToReceive()) {
|
||||
lastEvent = RadioEvent.HW_ON;
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
} else {
|
||||
radioOff();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
radio.addChannelListener(new ChannelListener() {
|
||||
public void channelChanged(int channel) {
|
||||
/* XXX Currently assumes zero channel switch time */
|
||||
lastEvent = RadioEvent.UNKNOWN;
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void radioOff() {
|
||||
/* Radio was turned off during transmission.
|
||||
* May for example happen if watchdog triggers */
|
||||
if (isTransmitting()) {
|
||||
logger.warn("Turning off radio while transmitting, ending packet prematurely");
|
||||
|
||||
/* Simulate end of packet */
|
||||
lastOutgoingPacket = new RadioPacket() {
|
||||
public byte[] getPacketData() {
|
||||
return new byte[0];
|
||||
}
|
||||
};
|
||||
|
||||
lastEvent = RadioEvent.PACKET_TRANSMITTED;
|
||||
/*logger.debug("----- CC2520 PACKET TRANSMITTED -----");*/
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
|
||||
/* Register that transmission ended in radio medium */
|
||||
/*logger.debug("----- CC2520 TRANSMISSION FINISHED -----");*/
|
||||
isTransmitting = false;
|
||||
lastEvent = RadioEvent.TRANSMISSION_FINISHED;
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
|
||||
lastEvent = RadioEvent.HW_OFF;
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
|
||||
/* Packet radio support */
|
||||
public RadioPacket getLastPacketTransmitted() {
|
||||
return lastOutgoingPacket;
|
||||
}
|
||||
|
||||
public RadioPacket getLastPacketReceived() {
|
||||
return lastIncomingPacket;
|
||||
}
|
||||
|
||||
public void setReceivedPacket(RadioPacket packet) {
|
||||
logger.fatal("TODO Implement me!");
|
||||
}
|
||||
|
||||
/* Custom data radio support */
|
||||
public Object getLastCustomDataTransmitted() {
|
||||
return lastOutgoingByte;
|
||||
}
|
||||
|
||||
public Object getLastCustomDataReceived() {
|
||||
return lastIncomingByte;
|
||||
}
|
||||
|
||||
public void receiveCustomData(Object data) {
|
||||
if (!(data instanceof Byte)) {
|
||||
logger.fatal("Bad custom data: " + data);
|
||||
return;
|
||||
}
|
||||
lastIncomingByte = (Byte) data;
|
||||
|
||||
final byte inputByte;
|
||||
if (isInterfered()) {
|
||||
inputByte = (byte)0xFF;
|
||||
} else {
|
||||
inputByte = lastIncomingByte;
|
||||
}
|
||||
mote.getSimulation().scheduleEvent(new MspMoteTimeEvent(mote, 0) {
|
||||
public void execute(long t) {
|
||||
super.execute(t);
|
||||
radio.receivedByte(inputByte);
|
||||
mote.requestImmediateWakeup();
|
||||
}
|
||||
}, mote.getSimulation().getSimulationTime());
|
||||
|
||||
}
|
||||
|
||||
/* General radio support */
|
||||
public boolean isTransmitting() {
|
||||
return isTransmitting;
|
||||
}
|
||||
|
||||
public boolean isReceiving() {
|
||||
return isReceiving;
|
||||
}
|
||||
|
||||
public boolean isInterfered() {
|
||||
return isInterfered;
|
||||
}
|
||||
|
||||
public int getChannel() {
|
||||
return radio.getActiveChannel();
|
||||
}
|
||||
|
||||
public int getFrequency() {
|
||||
return radio.getActiveFrequency();
|
||||
}
|
||||
|
||||
public void signalReceptionStart() {
|
||||
isReceiving = true;
|
||||
|
||||
lastEvent = RadioEvent.RECEPTION_STARTED;
|
||||
/*logger.debug("----- CC2520 RECEPTION STARTED -----");*/
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
|
||||
public void signalReceptionEnd() {
|
||||
/* Deliver packet data */
|
||||
isReceiving = false;
|
||||
isInterfered = false;
|
||||
|
||||
lastEvent = RadioEvent.RECEPTION_FINISHED;
|
||||
/*logger.debug("----- CC2520 RECEPTION FINISHED -----");*/
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
|
||||
public RadioEvent getLastEvent() {
|
||||
return lastEvent;
|
||||
}
|
||||
|
||||
public void interfereAnyReception() {
|
||||
isInterfered = true;
|
||||
isReceiving = false;
|
||||
lastIncomingPacket = null;
|
||||
|
||||
lastEvent = RadioEvent.RECEPTION_INTERFERED;
|
||||
/*logger.debug("----- CC2520 RECEPTION INTERFERED -----");*/
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
|
||||
public double getCurrentOutputPower() {
|
||||
return radio.getOutputPower();
|
||||
}
|
||||
|
||||
public int getCurrentOutputPowerIndicator() {
|
||||
return 100;
|
||||
// return radio.getOutputPowerIndicator();
|
||||
}
|
||||
|
||||
public int getOutputPowerIndicatorMax() {
|
||||
return 100;
|
||||
// return 31;
|
||||
}
|
||||
|
||||
double currentSignalStrength = 0;
|
||||
|
||||
/**
|
||||
* Last 8 received signal strengths
|
||||
*/
|
||||
private double[] rssiLast = new double[8];
|
||||
private int rssiLastCounter = 0;
|
||||
|
||||
public double getCurrentSignalStrength() {
|
||||
return currentSignalStrength;
|
||||
}
|
||||
|
||||
public void setCurrentSignalStrength(final double signalStrength) {
|
||||
if (signalStrength == currentSignalStrength) {
|
||||
return; /* ignored */
|
||||
}
|
||||
currentSignalStrength = signalStrength;
|
||||
if (rssiLastCounter == 0) {
|
||||
getMote().getSimulation().scheduleEvent(new MspMoteTimeEvent(mote, 0) {
|
||||
public void execute(long t) {
|
||||
super.execute(t);
|
||||
|
||||
/* Update average */
|
||||
System.arraycopy(rssiLast, 1, rssiLast, 0, 7);
|
||||
rssiLast[7] = currentSignalStrength;
|
||||
double avg = 0;
|
||||
for (double v: rssiLast) {
|
||||
avg += v;
|
||||
}
|
||||
avg /= rssiLast.length;
|
||||
|
||||
radio.setRSSI((int) avg);
|
||||
|
||||
rssiLastCounter--;
|
||||
if (rssiLastCounter > 0) {
|
||||
mote.getSimulation().scheduleEvent(this, t+DELAY_BETWEEN_BYTES/2);
|
||||
}
|
||||
}
|
||||
}, mote.getSimulation().getSimulationTime());
|
||||
}
|
||||
rssiLastCounter = 8;
|
||||
}
|
||||
|
||||
|
||||
public void setLQI(int lqi){
|
||||
radio.setLQI(lqi);
|
||||
}
|
||||
|
||||
public int getLQI(){
|
||||
return radio.getLQI();
|
||||
}
|
||||
|
||||
|
||||
public Mote getMote() {
|
||||
return mote;
|
||||
}
|
||||
|
||||
public Position getPosition() {
|
||||
return mote.getInterfaces().getPosition();
|
||||
}
|
||||
|
||||
public Collection<Element> getConfigXML() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setConfigXML(Collection<Element> configXML, boolean visAvailable) {
|
||||
}
|
||||
|
||||
public boolean isRadioOn() {
|
||||
if (radio.isReadyToReceive()) {
|
||||
return true;
|
||||
}
|
||||
if (radio.getMode() == CC2520.MODE_POWER_OFF) {
|
||||
return false;
|
||||
}
|
||||
if (radio.getMode() == CC2520.MODE_TXRX_OFF) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean canReceiveFrom(CustomDataRadio radio) {
|
||||
if (radio.getClass().equals(this.getClass())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
package org.contikios.cooja.mspmote.interfaces;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.jdom.Element;
|
||||
|
||||
import org.contikios.cooja.ClassDescription;
|
||||
import org.contikios.cooja.Mote;
|
||||
import org.contikios.cooja.RadioPacket;
|
||||
import org.contikios.cooja.Simulation;
|
||||
import org.contikios.cooja.interfaces.CustomDataRadio;
|
||||
import org.contikios.cooja.interfaces.Position;
|
||||
import org.contikios.cooja.interfaces.Radio;
|
||||
import org.contikios.cooja.mspmote.MspMote;
|
||||
import org.contikios.cooja.mspmote.MspMoteTimeEvent;
|
||||
import org.contikios.cooja.mspmote.interfaces.CC2420RadioPacketConverter;
|
||||
import se.sics.mspsim.chip.CC2520;
|
||||
import se.sics.mspsim.chip.ChannelListener;
|
||||
import se.sics.mspsim.chip.RFListener;
|
||||
import se.sics.mspsim.core.Chip;
|
||||
import se.sics.mspsim.core.OperatingModeListener;
|
||||
|
||||
/**
|
||||
* MSPSim CC2520 radio to COOJA wrapper.
|
||||
*
|
||||
* @author Fredrik Osterlind
|
||||
*/
|
||||
@ClassDescription("IEEE CC2520 Radio")
|
||||
public class CC2520Radio extends Radio implements CustomDataRadio {
|
||||
private static Logger logger = Logger.getLogger(CC2520Radio.class);
|
||||
|
||||
/**
|
||||
* Cross-level:
|
||||
* Inter-byte delay for delivering cross-level packet bytes.
|
||||
*/
|
||||
public static final long DELAY_BETWEEN_BYTES =
|
||||
(long) (1000.0*Simulation.MILLISECOND/(250000.0/8.0)); /* us. Corresponds to 250kbit/s */
|
||||
|
||||
private RadioEvent lastEvent = RadioEvent.UNKNOWN;
|
||||
|
||||
private final MspMote mote;
|
||||
private final CC2520 radio;
|
||||
|
||||
private boolean isInterfered = false;
|
||||
private boolean isTransmitting = false;
|
||||
private boolean isReceiving = false;
|
||||
|
||||
private byte lastOutgoingByte;
|
||||
private byte lastIncomingByte;
|
||||
|
||||
private RadioPacket lastOutgoingPacket = null;
|
||||
private RadioPacket lastIncomingPacket = null;
|
||||
|
||||
public CC2520Radio(Mote m) {
|
||||
this.mote = (MspMote)m;
|
||||
this.radio = this.mote.getCPU().getChip(CC2520.class);
|
||||
if (radio == null) {
|
||||
throw new IllegalStateException("Mote is not equipped with an IEEE CC2520 radio");
|
||||
}
|
||||
|
||||
radio.addRFListener(new RFListener() {
|
||||
int len = 0;
|
||||
int expLen = 0;
|
||||
byte[] buffer = new byte[127 + 15];
|
||||
public void receivedByte(byte data) {
|
||||
if (!isTransmitting()) {
|
||||
lastEvent = RadioEvent.TRANSMISSION_STARTED;
|
||||
isTransmitting = true;
|
||||
len = 0;
|
||||
/*logger.debug("----- CC2520 TRANSMISSION STARTED -----");*/
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
|
||||
if (len >= buffer.length) {
|
||||
/* Bad size packet, too large */
|
||||
logger.debug("Error: bad size: " + len + ", dropping outgoing byte: " + data);
|
||||
return;
|
||||
}
|
||||
|
||||
/* send this byte to all nodes */
|
||||
lastOutgoingByte = data;
|
||||
lastEvent = RadioEvent.CUSTOM_DATA_TRANSMITTED;
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
|
||||
buffer[len++] = data;
|
||||
|
||||
if (len == 6) {
|
||||
// System.out.println("## CC2520 Packet of length: " + data + " expected...");
|
||||
expLen = data + 6;
|
||||
}
|
||||
|
||||
if (len == expLen) {
|
||||
/*logger.debug("----- CC2520 CUSTOM DATA TRANSMITTED -----");*/
|
||||
len -= 4; /* preamble */
|
||||
len -= 1; /* synch */
|
||||
len -= radio.getFooterLength(); /* footer */
|
||||
final byte[] packetdata = new byte[len];
|
||||
System.arraycopy(buffer, 4+1, packetdata, 0, len);
|
||||
lastOutgoingPacket = new RadioPacket() {
|
||||
public byte[] getPacketData() {
|
||||
return packetdata;
|
||||
}
|
||||
};
|
||||
|
||||
/*logger.debug("----- CC2520 PACKET TRANSMITTED -----");*/
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
|
||||
/*logger.debug("----- CC2520 TRANSMISSION FINISHED -----");*/
|
||||
isTransmitting = false;
|
||||
lastEvent = RadioEvent.TRANSMISSION_FINISHED;
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
len = 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
radio.addOperatingModeListener(new OperatingModeListener() {
|
||||
public void modeChanged(Chip source, int mode) {
|
||||
if (radio.isReadyToReceive()) {
|
||||
lastEvent = RadioEvent.HW_ON;
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
} else {
|
||||
radioOff();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
radio.addChannelListener(new ChannelListener() {
|
||||
public void channelChanged(int channel) {
|
||||
/* XXX Currently assumes zero channel switch time */
|
||||
lastEvent = RadioEvent.UNKNOWN;
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void radioOff() {
|
||||
/* Radio was turned off during transmission.
|
||||
* May for example happen if watchdog triggers */
|
||||
if (isTransmitting()) {
|
||||
logger.warn("Turning off radio while transmitting, ending packet prematurely");
|
||||
|
||||
/* Simulate end of packet */
|
||||
lastOutgoingPacket = new RadioPacket() {
|
||||
public byte[] getPacketData() {
|
||||
return new byte[0];
|
||||
}
|
||||
};
|
||||
|
||||
lastEvent = RadioEvent.PACKET_TRANSMITTED;
|
||||
/*logger.debug("----- CC2520 PACKET TRANSMITTED -----");*/
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
|
||||
/* Register that transmission ended in radio medium */
|
||||
/*logger.debug("----- CC2520 TRANSMISSION FINISHED -----");*/
|
||||
isTransmitting = false;
|
||||
lastEvent = RadioEvent.TRANSMISSION_FINISHED;
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
|
||||
lastEvent = RadioEvent.HW_OFF;
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
|
||||
/* Packet radio support */
|
||||
public RadioPacket getLastPacketTransmitted() {
|
||||
return lastOutgoingPacket;
|
||||
}
|
||||
|
||||
public RadioPacket getLastPacketReceived() {
|
||||
return lastIncomingPacket;
|
||||
}
|
||||
|
||||
public void setReceivedPacket(RadioPacket packet) {
|
||||
logger.fatal("TODO Implement me!");
|
||||
}
|
||||
|
||||
/* Custom data radio support */
|
||||
public Object getLastCustomDataTransmitted() {
|
||||
return lastOutgoingByte;
|
||||
}
|
||||
|
||||
public Object getLastCustomDataReceived() {
|
||||
return lastIncomingByte;
|
||||
}
|
||||
|
||||
public void receiveCustomData(Object data) {
|
||||
if (!(data instanceof Byte)) {
|
||||
logger.fatal("Bad custom data: " + data);
|
||||
return;
|
||||
}
|
||||
lastIncomingByte = (Byte) data;
|
||||
|
||||
final byte inputByte;
|
||||
if (isInterfered()) {
|
||||
inputByte = (byte)0xFF;
|
||||
} else {
|
||||
inputByte = lastIncomingByte;
|
||||
}
|
||||
mote.getSimulation().scheduleEvent(new MspMoteTimeEvent(mote, 0) {
|
||||
public void execute(long t) {
|
||||
super.execute(t);
|
||||
radio.receivedByte(inputByte);
|
||||
mote.requestImmediateWakeup();
|
||||
}
|
||||
}, mote.getSimulation().getSimulationTime());
|
||||
|
||||
}
|
||||
|
||||
/* General radio support */
|
||||
public boolean isTransmitting() {
|
||||
return isTransmitting;
|
||||
}
|
||||
|
||||
public boolean isReceiving() {
|
||||
return isReceiving;
|
||||
}
|
||||
|
||||
public boolean isInterfered() {
|
||||
return isInterfered;
|
||||
}
|
||||
|
||||
public int getChannel() {
|
||||
return radio.getActiveChannel();
|
||||
}
|
||||
|
||||
public int getFrequency() {
|
||||
return radio.getActiveFrequency();
|
||||
}
|
||||
|
||||
public void signalReceptionStart() {
|
||||
isReceiving = true;
|
||||
|
||||
lastEvent = RadioEvent.RECEPTION_STARTED;
|
||||
/*logger.debug("----- CC2520 RECEPTION STARTED -----");*/
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
|
||||
public void signalReceptionEnd() {
|
||||
/* Deliver packet data */
|
||||
isReceiving = false;
|
||||
isInterfered = false;
|
||||
|
||||
lastEvent = RadioEvent.RECEPTION_FINISHED;
|
||||
/*logger.debug("----- CC2520 RECEPTION FINISHED -----");*/
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
|
||||
public RadioEvent getLastEvent() {
|
||||
return lastEvent;
|
||||
}
|
||||
|
||||
public void interfereAnyReception() {
|
||||
isInterfered = true;
|
||||
isReceiving = false;
|
||||
lastIncomingPacket = null;
|
||||
|
||||
lastEvent = RadioEvent.RECEPTION_INTERFERED;
|
||||
/*logger.debug("----- CC2520 RECEPTION INTERFERED -----");*/
|
||||
setChanged();
|
||||
notifyObservers();
|
||||
}
|
||||
|
||||
public double getCurrentOutputPower() {
|
||||
return radio.getOutputPower();
|
||||
}
|
||||
|
||||
public int getCurrentOutputPowerIndicator() {
|
||||
return 100;
|
||||
// return radio.getOutputPowerIndicator();
|
||||
}
|
||||
|
||||
public int getOutputPowerIndicatorMax() {
|
||||
return 100;
|
||||
// return 31;
|
||||
}
|
||||
|
||||
double currentSignalStrength = 0;
|
||||
|
||||
/**
|
||||
* Last 8 received signal strengths
|
||||
*/
|
||||
private double[] rssiLast = new double[8];
|
||||
private int rssiLastCounter = 0;
|
||||
|
||||
public double getCurrentSignalStrength() {
|
||||
return currentSignalStrength;
|
||||
}
|
||||
|
||||
public void setCurrentSignalStrength(final double signalStrength) {
|
||||
if (signalStrength == currentSignalStrength) {
|
||||
return; /* ignored */
|
||||
}
|
||||
currentSignalStrength = signalStrength;
|
||||
if (rssiLastCounter == 0) {
|
||||
getMote().getSimulation().scheduleEvent(new MspMoteTimeEvent(mote, 0) {
|
||||
public void execute(long t) {
|
||||
super.execute(t);
|
||||
|
||||
/* Update average */
|
||||
System.arraycopy(rssiLast, 1, rssiLast, 0, 7);
|
||||
rssiLast[7] = currentSignalStrength;
|
||||
double avg = 0;
|
||||
for (double v: rssiLast) {
|
||||
avg += v;
|
||||
}
|
||||
avg /= rssiLast.length;
|
||||
|
||||
radio.setRSSI((int) avg);
|
||||
|
||||
rssiLastCounter--;
|
||||
if (rssiLastCounter > 0) {
|
||||
mote.getSimulation().scheduleEvent(this, t+DELAY_BETWEEN_BYTES/2);
|
||||
}
|
||||
}
|
||||
}, mote.getSimulation().getSimulationTime());
|
||||
}
|
||||
rssiLastCounter = 8;
|
||||
}
|
||||
|
||||
|
||||
public void setLQI(int lqi){
|
||||
radio.setLQI(lqi);
|
||||
}
|
||||
|
||||
public int getLQI(){
|
||||
return radio.getLQI();
|
||||
}
|
||||
|
||||
|
||||
public Mote getMote() {
|
||||
return mote;
|
||||
}
|
||||
|
||||
public Position getPosition() {
|
||||
return mote.getInterfaces().getPosition();
|
||||
}
|
||||
|
||||
public Collection<Element> getConfigXML() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setConfigXML(Collection<Element> configXML, boolean visAvailable) {
|
||||
}
|
||||
|
||||
public boolean isRadioOn() {
|
||||
if (radio.isReadyToReceive()) {
|
||||
return true;
|
||||
}
|
||||
if (radio.getMode() == CC2520.MODE_POWER_OFF) {
|
||||
return false;
|
||||
}
|
||||
if (radio.getMode() == CC2520.MODE_TXRX_OFF) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean canReceiveFrom(CustomDataRadio radio) {
|
||||
if (radio.getClass().equals(this.getClass())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,50 +1,50 @@
|
|||
/*
|
||||
* Copyright (c) 2012, Thingsquare.
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.contikios.cooja.mspmote.interfaces;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.contikios.cooja.ClassDescription;
|
||||
import org.contikios.cooja.Mote;
|
||||
import org.contikios.cooja.interfaces.CustomDataRadio;
|
||||
|
||||
/**
|
||||
* @author Fredrik Osterlind
|
||||
*/
|
||||
@ClassDescription("TI CC1101 (CC430)")
|
||||
public class CC430Radio extends CC1101Radio implements CustomDataRadio {
|
||||
private static Logger logger = Logger.getLogger(CC1101Radio.class);
|
||||
|
||||
public CC430Radio(Mote m) {
|
||||
super(m);
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* Copyright (c) 2012, Thingsquare.
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.contikios.cooja.mspmote.interfaces;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.contikios.cooja.ClassDescription;
|
||||
import org.contikios.cooja.Mote;
|
||||
import org.contikios.cooja.interfaces.CustomDataRadio;
|
||||
|
||||
/**
|
||||
* @author Fredrik Osterlind
|
||||
*/
|
||||
@ClassDescription("TI CC1101 (CC430)")
|
||||
public class CC430Radio extends CC1101Radio implements CustomDataRadio {
|
||||
private static Logger logger = Logger.getLogger(CC1101Radio.class);
|
||||
|
||||
public CC430Radio(Mote m) {
|
||||
super(m);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
org.contikios.cooja.Cooja.PLUGINS = + PowerTracker
|
||||
org.contikios.cooja.Cooja.JARFILES = + powertracker.jar
|
||||
org.contikios.cooja.Cooja.PLUGINS = + PowerTracker
|
||||
org.contikios.cooja.Cooja.JARFILES = + powertracker.jar
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<html>
|
||||
<head> <title> The COOJA Simulator (applet) </title> </head>
|
||||
<body>
|
||||
|
||||
<applet code="org/contikios/cooja/CoojaApplet.class"
|
||||
archive="../lib/jdom.jar, ../lib/log4j.jar, ../apps/mrm/lib/mrm.jar, ../apps/mspsim/lib/mspsim.jar, ../apps/mspsim/lib/cooja_mspsim.jar"
|
||||
width="600" height="400">
|
||||
</applet>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
<html>
|
||||
<head> <title> The COOJA Simulator (applet) </title> </head>
|
||||
<body>
|
||||
|
||||
<applet code="org/contikios/cooja/CoojaApplet.class"
|
||||
archive="../lib/jdom.jar, ../lib/log4j.jar, ../apps/mrm/lib/mrm.jar, ../apps/mspsim/lib/mspsim.jar, ../apps/mspsim/lib/cooja_mspsim.jar"
|
||||
width="600" height="400">
|
||||
</applet>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
grant {
|
||||
permission java.security.AllPermission;
|
||||
};
|
||||
grant {
|
||||
permission java.security.AllPermission;
|
||||
};
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
|
||||
|
||||
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
|
||||
|
||||
<appender name="logfile" class="org.apache.log4j.FileAppender">
|
||||
<param name="File" value="COOJA.log"/>
|
||||
<param name="Append" value="false"/>
|
||||
<layout class="org.apache.log4j.PatternLayout">
|
||||
<param name="ConversionPattern" value="[%d{HH:mm:ss} - %t] [%F:%L] [%p] - %m%n"/>
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<appender name="stdout" class="org.apache.log4j.ConsoleAppender">
|
||||
<layout class="org.apache.log4j.PatternLayout">
|
||||
<param name="ConversionPattern" value="%5p [%t] (%F:%L) - %m%n"/>
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<root>
|
||||
<priority value="info"/>
|
||||
<appender-ref ref="logfile"/>
|
||||
<appender-ref ref="stdout"/>
|
||||
</root>
|
||||
</log4j:configuration>
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
|
||||
|
||||
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
|
||||
|
||||
<appender name="logfile" class="org.apache.log4j.FileAppender">
|
||||
<param name="File" value="COOJA.log"/>
|
||||
<param name="Append" value="false"/>
|
||||
<layout class="org.apache.log4j.PatternLayout">
|
||||
<param name="ConversionPattern" value="[%d{HH:mm:ss} - %t] [%F:%L] [%p] - %m%n"/>
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<appender name="stdout" class="org.apache.log4j.ConsoleAppender">
|
||||
<layout class="org.apache.log4j.PatternLayout">
|
||||
<param name="ConversionPattern" value="%5p [%t] (%F:%L) - %m%n"/>
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<root>
|
||||
<priority value="info"/>
|
||||
<appender-ref ref="logfile"/>
|
||||
<appender-ref ref="stdout"/>
|
||||
</root>
|
||||
</log4j:configuration>
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
KEYBOARD_SHORTCUTS = \
|
||||
<b>Keyboard shortcuts</b><br>\
|
||||
<br><i>Ctrl+N:</i> New simulation\
|
||||
<br><i>Ctrl+S:</i> Start/pause simulation\
|
||||
<br><i>Ctrl+R:</i> Reload current simulation. If no simulation exists, the last used simulation config is loaded\
|
||||
<br><i>Ctrl+Shift+R:</i> Reload current simulation with another random seed\
|
||||
<br>\
|
||||
<br><i>F1:</i> Toggle quick help
|
||||
|
||||
GETTING_STARTED = \
|
||||
<b>Getting started</b><br>\
|
||||
<br>\
|
||||
<br><i>F1:</i> Toggle quick help</i>
|
||||
|
||||
KEYBOARD_SHORTCUTS = \
|
||||
<b>Keyboard shortcuts</b><br>\
|
||||
<br><i>Ctrl+N:</i> New simulation\
|
||||
<br><i>Ctrl+S:</i> Start/pause simulation\
|
||||
<br><i>Ctrl+R:</i> Reload current simulation. If no simulation exists, the last used simulation config is loaded\
|
||||
<br><i>Ctrl+Shift+R:</i> Reload current simulation with another random seed\
|
||||
<br>\
|
||||
<br><i>F1:</i> Toggle quick help
|
||||
|
||||
GETTING_STARTED = \
|
||||
<b>Getting started</b><br>\
|
||||
<br>\
|
||||
<br><i>F1:</i> Toggle quick help</i>
|
||||
|
|
|
@ -1,28 +1,28 @@
|
|||
/*
|
||||
* Example Contiki test script (JavaScript).
|
||||
* A Contiki test script acts on mote output, such as via printf()'s.
|
||||
* The script may operate on the following variables:
|
||||
* Mote mote, int id, String msg
|
||||
*/
|
||||
|
||||
/* Make test automatically fail (timeout) after 100 simulated seconds */
|
||||
//TIMEOUT(100000); /* milliseconds. no action at timeout */
|
||||
TIMEOUT(100000, log.log("last msg: " + msg + "\n")); /* milliseconds. print last msg at timeout */
|
||||
|
||||
log.log("first mote output: '" + msg + "'\n");
|
||||
|
||||
YIELD(); /* wait for another mote output */
|
||||
|
||||
log.log("second mote output: '" + msg + "'\n");
|
||||
|
||||
log.log("waiting for hello world output from mote 1\n");
|
||||
WAIT_UNTIL(id == 1 && msg.equals("Hello, world"));
|
||||
|
||||
write(mote, "Hello, mote\n"); /* Write to mote serial port */
|
||||
|
||||
GENERATE_MSG(15000, "continue");
|
||||
YIELD_THEN_WAIT_UNTIL(msg.equals("continue"));
|
||||
|
||||
log.log("ok, reporting success now\n");
|
||||
log.testOK(); /* Report test success and quit */
|
||||
//log.testFailed(); /* Report test failure and quit */
|
||||
/*
|
||||
* Example Contiki test script (JavaScript).
|
||||
* A Contiki test script acts on mote output, such as via printf()'s.
|
||||
* The script may operate on the following variables:
|
||||
* Mote mote, int id, String msg
|
||||
*/
|
||||
|
||||
/* Make test automatically fail (timeout) after 100 simulated seconds */
|
||||
//TIMEOUT(100000); /* milliseconds. no action at timeout */
|
||||
TIMEOUT(100000, log.log("last msg: " + msg + "\n")); /* milliseconds. print last msg at timeout */
|
||||
|
||||
log.log("first mote output: '" + msg + "'\n");
|
||||
|
||||
YIELD(); /* wait for another mote output */
|
||||
|
||||
log.log("second mote output: '" + msg + "'\n");
|
||||
|
||||
log.log("waiting for hello world output from mote 1\n");
|
||||
WAIT_UNTIL(id == 1 && msg.equals("Hello, world"));
|
||||
|
||||
write(mote, "Hello, mote\n"); /* Write to mote serial port */
|
||||
|
||||
GENERATE_MSG(15000, "continue");
|
||||
YIELD_THEN_WAIT_UNTIL(msg.equals("continue"));
|
||||
|
||||
log.log("ok, reporting success now\n");
|
||||
log.testOK(); /* Report test success and quit */
|
||||
//log.testFailed(); /* Report test failure and quit */
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/*
|
||||
* Example Contiki test script (JavaScript).
|
||||
* A Contiki test script acts on mote output, such as via printf()'s.
|
||||
* The script may operate on the following variables:
|
||||
* Mote mote, int id, String msg
|
||||
*/
|
||||
|
||||
TIMEOUT(2000, log.log("last message: " + msg + "\n"));
|
||||
|
||||
WAIT_UNTIL(msg.equals('Hello, world'));
|
||||
log.testOK();
|
||||
/*
|
||||
* Example Contiki test script (JavaScript).
|
||||
* A Contiki test script acts on mote output, such as via printf()'s.
|
||||
* The script may operate on the following variables:
|
||||
* Mote mote, int id, String msg
|
||||
*/
|
||||
|
||||
TIMEOUT(2000, log.log("last message: " + msg + "\n"));
|
||||
|
||||
WAIT_UNTIL(msg.equals('Hello, world'));
|
||||
log.testOK();
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
/*
|
||||
* Example Contiki test script (JavaScript).
|
||||
* A Contiki test script acts on mote output, such as via printf()'s.
|
||||
* The script may operate on the following variables:
|
||||
* Mote mote, int id, String msg
|
||||
*/
|
||||
|
||||
TIMEOUT(60000);
|
||||
|
||||
while (true) {
|
||||
log.log(time + ":" + id + ":" + msg + "\n");
|
||||
YIELD();
|
||||
}
|
||||
/*
|
||||
* Example Contiki test script (JavaScript).
|
||||
* A Contiki test script acts on mote output, such as via printf()'s.
|
||||
* The script may operate on the following variables:
|
||||
* Mote mote, int id, String msg
|
||||
*/
|
||||
|
||||
TIMEOUT(60000);
|
||||
|
||||
while (true) {
|
||||
log.log(time + ":" + id + ":" + msg + "\n");
|
||||
YIELD();
|
||||
}
|
||||
|
|
|
@ -1,66 +1,66 @@
|
|||
/*
|
||||
* Example showing how to reference and interact with surrounding
|
||||
* COOJA plugins from a test script.
|
||||
* The code looks up three common plugins and, if found, performs some
|
||||
* simple plugin-specific task.
|
||||
*/
|
||||
|
||||
/* Started plugins are available from the GUI object */
|
||||
|
||||
TIMEOUT(60000);
|
||||
|
||||
counter=0;
|
||||
plugins=0;
|
||||
|
||||
timeout_function = function my_fun() {
|
||||
log.log("Script timed out.\n");
|
||||
log.log(plugins + " plugins were referenced\n");
|
||||
}
|
||||
|
||||
while (counter<10) {
|
||||
counter++;
|
||||
|
||||
GENERATE_MSG(1000, "wait");
|
||||
YIELD_THEN_WAIT_UNTIL(msg.equals("wait"));
|
||||
|
||||
/* Toggle Log Listener filter */
|
||||
plugin = mote.getSimulation().getCooja().getStartedPlugin("org.contikios.cooja.plugins.LogListener");
|
||||
if (plugin != null) {
|
||||
plugins++;
|
||||
log.log("LogListener: Setting filter: " + plugin.getFilter() + "\n");
|
||||
if (plugin.getFilter() == null || !plugin.getFilter().equals("Contiki")) {
|
||||
plugin.setFilter("Contiki");
|
||||
} else {
|
||||
plugin.setFilter("MAC");
|
||||
}
|
||||
}
|
||||
|
||||
GENERATE_MSG(1000, "wait");
|
||||
YIELD_THEN_WAIT_UNTIL(msg.equals("wait"));
|
||||
|
||||
/* Extract PowerTracker statistics */
|
||||
plugin = mote.getSimulation().getCooja().getStartedPlugin("PowerTracker");
|
||||
if (plugin != null) {
|
||||
plugins++;
|
||||
stats = plugin.radioStatistics();
|
||||
if (stats.length() > 40) {
|
||||
/* Stripping */
|
||||
stats = stats.substring(0, 40) + "...";
|
||||
}
|
||||
log.log("PowerTracker: Extracted statistics:\n" + stats + "\n");
|
||||
} else {
|
||||
log.log("No PowerTracker plugin\n");
|
||||
}
|
||||
|
||||
GENERATE_MSG(1000, "wait");
|
||||
YIELD_THEN_WAIT_UNTIL(msg.equals("wait"));
|
||||
|
||||
/* Select time in Radio Logger */
|
||||
plugin = mote.getSimulation().getCooja().getStartedPlugin("org.contikios.cooja.plugins.RadioLogger");
|
||||
if (plugin != null) {
|
||||
plugins++;
|
||||
log.log("RadioLogger: Showing logged radio packet at mid simulation\n");
|
||||
plugin.trySelectTime(time/2);
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* Example showing how to reference and interact with surrounding
|
||||
* COOJA plugins from a test script.
|
||||
* The code looks up three common plugins and, if found, performs some
|
||||
* simple plugin-specific task.
|
||||
*/
|
||||
|
||||
/* Started plugins are available from the GUI object */
|
||||
|
||||
TIMEOUT(60000);
|
||||
|
||||
counter=0;
|
||||
plugins=0;
|
||||
|
||||
timeout_function = function my_fun() {
|
||||
log.log("Script timed out.\n");
|
||||
log.log(plugins + " plugins were referenced\n");
|
||||
}
|
||||
|
||||
while (counter<10) {
|
||||
counter++;
|
||||
|
||||
GENERATE_MSG(1000, "wait");
|
||||
YIELD_THEN_WAIT_UNTIL(msg.equals("wait"));
|
||||
|
||||
/* Toggle Log Listener filter */
|
||||
plugin = mote.getSimulation().getCooja().getStartedPlugin("org.contikios.cooja.plugins.LogListener");
|
||||
if (plugin != null) {
|
||||
plugins++;
|
||||
log.log("LogListener: Setting filter: " + plugin.getFilter() + "\n");
|
||||
if (plugin.getFilter() == null || !plugin.getFilter().equals("Contiki")) {
|
||||
plugin.setFilter("Contiki");
|
||||
} else {
|
||||
plugin.setFilter("MAC");
|
||||
}
|
||||
}
|
||||
|
||||
GENERATE_MSG(1000, "wait");
|
||||
YIELD_THEN_WAIT_UNTIL(msg.equals("wait"));
|
||||
|
||||
/* Extract PowerTracker statistics */
|
||||
plugin = mote.getSimulation().getCooja().getStartedPlugin("PowerTracker");
|
||||
if (plugin != null) {
|
||||
plugins++;
|
||||
stats = plugin.radioStatistics();
|
||||
if (stats.length() > 40) {
|
||||
/* Stripping */
|
||||
stats = stats.substring(0, 40) + "...";
|
||||
}
|
||||
log.log("PowerTracker: Extracted statistics:\n" + stats + "\n");
|
||||
} else {
|
||||
log.log("No PowerTracker plugin\n");
|
||||
}
|
||||
|
||||
GENERATE_MSG(1000, "wait");
|
||||
YIELD_THEN_WAIT_UNTIL(msg.equals("wait"));
|
||||
|
||||
/* Select time in Radio Logger */
|
||||
plugin = mote.getSimulation().getCooja().getStartedPlugin("org.contikios.cooja.plugins.RadioLogger");
|
||||
if (plugin != null) {
|
||||
plugins++;
|
||||
log.log("RadioLogger: Showing logged radio packet at mid simulation\n");
|
||||
plugin.trySelectTime(time/2);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
/*
|
||||
* Example Contiki test script (JavaScript).
|
||||
* A Contiki test script acts on mote output, such as via printf()'s.
|
||||
* The script may operate on the following variables:
|
||||
* Mote mote, int id, String msg
|
||||
*/
|
||||
|
||||
/* Wait until node has booted */
|
||||
WAIT_UNTIL(msg.startsWith('Starting'));
|
||||
log.log("Mote started\n");
|
||||
mymote = mote; /* store mote reference */
|
||||
|
||||
/* Wait 3 seconds (3000ms) */
|
||||
GENERATE_MSG(3000, "continue");
|
||||
YIELD_THEN_WAIT_UNTIL(msg.equals("continue"));
|
||||
|
||||
/* Write command to serial port */
|
||||
log.log("Writing 'ls' to mote serial port\n");
|
||||
write(mymote, "ls");
|
||||
|
||||
/* Read replies */
|
||||
while (true) {
|
||||
YIELD();
|
||||
if (mote == mymote) {
|
||||
log.log("Mote replied: " + msg + "\n");
|
||||
}
|
||||
/*
|
||||
* Example Contiki test script (JavaScript).
|
||||
* A Contiki test script acts on mote output, such as via printf()'s.
|
||||
* The script may operate on the following variables:
|
||||
* Mote mote, int id, String msg
|
||||
*/
|
||||
|
||||
/* Wait until node has booted */
|
||||
WAIT_UNTIL(msg.startsWith('Starting'));
|
||||
log.log("Mote started\n");
|
||||
mymote = mote; /* store mote reference */
|
||||
|
||||
/* Wait 3 seconds (3000ms) */
|
||||
GENERATE_MSG(3000, "continue");
|
||||
YIELD_THEN_WAIT_UNTIL(msg.equals("continue"));
|
||||
|
||||
/* Write command to serial port */
|
||||
log.log("Writing 'ls' to mote serial port\n");
|
||||
write(mymote, "ls");
|
||||
|
||||
/* Read replies */
|
||||
while (true) {
|
||||
YIELD();
|
||||
if (mote == mymote) {
|
||||
log.log("Mote replied: " + msg + "\n");
|
||||
}
|
||||
}
|
|
@ -1,20 +1,20 @@
|
|||
_The JNI tests have been replaced by the Cooja configuration wizard._
|
||||
|
||||
The JNI tests assisted in configuring Cooja for compiling and linking Java
|
||||
Native Interface (JNI) enabled Contiki libraries. Such Contiki libraries are
|
||||
used by Cooja's Contiki Motes: motes simulated at the operating system
|
||||
abstraction level.
|
||||
|
||||
The new configuration wizard is started from inside Cooja, and exercises the
|
||||
same functionality as the JNI tests. In contrast, the wizard is directly
|
||||
connected to the current Cooja configuration, removing the need to migrate the
|
||||
configuration between JNI tests and Cooja.
|
||||
|
||||
To start the wizard:
|
||||
|
||||
cd tools/cooja
|
||||
ant run # Start COOJA
|
||||
|
||||
Menu > Settings > Compiler configuration wizard
|
||||
|
||||
-- Fredrik Osterlind, fros@sics.se, March 2009
|
||||
_The JNI tests have been replaced by the Cooja configuration wizard._
|
||||
|
||||
The JNI tests assisted in configuring Cooja for compiling and linking Java
|
||||
Native Interface (JNI) enabled Contiki libraries. Such Contiki libraries are
|
||||
used by Cooja's Contiki Motes: motes simulated at the operating system
|
||||
abstraction level.
|
||||
|
||||
The new configuration wizard is started from inside Cooja, and exercises the
|
||||
same functionality as the JNI tests. In contrast, the wizard is directly
|
||||
connected to the current Cooja configuration, removing the need to migrate the
|
||||
configuration between JNI tests and Cooja.
|
||||
|
||||
To start the wizard:
|
||||
|
||||
cd tools/cooja
|
||||
ant run # Start COOJA
|
||||
|
||||
Menu > Settings > Compiler configuration wizard
|
||||
|
||||
-- Fredrik Osterlind, fros@sics.se, March 2009
|
||||
|
|
|
@ -1,65 +1,65 @@
|
|||
/*
|
||||
* Copyright (c) 2011, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.contikios.cooja.interfaces;
|
||||
|
||||
/**
|
||||
* Directional antenna.
|
||||
*
|
||||
* @see MRM
|
||||
* @author Fredrik Osterlind
|
||||
*/
|
||||
public interface DirectionalAntennaRadio {
|
||||
|
||||
/**
|
||||
* @return Current direction (radians). Typically direction 0 has the maximum
|
||||
* relative gain.
|
||||
*
|
||||
* @see #getRelativeGain(double)
|
||||
*/
|
||||
public double getDirection();
|
||||
|
||||
/**
|
||||
* Relative gain (dB) as compared to an omnidirectional antenna.
|
||||
* Note that the given angle is relative to the current direction!
|
||||
*
|
||||
* @see #getDirection()
|
||||
* @param radians Angle relative to current direction
|
||||
* @param distance Distance from antenna
|
||||
* @return
|
||||
*/
|
||||
public double getRelativeGain(double radians, double distance);
|
||||
|
||||
public void addDirectionChangeListener(DirectionChangeListener l);
|
||||
public void removeDirectionChangeListener(DirectionChangeListener l);
|
||||
|
||||
public interface DirectionChangeListener {
|
||||
public void newDirection(DirectionalAntennaRadio radio, double direction);
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* Copyright (c) 2011, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.contikios.cooja.interfaces;
|
||||
|
||||
/**
|
||||
* Directional antenna.
|
||||
*
|
||||
* @see MRM
|
||||
* @author Fredrik Osterlind
|
||||
*/
|
||||
public interface DirectionalAntennaRadio {
|
||||
|
||||
/**
|
||||
* @return Current direction (radians). Typically direction 0 has the maximum
|
||||
* relative gain.
|
||||
*
|
||||
* @see #getRelativeGain(double)
|
||||
*/
|
||||
public double getDirection();
|
||||
|
||||
/**
|
||||
* Relative gain (dB) as compared to an omnidirectional antenna.
|
||||
* Note that the given angle is relative to the current direction!
|
||||
*
|
||||
* @see #getDirection()
|
||||
* @param radians Angle relative to current direction
|
||||
* @param distance Distance from antenna
|
||||
* @return
|
||||
*/
|
||||
public double getRelativeGain(double radians, double distance);
|
||||
|
||||
public void addDirectionChangeListener(DirectionChangeListener l);
|
||||
public void removeDirectionChangeListener(DirectionChangeListener l);
|
||||
|
||||
public interface DirectionChangeListener {
|
||||
public void newDirection(DirectionalAntennaRadio radio, double direction);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,56 +1,56 @@
|
|||
/*
|
||||
* Copyright (c) 2011, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.contikios.cooja.interfaces;
|
||||
|
||||
/**
|
||||
* The noise source radio is used to simulate ambient background noise or
|
||||
* point-sources of external interference (e.g. Wifi basestations).
|
||||
*
|
||||
* Note that interference generated from these radios are different from
|
||||
* transmissions; they will not appear in the radio logger but may still
|
||||
* hinder or interfere with ongoing transmissions.
|
||||
*
|
||||
* Noise source radios require significant processing resources in comparison
|
||||
* to only transmission radios.
|
||||
*
|
||||
* COOJA's radio mediums may or may not choose to respect noise source radios.
|
||||
*
|
||||
* @see MRM
|
||||
* @author Fredrik Osterlind
|
||||
*/
|
||||
public interface NoiseSourceRadio {
|
||||
public int getNoiseLevel();
|
||||
|
||||
public void addNoiseLevelListener(NoiseLevelListener l);
|
||||
public void removeNoiseLevelListener(NoiseLevelListener l);
|
||||
|
||||
public interface NoiseLevelListener {
|
||||
public void noiseLevelChanged(NoiseSourceRadio radio, int signal);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (c) 2011, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.contikios.cooja.interfaces;
|
||||
|
||||
/**
|
||||
* The noise source radio is used to simulate ambient background noise or
|
||||
* point-sources of external interference (e.g. Wifi basestations).
|
||||
*
|
||||
* Note that interference generated from these radios are different from
|
||||
* transmissions; they will not appear in the radio logger but may still
|
||||
* hinder or interfere with ongoing transmissions.
|
||||
*
|
||||
* Noise source radios require significant processing resources in comparison
|
||||
* to only transmission radios.
|
||||
*
|
||||
* COOJA's radio mediums may or may not choose to respect noise source radios.
|
||||
*
|
||||
* @see MRM
|
||||
* @author Fredrik Osterlind
|
||||
*/
|
||||
public interface NoiseSourceRadio {
|
||||
public int getNoiseLevel();
|
||||
|
||||
public void addNoiseLevelListener(NoiseLevelListener l);
|
||||
public void removeNoiseLevelListener(NoiseLevelListener l);
|
||||
|
||||
public interface NoiseLevelListener {
|
||||
public void noiseLevelChanged(NoiseSourceRadio radio, int signal);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,190 +1,190 @@
|
|||
/*
|
||||
* Copyright (c) 2011, 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.
|
||||
*/
|
||||
|
||||
package org.contikios.cooja.util;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.Socket;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Observable;
|
||||
import java.util.Observer;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.contikios.cooja.Mote;
|
||||
import org.contikios.cooja.interfaces.SerialPort;
|
||||
|
||||
/**
|
||||
* Help class for forwarding serial data between a mote and a socket.
|
||||
*
|
||||
* @author Fredrik Osterlind
|
||||
*/
|
||||
public class MoteSerialSocketConnection {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static Logger logger = Logger.getLogger(MoteSerialSocketConnection.class);
|
||||
|
||||
private boolean isConnected = false;
|
||||
public int toMote = 0, toSocket = 0;
|
||||
|
||||
private SerialPort motePort;
|
||||
private Observer moteObserver;
|
||||
|
||||
private Socket socket;
|
||||
private DataInputStream socketIn;
|
||||
private DataOutputStream socketOut;
|
||||
|
||||
private ArrayList<MoteSerialSocketConnectionListener> listeners = null;
|
||||
|
||||
public MoteSerialSocketConnection(Mote mote, String server, int serverPort)
|
||||
throws IOException {
|
||||
isConnected = true;
|
||||
|
||||
/* Simulated -> socket */
|
||||
motePort = (SerialPort) mote.getInterfaces().getLog();
|
||||
motePort.addSerialDataObserver(moteObserver = new Observer() {
|
||||
public void update(Observable obs, Object obj) {
|
||||
try {
|
||||
if (socketOut == null) {
|
||||
return;
|
||||
}
|
||||
socketOut.write(motePort.getLastSerialData());
|
||||
socketOut.flush();
|
||||
toSocket++;
|
||||
|
||||
if (listeners != null) {
|
||||
for (MoteSerialSocketConnectionListener dl: listeners) {
|
||||
dl.dataTransferred(MoteSerialSocketConnection.this, toMote, toSocket, motePort.getLastSerialData());
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
logger.fatal("Write to socket error: " + e.getMessage(), e);
|
||||
cleanup();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/* Socket -> simulated */
|
||||
socket = new Socket(server, serverPort);
|
||||
socketIn = new DataInputStream(socket.getInputStream());
|
||||
socketOut = new DataOutputStream(socket.getOutputStream());
|
||||
socketOut.flush();
|
||||
Thread socketThread = new Thread(new Runnable() {
|
||||
public void run() {
|
||||
int numRead = 0;
|
||||
byte[] data = new byte[1024];
|
||||
while (true) {
|
||||
numRead = -1;
|
||||
try {
|
||||
numRead = socketIn.read(data);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
if (numRead >= 0) {
|
||||
for (int i = 0; i < numRead; i++) {
|
||||
toMote ++;
|
||||
motePort.writeByte(data[i]);
|
||||
if (listeners != null) {
|
||||
for (MoteSerialSocketConnectionListener dl: listeners) {
|
||||
dl.dataTransferred(MoteSerialSocketConnection.this, toMote, toSocket, data[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
logger.fatal("Incoming data thread shut down");
|
||||
cleanup();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
socketThread.start();
|
||||
}
|
||||
|
||||
public boolean isConnected() {
|
||||
return isConnected;
|
||||
}
|
||||
|
||||
public void cleanup() {
|
||||
if (!isConnected) {
|
||||
return;
|
||||
}
|
||||
isConnected = false;
|
||||
|
||||
motePort.deleteSerialDataObserver(moteObserver);
|
||||
|
||||
try {
|
||||
if (socket != null) {
|
||||
socket.close();
|
||||
socket = null;
|
||||
}
|
||||
} catch (IOException e1) {
|
||||
}
|
||||
try {
|
||||
if (socketIn != null) {
|
||||
socketIn.close();
|
||||
socketIn = null;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
}
|
||||
try {
|
||||
if (socketOut != null) {
|
||||
socketOut.close();
|
||||
socketOut = null;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
}
|
||||
|
||||
if (listeners != null) {
|
||||
for (MoteSerialSocketConnectionListener dl: listeners) {
|
||||
dl.wasDisconnected(MoteSerialSocketConnection.this);
|
||||
}
|
||||
listeners = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void addListener(MoteSerialSocketConnectionListener l) {
|
||||
if (listeners == null) {
|
||||
listeners = new ArrayList<MoteSerialSocketConnectionListener>();
|
||||
}
|
||||
|
||||
listeners.add(l);
|
||||
}
|
||||
|
||||
public interface MoteSerialSocketConnectionListener {
|
||||
public void wasDisconnected(MoteSerialSocketConnection s);
|
||||
public void dataTransferred(MoteSerialSocketConnection s, int toMote, int toSocket, byte data);
|
||||
}
|
||||
|
||||
/*
|
||||
* Copyright (c) 2011, 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.
|
||||
*/
|
||||
|
||||
package org.contikios.cooja.util;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.Socket;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Observable;
|
||||
import java.util.Observer;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.contikios.cooja.Mote;
|
||||
import org.contikios.cooja.interfaces.SerialPort;
|
||||
|
||||
/**
|
||||
* Help class for forwarding serial data between a mote and a socket.
|
||||
*
|
||||
* @author Fredrik Osterlind
|
||||
*/
|
||||
public class MoteSerialSocketConnection {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static Logger logger = Logger.getLogger(MoteSerialSocketConnection.class);
|
||||
|
||||
private boolean isConnected = false;
|
||||
public int toMote = 0, toSocket = 0;
|
||||
|
||||
private SerialPort motePort;
|
||||
private Observer moteObserver;
|
||||
|
||||
private Socket socket;
|
||||
private DataInputStream socketIn;
|
||||
private DataOutputStream socketOut;
|
||||
|
||||
private ArrayList<MoteSerialSocketConnectionListener> listeners = null;
|
||||
|
||||
public MoteSerialSocketConnection(Mote mote, String server, int serverPort)
|
||||
throws IOException {
|
||||
isConnected = true;
|
||||
|
||||
/* Simulated -> socket */
|
||||
motePort = (SerialPort) mote.getInterfaces().getLog();
|
||||
motePort.addSerialDataObserver(moteObserver = new Observer() {
|
||||
public void update(Observable obs, Object obj) {
|
||||
try {
|
||||
if (socketOut == null) {
|
||||
return;
|
||||
}
|
||||
socketOut.write(motePort.getLastSerialData());
|
||||
socketOut.flush();
|
||||
toSocket++;
|
||||
|
||||
if (listeners != null) {
|
||||
for (MoteSerialSocketConnectionListener dl: listeners) {
|
||||
dl.dataTransferred(MoteSerialSocketConnection.this, toMote, toSocket, motePort.getLastSerialData());
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
logger.fatal("Write to socket error: " + e.getMessage(), e);
|
||||
cleanup();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/* Socket -> simulated */
|
||||
socket = new Socket(server, serverPort);
|
||||
socketIn = new DataInputStream(socket.getInputStream());
|
||||
socketOut = new DataOutputStream(socket.getOutputStream());
|
||||
socketOut.flush();
|
||||
Thread socketThread = new Thread(new Runnable() {
|
||||
public void run() {
|
||||
int numRead = 0;
|
||||
byte[] data = new byte[1024];
|
||||
while (true) {
|
||||
numRead = -1;
|
||||
try {
|
||||
numRead = socketIn.read(data);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
if (numRead >= 0) {
|
||||
for (int i = 0; i < numRead; i++) {
|
||||
toMote ++;
|
||||
motePort.writeByte(data[i]);
|
||||
if (listeners != null) {
|
||||
for (MoteSerialSocketConnectionListener dl: listeners) {
|
||||
dl.dataTransferred(MoteSerialSocketConnection.this, toMote, toSocket, data[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
logger.fatal("Incoming data thread shut down");
|
||||
cleanup();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
socketThread.start();
|
||||
}
|
||||
|
||||
public boolean isConnected() {
|
||||
return isConnected;
|
||||
}
|
||||
|
||||
public void cleanup() {
|
||||
if (!isConnected) {
|
||||
return;
|
||||
}
|
||||
isConnected = false;
|
||||
|
||||
motePort.deleteSerialDataObserver(moteObserver);
|
||||
|
||||
try {
|
||||
if (socket != null) {
|
||||
socket.close();
|
||||
socket = null;
|
||||
}
|
||||
} catch (IOException e1) {
|
||||
}
|
||||
try {
|
||||
if (socketIn != null) {
|
||||
socketIn.close();
|
||||
socketIn = null;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
}
|
||||
try {
|
||||
if (socketOut != null) {
|
||||
socketOut.close();
|
||||
socketOut = null;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
}
|
||||
|
||||
if (listeners != null) {
|
||||
for (MoteSerialSocketConnectionListener dl: listeners) {
|
||||
dl.wasDisconnected(MoteSerialSocketConnection.this);
|
||||
}
|
||||
listeners = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void addListener(MoteSerialSocketConnectionListener l) {
|
||||
if (listeners == null) {
|
||||
listeners = new ArrayList<MoteSerialSocketConnectionListener>();
|
||||
}
|
||||
|
||||
listeners.add(l);
|
||||
}
|
||||
|
||||
public interface MoteSerialSocketConnectionListener {
|
||||
public void wasDisconnected(MoteSerialSocketConnection s);
|
||||
public void dataTransferred(MoteSerialSocketConnection s, int toMote, int toSocket, byte data);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
Downloaded from http://code.google.com/p/jsyntaxpane/.
|
||||
|
||||
Apache License 2.0:
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
Downloaded from http://code.google.com/p/jsyntaxpane/.
|
||||
|
||||
Apache License 2.0:
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
|
|
@ -1,38 +1,38 @@
|
|||
# Nano Programmer
|
||||
|
||||
Programming tool for the Sensinode Nano series using Dxxx development boards.
|
||||
|
||||
Copyright 2007-2008 Sensinode Ltd.
|
||||
|
||||
## Installation
|
||||
|
||||
### Linux
|
||||
|
||||
No external libraries required.
|
||||
|
||||
### Windows/Cygwin
|
||||
|
||||
See the nano_usb_programmer README file on how to install FTDI library
|
||||
for nano_usb_programmer. The nano_programmer build system will fetch
|
||||
the library from there.
|
||||
|
||||
## Usage
|
||||
|
||||
Usage info for the Nano Programmer is available with command
|
||||
|
||||
./nano_programmer --help
|
||||
|
||||
Note that use might require root/administrator privileges
|
||||
depending on system configuration.
|
||||
|
||||
## Known problems
|
||||
|
||||
Occasional timing failures resulting in "Reinit failed."-messages do come
|
||||
up in some PC configurations. If you experience programming failures (the programmer
|
||||
is not able to recover), please report your system configuration to Sensinode.
|
||||
On Linux, it is known that the "brltty" program causes problems with the FTDI
|
||||
serial driver. Uninstalling brltty resolves the problem.
|
||||
|
||||
## Version
|
||||
|
||||
v1.3 2008-01-31 Martti Huttunen Multi-platform build and created instructions
|
||||
# Nano Programmer
|
||||
|
||||
Programming tool for the Sensinode Nano series using Dxxx development boards.
|
||||
|
||||
Copyright 2007-2008 Sensinode Ltd.
|
||||
|
||||
## Installation
|
||||
|
||||
### Linux
|
||||
|
||||
No external libraries required.
|
||||
|
||||
### Windows/Cygwin
|
||||
|
||||
See the nano_usb_programmer README file on how to install FTDI library
|
||||
for nano_usb_programmer. The nano_programmer build system will fetch
|
||||
the library from there.
|
||||
|
||||
## Usage
|
||||
|
||||
Usage info for the Nano Programmer is available with command
|
||||
|
||||
./nano_programmer --help
|
||||
|
||||
Note that use might require root/administrator privileges
|
||||
depending on system configuration.
|
||||
|
||||
## Known problems
|
||||
|
||||
Occasional timing failures resulting in "Reinit failed."-messages do come
|
||||
up in some PC configurations. If you experience programming failures (the programmer
|
||||
is not able to recover), please report your system configuration to Sensinode.
|
||||
On Linux, it is known that the "brltty" program causes problems with the FTDI
|
||||
serial driver. Uninstalling brltty resolves the problem.
|
||||
|
||||
## Version
|
||||
|
||||
v1.3 2008-01-31 Martti Huttunen Multi-platform build and created instructions
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue