| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -54,24 +54,6 @@ public I2C(String dev) { | |||
| 54 | 54 | } | |
| 55 | 55 | ||
| 56 | 56 | ||
| 57 | - /** | ||
| 58 | - * Close the I2C device | ||
| 59 | - */ | ||
| 60 | - public void close() { | ||
| 61 | - NativeInterface.closeDevice(handle); | ||
| 62 | - handle = 0; | ||
| 63 | - } | ||
| 64 | - | ||
| 65 | - | ||
| 66 | - protected void finalize() throws Throwable { | ||
| 67 | - try { | ||
| 68 | - close(); | ||
| 69 | - } finally { | ||
| 70 | - super.finalize(); | ||
| 71 | - } | ||
| 72 | - } | ||
| 73 | - | ||
| 74 | - | ||
| 75 | 57 | /** | |
| 76 | 58 | * Begins a transmission to an attached device | |
| 77 | 59 | * | |
@@ -84,7 +66,7 @@ protected void finalize() throws Throwable { | |||
| 84 | 66 | * of the i2cdetect tool. | |
| 85 | 67 | * If the address provided in a datasheet is greater than 127 (hex 0x7f) | |
| 86 | 68 | * or there are separate addresses for read and write operations listed, | |
| 87 | - * which vary exactly by one, then you want to shif the this number by | ||
| 69 | + * which vary exactly by one, then you want to shift the this number by | ||
| 88 | 70 | * one bit to the right before passing it as an argument to this function. | |
| 89 | 71 | * @param slave 7 bit address of slave device | |
| 90 | 72 | * @see write | |
@@ -103,6 +85,24 @@ public void beginTransmission(int slave) { | |||
| 103 | 85 | } | |
| 104 | 86 | ||
| 105 | 87 | ||
| 88 | + /** | ||
| 89 | + * Closes the I2C device | ||
| 90 | + */ | ||
| 91 | + public void close() { | ||
| 92 | + NativeInterface.closeDevice(handle); | ||
| 93 | + handle = 0; | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | + | ||
| 97 | + protected void finalize() throws Throwable { | ||
| 98 | + try { | ||
| 99 | + close(); | ||
| 100 | + } finally { | ||
| 101 | + super.finalize(); | ||
| 102 | + } | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + | ||
| 106 | 106 | /** | |
| 107 | 107 | * Ends the current transmissions | |
| 108 | 108 | * | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -81,7 +81,7 @@ public PWM(String channel) { | |||
| 81 | 81 | ||
| 82 | 82 | ||
| 83 | 83 | /** | |
| 84 | - * Disables the output | ||
| 84 | + * Disables the PWM output | ||
| 85 | 85 | */ | |
| 86 | 86 | public void clear() { | |
| 87 | 87 | String fn = String.format("/sys/class/pwm/%s/gpio%d/enable", chip, channel); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -64,7 +64,7 @@ public SPI(String dev) { | |||
| 64 | 64 | ||
| 65 | 65 | ||
| 66 | 66 | /** | |
| 67 | - * Closes the I2C interface | ||
| 67 | + * Closes the SPI interface | ||
| 68 | 68 | */ | |
| 69 | 69 | public void close() { | |
| 70 | 70 | NativeInterface.closeDevice(handle); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments