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