summaryrefslogtreecommitdiff
path: root/peripheral/libmraa/examples/java
diff options
context:
space:
mode:
Diffstat (limited to 'peripheral/libmraa/examples/java')
-rw-r--r--peripheral/libmraa/examples/java/AioA0.java56
-rw-r--r--peripheral/libmraa/examples/java/BlinkIO.java72
-rw-r--r--peripheral/libmraa/examples/java/BlinkOnboard.java81
-rw-r--r--peripheral/libmraa/examples/java/Bmp85.java75
-rw-r--r--peripheral/libmraa/examples/java/CyclePwm3.java57
-rw-r--r--peripheral/libmraa/examples/java/Example.java49
-rw-r--r--peripheral/libmraa/examples/java/FTDITest.java62
-rw-r--r--peripheral/libmraa/examples/java/GpioMmapped.java60
-rw-r--r--peripheral/libmraa/examples/java/GpioRead6.java55
-rw-r--r--peripheral/libmraa/examples/java/HelloEdison.java73
-rw-r--r--peripheral/libmraa/examples/java/I2cCompass.java135
-rw-r--r--peripheral/libmraa/examples/java/Isr.java65
-rw-r--r--peripheral/libmraa/examples/java/SpiMAX7219.java93
-rw-r--r--peripheral/libmraa/examples/java/SpiMCP4261.java64
-rw-r--r--peripheral/libmraa/examples/java/UartExample.java56
15 files changed, 0 insertions, 1053 deletions
diff --git a/peripheral/libmraa/examples/java/AioA0.java b/peripheral/libmraa/examples/java/AioA0.java
deleted file mode 100644
index 89ef252..0000000
--- a/peripheral/libmraa/examples/java/AioA0.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Author: Nandkishor Sonar
- * Copyright (c) 2014 Intel Corporation.
- * Author: Petre Eftime <petre.p.eftime@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-//! [Interesting]
-import mraa.Aio;
-
-public class AioA0 {
-
- static {
- try {
- System.loadLibrary("mraajava");
- } catch (UnsatisfiedLinkError e) {
- System.err.println(
- "Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" +
- e);
- System.exit(1);
- }
- }
-
- public static void main(String[] args) {
- Aio a0 = new Aio(0);
-
- while (true) {
- int adc_value = a0.read();
- float adc_value_float = a0.readFloat();
- System.out.println(String.format("ADC A0 read %X - %d", adc_value, adc_value));
- System.out.println(String.format("ADC A0 read %.5f", adc_value_float));
- }
-
- }
-}
-//! [Interesting]
diff --git a/peripheral/libmraa/examples/java/BlinkIO.java b/peripheral/libmraa/examples/java/BlinkIO.java
deleted file mode 100644
index 0e9209d..0000000
--- a/peripheral/libmraa/examples/java/BlinkIO.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- * Author: Petre Eftime <petre.p.eftime@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-import mraa.Dir;
-import mraa.Gpio;
-import mraa.Result;
-import mraa.mraa;
-
-public class BlinkIO {
- static {
- try {
- System.loadLibrary("mraajava");
- } catch (UnsatisfiedLinkError e) {
- System.err.println(
- "Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" +
- e);
- System.exit(1);
- }
- }
-
- final static int DEFAULT_IOPIN = 8;
-
- public static void main(String argv[]) throws InterruptedException {
- int iopin = DEFAULT_IOPIN;
- if (argv.length == 0) {
- System.out.println("Provide an int arg if you want to flash on something other than " + DEFAULT_IOPIN);
- } else {
- iopin = Integer.valueOf(argv[0], DEFAULT_IOPIN);
- }
-
- //! [Interesting]
- Gpio gpio = new Gpio(iopin);
- Result result = gpio.dir(Dir.DIR_OUT);
- if (result != Result.SUCCESS) {
- mraa.printError(result);
- System.exit(1);
- }
-
- while (true) {
- gpio.write(1);
- Thread.sleep(1000);
- gpio.write(0);
- Thread.sleep(1000);
- }
- //! [Interesting]
- }
-} \ No newline at end of file
diff --git a/peripheral/libmraa/examples/java/BlinkOnboard.java b/peripheral/libmraa/examples/java/BlinkOnboard.java
deleted file mode 100644
index ee2bab4..0000000
--- a/peripheral/libmraa/examples/java/BlinkOnboard.java
+++ /dev/null
@@ -1,81 +0,0 @@
-import mraa.Dir;
-import mraa.Gpio;
-import mraa.Platform;
-import mraa.mraa;
-
-/*
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- * Author: Jakub Kramarz <jkramarz@virtuslab.com>
- * Copyright (c) 2015 VirtusLab
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-public class BlinkOnboard {
- static {
- try {
- System.loadLibrary("mraajava");
- } catch (UnsatisfiedLinkError e) {
- System.err.println(
- "Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" +
- e);
- System.exit(1);
- }
- }
- public static void main(String argv[]) throws InterruptedException {
- Platform platform = mraa.getPlatformType();
- Gpio gpio, gpio_in;
- if (platform == Platform.INTEL_GALILEO_GEN1) {
- gpio = new Gpio(3);
- } else if (platform == Platform.INTEL_MINNOWBOARD_MAX) {
- gpio = new Gpio(21);
- } else {
- gpio = new Gpio(13);
- }
- System.out.format("Welcome to libmraa\n Version: %s\n Running on %s\n",
- mraa.getVersion(), platform.toString());
-
- gpio.dir(Dir.DIR_OUT);
- // on platforms with physical button use gpio_in
- if (platform == Platform.INTEL_MINNOWBOARD_MAX) {
- gpio_in = new Gpio(14);
- gpio_in.dir(Dir.DIR_IN);
- System.out.println("Press and hold S1 to stop, Press SW1 to shutdown!");
- } else {
- gpio_in = null;
- }
-
- boolean state = false;
- while (true) {
- if (gpio_in != null && gpio_in.read() == 0) {
- return;
- }
- if (state) {
- state = false;
- gpio.write(1);
- } else {
- state = true;
- gpio.write(0);
- }
- Thread.sleep(1000);
- }
- }
-} \ No newline at end of file
diff --git a/peripheral/libmraa/examples/java/Bmp85.java b/peripheral/libmraa/examples/java/Bmp85.java
deleted file mode 100644
index 6cdc2a1..0000000
--- a/peripheral/libmraa/examples/java/Bmp85.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Author: Alexander Komarov <alexander.komarov@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-public class Bmp85 {
- static {
- try {
- System.loadLibrary("mraajava");
- } catch (UnsatisfiedLinkError e) {
- System.err.println(
- "Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" +
- e);
- System.exit(1);
- }
- }
- public static void main(String argv[]) {
- mraa.mraa.init();
- System.out.println(mraa.mraa.getVersion());
-
- // helper function to go from hex val to dec
- // function char(x) { return parseInt(x, 16); }
-
- mraa.I2c i2c = new mraa.I2c(0);
- i2c.address((byte)0x77);
- i2c.writeByte((byte)0xd0);
- /*
- SWIGTYPE_p_unsigned_char data0 = new SWIGTYPE_p_unsigned_char();*/
- byte[] data = new byte[1];
- i2c.read(data);
- System.out.println((new Integer(data[0])).toString());
-
- i2c.writeReg((byte)0xf4, (byte)0x2e);
- // initialise device
- if (i2c.readReg((byte)0xd0) != 0x55) {
- System.out.println("error");
- }
-
- // we want to read temperature so write 0x2e into control reg
- i2c.writeReg((byte)0xf4, (byte)0x2e);
-
- // read a 16bit reg, obviously it's uncalibrated so mostly a useless value
- // :)
- System.out.println(i2c.readWordReg((byte)0xf6));
-
- byte[] buf = new byte[2];
- buf[0] = (byte)0xf4;
- buf[1] = (byte)0x2e;
- i2c.write(buf);
-
- i2c.writeByte((byte)0xf6);
- int d = i2c.readReg((byte)2);
- System.out.println((new Integer(d)).toString());
- };
-}
-;
diff --git a/peripheral/libmraa/examples/java/CyclePwm3.java b/peripheral/libmraa/examples/java/CyclePwm3.java
deleted file mode 100644
index 31bb25c..0000000
--- a/peripheral/libmraa/examples/java/CyclePwm3.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- * Author: Jakub Kramarz <jkramarz@virtuslab.com>
- * Copyright (c) 2015 VirtusLab
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-import mraa.Pwm;
-
-public class CyclePwm3 {
- static {
- try {
- System.loadLibrary("mraajava");
- } catch (UnsatisfiedLinkError e) {
- System.err.println(
- "Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" +
- e);
- System.exit(1);
- }
- }
- public static void main(String argv[]) throws InterruptedException {
- //! [Interesting]
- Pwm pwm = new mraa.Pwm(3);
- pwm.period_us(200);
- pwm.enable(true);
-
- float value = 0;
- while (true) {
- value += 0.01;
- pwm.write(value);
- Thread.sleep(50);
- if (value >= 1) {
- value = 0;
- }
- }
- //! [Interesting]
- }
-}
diff --git a/peripheral/libmraa/examples/java/Example.java b/peripheral/libmraa/examples/java/Example.java
deleted file mode 100644
index e311043..0000000
--- a/peripheral/libmraa/examples/java/Example.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- * Author: Petre Eftime <petre.p.eftime@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-//! [Interesting]
-import mraa.mraa;
-
-public class Example {
- static {
- try {
- System.loadLibrary("mraajava");
- } catch (UnsatisfiedLinkError e) {
- System.err.println(
- "Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" +
- e);
- System.exit(1);
- }
- }
- public static void main(String argv[]) {
- String board = mraa.getPlatformName();
- String version = mraa.getVersion();
- System.out.println("hello mraa");
- System.out.println(String.format("Version: %s", version));
- System.out.println(String.format("Running on %s", board));
- };
-}
-//! [Interesting]
diff --git a/peripheral/libmraa/examples/java/FTDITest.java b/peripheral/libmraa/examples/java/FTDITest.java
deleted file mode 100644
index f7a1c00..0000000
--- a/peripheral/libmraa/examples/java/FTDITest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Author: Petre Eftime <petre.p.eftime@intel.com>
- * Copyright (c) 2016 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-import mraa.*;
-
-public class FTDITest {
-
- public static void main(String[] args) throws InterruptedException {
- String board = mraa.getPlatformName();
- String version = mraa.getVersion();
-
- System.out.println(String.format("Version: %s", version));
- System.out.println(String.format("Running on %s", board));
-
- if (mraa.hasSubPlatform()) {
- System.out.println("Subplatform detected");
-
- /* Print when button is pressed */
- Gpio button = new Gpio(515);
- button.dir(Dir.DIR_IN);
- button.isr(Edge.EDGE_FALLING, new Runnable() {
-
- @Override
- public void run() {
- System.out.println("Button pressed");
- }
- });
-
- /* Blink FTDI board LED */
- Gpio led = new Gpio(514);
- led.dir(Dir.DIR_OUT);
- for (int i = 0;; i = (i + 1) % 2) {
- led.write(i);
- Thread.sleep(500);
- }
- } else {
- System.out.println("Subplatform not detected");
- }
- }
-}
-
diff --git a/peripheral/libmraa/examples/java/GpioMmapped.java b/peripheral/libmraa/examples/java/GpioMmapped.java
deleted file mode 100644
index c780a4e..0000000
--- a/peripheral/libmraa/examples/java/GpioMmapped.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- * Author: Petre Eftime <petre.p.eftime@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-import mraa.Gpio;
-import mraa.mraa;
-
-public class GpioMmapped {
- static {
- try {
- System.loadLibrary("mraajava");
- } catch (UnsatisfiedLinkError e) {
- System.err.println(
- "Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" +
- e);
- System.exit(1);
- }
- }
- public static void main(String argv[]) throws InterruptedException {
- //! [Interesting]
- String board = mraa.getPlatformName();
- String version = mraa.getVersion();
- System.out.println("hello mraa");
- System.out.println(String.format("Version: %s", version));
-
- Gpio gpio = new Gpio(1);
-
- gpio.useMmap(true);
-
- while (true) {
- gpio.write(1);
- Thread.sleep(50);
- gpio.write(0);
- Thread.sleep(50);
- }
- //! [Interesting]
- };
-}
diff --git a/peripheral/libmraa/examples/java/GpioRead6.java b/peripheral/libmraa/examples/java/GpioRead6.java
deleted file mode 100644
index 65854ea..0000000
--- a/peripheral/libmraa/examples/java/GpioRead6.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- * Author: Jakub Kramarz <jkramarz@virtuslab.com>
- * Copyright (c) 2015 VirtusLab
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-import mraa.Dir;
-import mraa.Gpio;
-import mraa.mraa;
-
-public class GpioRead6 {
- static {
- try {
- System.loadLibrary("mraajava");
- } catch (UnsatisfiedLinkError e) {
- System.err.println(
- "Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" +
- e);
- System.exit(1);
- }
- }
- public static void main(String argv[]) throws InterruptedException {
- System.out.println(String.format("MRAA Version: %s\nStarting Read on IO6\n", mraa.getVersion()));
- //! [Interesting]
- Gpio gpio = new Gpio(6);
-
- gpio.dir(Dir.DIR_IN);
-
- while (true) {
- System.out.format("Gpio is %d\n", gpio.read());
- Thread.sleep(1000);
- }
- //! [Interesting]
- }
-}
diff --git a/peripheral/libmraa/examples/java/HelloEdison.java b/peripheral/libmraa/examples/java/HelloEdison.java
deleted file mode 100644
index c6eec43..0000000
--- a/peripheral/libmraa/examples/java/HelloEdison.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Author: Petre Eftime <petre.p.eftime@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-//! [Interesting]
-import mraa.Dir;
-import mraa.Gpio;
-import mraa.IntelEdison;
-import mraa.mraa;
-import mraa.Platform;
-import mraa.Result;
-
-public class HelloEdison {
- static {
- try {
- System.loadLibrary("mraajava");
- } catch (UnsatisfiedLinkError e) {
- System.err.println(
- "Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" +
- e);
- System.exit(1);
- }
- }
- public static void main(String argv[]) {
- Platform platform = mraa.getPlatformType();
-
- if (platform != Platform.INTEL_EDISON_FAB_C) {
- System.err.println("Error: This program can only be run on edison");
- System.exit(Result.ERROR_INVALID_PLATFORM.swigValue());
- }
-
- /*
- * MRAA_INTEL_EDISON_GP182 == 0, so this will initialise pin0 on arduino,
- * which is hardware GPIO 130 and not 182
- * We set the owner to false here, this makes sure that we do not close the
- * gpio from sysfs in mraa_gpio_close meaning it will stay as an output and
- * we will not always transition from 0->1 as gpio182 as output has the
- * default position of '0'. Note that the value could change as a result of
- * a mraa_gpio_dir however meaning we always go from 0->1 or 1->0
- */
- Gpio gpio182 = new Gpio(IntelEdison.INTEL_EDISON_GP182.swigValue(), false);
- gpio182.dir(Dir.DIR_OUT);
-
- int val = gpio182.read();
-
- System.out.println(String.format("GPIO%d (mraa pin %d) was: %d, will set to %d\n", 182,
- gpio182.getPin(), val, val == 0 ? 1 : 0));
-
- gpio182.write(val == 0 ? 1 : 0);
- };
-}
-//! [Interesting]
diff --git a/peripheral/libmraa/examples/java/I2cCompass.java b/peripheral/libmraa/examples/java/I2cCompass.java
deleted file mode 100644
index 6bcebdb..0000000
--- a/peripheral/libmraa/examples/java/I2cCompass.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- * Author: Petre Eftime <petre.p.eftime@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-import mraa.I2c;
-
-public class I2cCompass {
- static {
- try {
- System.loadLibrary("mraajava");
- } catch (UnsatisfiedLinkError e) {
- System.err.println(
- "Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" +
- e);
- System.exit(1);
- }
- }
-
- final static byte MAX_BUFFER_LENGTH = 6;
- final static byte CONF_BUFFER_LENGTH = 2;
- final static short HMC5883L_I2C_ADDR = 0x1E;
-
- // configuration registers
- final static byte HMC5883L_CONF_REG_A = 0x00;
- final static byte HMC5883L_CONF_REG_B = 0x01;
-
- // mode register
- final static byte HMC5883L_MODE_REG = 0x02;
-
- // data register
- final static byte HMC5883L_X_MSB_REG = 0;
- final static byte HMC5883L_X_LSB_REG = 1;
- final static byte HMC5883L_Z_MSB_REG = 2;
- final static byte HMC5883L_Z_LSB_REG = 3;
- final static byte HMC5883L_Y_MSB_REG = 4;
- final static byte HMC5883L_Y_LSB_REG = 5;
- final static byte DATA_REG_SIZE = 6;
-
- // status register
- final static byte HMC5883L_STATUS_REG = 0x09;
-
- // ID registers
- final static byte HMC5883L_ID_A_REG = 0x0A;
- final static byte HMC5883L_ID_B_REG = 0x0B;
- final static byte HMC5883L_ID_C_REG = 0x0C;
-
- final static byte HMC5883L_CONT_MODE = 0x00;
- final static byte HMC5883L_DATA_REG = 0x03;
-
- // scales
- final static byte GA_0_88_REG = ((byte) (0x00 << 5));
- final static byte GA_1_3_REG = ((byte) (0x01 << 5));
- final static byte GA_1_9_REG = ((byte) (0x02 << 5));
- final static byte GA_2_5_REG = ((byte) (0x03 << 5));
- final static byte GA_4_0_REG = ((byte) (0x04 << 5));
- final static byte GA_4_7_REG = ((byte) (0x05 << 5));
- final static byte GA_5_6_REG = ((byte) (0x06 << 5));
- final static byte GA_8_1_REG = ((byte) (0x07 << 5));
-
- // digital resolutions
- final static float SCALE_0_73_MG = 0.73f;
- final static float SCALE_0_92_MG = 0.92f;
- final static float SCALE_1_22_MG = 1.22f;
- final static float SCALE_1_52_MG = 1.52f;
- final static float SCALE_2_27_MG = 2.27f;
- final static float SCALE_2_56_MG = 2.56f;
- final static float SCALE_3_03_MG = 3.03f;
- final static float SCALE_4_35_MG = 4.35f;
-
- public static void main(String[] args) throws InterruptedException {
- float direction = 0;
- int x, y, z;
- byte[] rx_tx_buf = new byte[MAX_BUFFER_LENGTH];
- byte[] conf_buf = new byte[CONF_BUFFER_LENGTH];
-
- //! [Interesting]
- I2c i2c = new I2c(0);
-
- i2c.address(HMC5883L_I2C_ADDR);
- conf_buf[0] = HMC5883L_CONF_REG_B;
- conf_buf[1] = GA_1_3_REG;
- i2c.write(conf_buf);
- //! [Interesting]
-
- i2c.address(HMC5883L_I2C_ADDR);
- conf_buf[0] = HMC5883L_MODE_REG;
- conf_buf[1] = HMC5883L_CONT_MODE;
- i2c.write(conf_buf);
-
- while (true) {
- i2c.address(HMC5883L_I2C_ADDR);
- i2c.writeByte(HMC5883L_DATA_REG);
-
- i2c.address(HMC5883L_I2C_ADDR);
- i2c.read(rx_tx_buf);
-
- x = (rx_tx_buf[HMC5883L_X_MSB_REG] << 8) | rx_tx_buf[HMC5883L_X_LSB_REG];
- z = (rx_tx_buf[HMC5883L_Z_MSB_REG] << 8) | rx_tx_buf[HMC5883L_Z_LSB_REG];
- y = (rx_tx_buf[HMC5883L_Y_MSB_REG] << 8) | rx_tx_buf[HMC5883L_Y_LSB_REG];
-
- direction = (float) Math.atan2(y * SCALE_0_92_MG, x * SCALE_0_92_MG);
-
- if (direction < 0)
- direction += 2 * Math.PI;
-
- System.out.println(String.format("Compass scaled data x : %f, y : %f, z : %f\n", x * SCALE_0_92_MG, y * SCALE_0_92_MG,
- z * SCALE_0_92_MG));
- System.out.println(String.format("Heading : %f\n", direction * 180 / Math.PI));
- Thread.sleep(1000);
- }
- }
-}
diff --git a/peripheral/libmraa/examples/java/Isr.java b/peripheral/libmraa/examples/java/Isr.java
deleted file mode 100644
index a43dcc7..0000000
--- a/peripheral/libmraa/examples/java/Isr.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Author: Alexander Komarov <alexander.komarov@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-import mraa.Dir;
-import mraa.Edge;
-import mraa.Gpio;
-
-public class Isr {
- static {
- try {
- System.loadLibrary("mraajava");
- } catch (UnsatisfiedLinkError e) {
- System.err.println(
- "Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" +
- e);
- System.exit(1);
- }
- }
- public static void main(String argv[]) throws InterruptedException {
- int pin = 6;
- if (argv.length == 1) {
- try {
- pin = Integer.parseInt(argv[0]);
- } catch (Exception e) {
- }
- }
- System.out.println("Starting ISR for pin " + Integer.toString(pin));
- Gpio gpio = new Gpio(pin);
-
- Runnable callback = new JavaCallback();
-
- gpio.isr(Edge.EDGE_RISING, callback);
- while (true)
- Thread.sleep(999999);
- };
-
-}
-
-class JavaCallback implements Runnable {
- @Override
- public void run() {
- System.out.println("Gpio level changed");
- }
-}
diff --git a/peripheral/libmraa/examples/java/SpiMAX7219.java b/peripheral/libmraa/examples/java/SpiMAX7219.java
deleted file mode 100644
index 0899a85..0000000
--- a/peripheral/libmraa/examples/java/SpiMAX7219.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Author: Michael Ring <mail@michael-ring.org>
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- * Author: Petre Eftime <petre.p.eftime@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-import java.nio.ByteBuffer;
-import mraa.Result;
-import mraa.Spi;
-
-public class SpiMAX7219 {
- static {
- try {
- System.loadLibrary("mraajava");
- } catch (UnsatisfiedLinkError e) {
- System.err.println(
- "Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" +
- e);
- System.exit(1);
- }
- }
- public static void main(String argv[]) throws InterruptedException {
- //! [Interesting]
- Spi spi = new Spi(1);
-
- spi.frequency(400000);
- spi.lsbmode(false);
-
- if(spi.bitPerWord(16) != Result.SUCCESS) {
- System.err.println("Could not set SPI Device to 16Bit mode, exit...");
- System.exit(1);
- }
-
- spi.write_word(0x0900); //Do not decode bits
- spi.write_word(0x0a05); // Brightness of LEDs
- spi.write_word(0x0b07); // Show all Scan Lines
- spi.write_word(0x0c01); // Display on
- spi.write_word(0x0f00); // Testmode off
-
- short dataAA55[] = { 0x01aa, 0x0255, 0x03aa, 0x0455, 0x05aa, 0x0655, 0x07aa, 0x0855 };
- ByteBuffer buf = ByteBuffer.allocate(dataAA55.length * 2);
- for (int i = 0; i < dataAA55.length; i++)
- buf.putShort(dataAA55[i]);
-
- spi.write(buf.array());
- Thread.sleep(2000);
-
- short data55AA[] = { 0x0155, 0x02aa, 0x0355, 0x04aa, 0x0555, 0x06aa, 0x0755, 0x08aa };
- buf = ByteBuffer.allocate(data55AA.length * 2);
- for (int i = 0; i < data55AA.length; i++)
- buf.putShort(data55AA[i]);
-
- spi.write(buf.array());
- Thread.sleep(2000);
-
- short data[] = { 0x0100, 0x0200, 0x0300, 0x0400, 0x0500, 0x0600, 0x0700, 0x0800 };
- buf = ByteBuffer.allocate(data.length * 2);
- for (int i = 0; i < data.length; i++)
- buf.putShort(data[i]);
-
- spi.write(buf.array());
-
- for (int i = 1; i <= 8; i++) {
- for (int j = 0; j < 8; j++) {
- spi.write_word((i << 8) + (1 << j));
- Thread.sleep(1000);
- }
- spi.write_word(i << 8);
- }
- //! [Interesting]
- };
-}
diff --git a/peripheral/libmraa/examples/java/SpiMCP4261.java b/peripheral/libmraa/examples/java/SpiMCP4261.java
deleted file mode 100644
index 7ebda57..0000000
--- a/peripheral/libmraa/examples/java/SpiMCP4261.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Author: Alexander Komarov <alexander.komarov@intel.com>
- * Copyright (c) 2014 Intel Corporation.
- * Author: Petre Eftime <petre.p.eftime@intel.com>
- * Copyright (c) 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-import mraa.Spi;
-
-public class SpiMCP4261 {
- static {
- try {
- System.loadLibrary("mraajava");
- } catch (UnsatisfiedLinkError e) {
- System.err.println(
- "Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" +
- e);
- System.exit(1);
- }
- }
- public static void main(String argv[]) throws InterruptedException {
- //! [Interesting]
- Spi spi = new Spi(0);
-
- System.out.println("Hello, SPI initialised");
- byte data[] = {0x00, 100};
- while (true) {
- for (int i = 90; i < 130; i++) {
- data[1] = (byte) i;
- byte[] recv = spi.write(data);
- System.out.println(String.format("Writing - %d", i));
- System.out.println(String.format("Received - %d - %d", recv[0], recv[1]));
- Thread.sleep(100);
- }
- for (int i = 130; i > 90; i--) {
- data[1] = (byte) i;
- byte[] recv = spi.write(data);
- System.out.println(String.format("Writing - %d", i));
- System.out.println(String.format("Received - %d - %d", recv[0], recv[1]));
- Thread.sleep(100);
- }
- }
- //! [Interesting]
- };
-}
diff --git a/peripheral/libmraa/examples/java/UartExample.java b/peripheral/libmraa/examples/java/UartExample.java
deleted file mode 100644
index 5370a82..0000000
--- a/peripheral/libmraa/examples/java/UartExample.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
- * Author: Brendan Le Foll <brendan.le.foll@intel.com>
- * Author: Petre Eftime <petre.p.eftime@intel.com>
- * Copyright (c) 2014, 2015 Intel Corporation.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-import mraa.Result;
-import mraa.Uart;
-import mraa.UartParity;
-
-public class UartExample {
-
- public static void main(String[] args) {
- //! [Interesting]
- Uart uart = new Uart(0);
-
- if (uart.setBaudRate(115200) != Result.SUCCESS) {
- System.err.println("Error setting baud rate");
- System.exit(1);
- }
-
- if (uart.setMode(8, UartParity.UART_PARITY_NONE, 1) != Result.SUCCESS) {
- System.err.println("Error setting mode");
- System.exit(1);
- }
-
- if (uart.setFlowcontrol(false, false) != Result.SUCCESS) {
- System.err.println("Error setting flow control");
- System.exit(1);
- }
-
- uart.writeStr("Hello monkeys");
- //! [Interesting]
- }
-} \ No newline at end of file