@@ -89,7 +89,7 @@ public PWM(String channel) { |
89 | 89 | * @webref |
90 | 90 | */ |
91 | 91 | public void clear() { |
92 | | - String fn = String.format("/sys/class/pwm/%s/gpio%d/enable", chip, channel); |
| 92 | + String fn = String.format("/sys/class/pwm/%s/pwm%d/enable", chip, channel); |
93 | 93 | int ret = NativeInterface.writeFile(fn, "0"); |
94 | 94 | if (ret < 0) { |
95 | 95 | throw new RuntimeException(NativeInterface.getError(ret)); |
@@ -156,14 +156,14 @@ public static String[] list() { |
156 | 156 | */ |
157 | 157 | public void set(int period, float duty) { |
158 | 158 | // set period |
159 | | - String fn = fn = String.format("/sys/class/pwm/%s/gpio%d/period", chip, channel); |
| 159 | + String fn = fn = String.format("/sys/class/pwm/%s/pwm%d/period", chip, channel); |
160 | 160 | int ret = NativeInterface.writeFile(fn, String.format("%d", (int)(1000000000 / period))); |
161 | 161 | if (ret < 0) { |
162 | 162 | throw new RuntimeException(fn + ": " + NativeInterface.getError(ret)); |
163 | 163 | } |
164 | 164 |
|
165 | 165 | // set duty cycle |
166 | | - fn = fn = String.format("/sys/class/pwm/%s/gpio%d/duty", chip, channel); |
| 166 | + fn = fn = String.format("/sys/class/pwm/%s/pwm%d/duty", chip, channel); |
167 | 167 | if (duty < 0.0 || 1.0 < duty) { |
168 | 168 | System.err.println("Duty cycle must be between 0.0 and 1.0."); |
169 | 169 | throw new IllegalArgumentException("Illegal argument"); |
@@ -174,7 +174,7 @@ public void set(int period, float duty) { |
174 | 174 | } |
175 | 175 |
|
176 | 176 | // enable output |
177 | | - fn = String.format("/sys/class/pwm/%s/gpio%d/enable", chip, channel); |
| 177 | + fn = String.format("/sys/class/pwm/%s/pwm%d/enable", chip, channel); |
178 | 178 | ret = NativeInterface.writeFile(fn, "1"); |
179 | 179 | if (ret < 0) { |
180 | 180 | throw new RuntimeException(fn + ": " + NativeInterface.getError(ret)); |
|