@@ -89,7 +89,7 @@ public PWM(String channel) {
8989 * @webref
9090 */
9191 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 );
9393 int ret = NativeInterface .writeFile (fn , "0" );
9494 if (ret < 0 ) {
9595 throw new RuntimeException (NativeInterface .getError (ret ));
@@ -156,14 +156,14 @@ public static String[] list() {
156156 */
157157 public void set (int period , float duty ) {
158158 // 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 );
160160 int ret = NativeInterface .writeFile (fn , String .format ("%d" , (int )(1000000000 / period )));
161161 if (ret < 0 ) {
162162 throw new RuntimeException (fn + ": " + NativeInterface .getError (ret ));
163163 }
164164
165165 // 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 );
167167 if (duty < 0.0 || 1.0 < duty ) {
168168 System .err .println ("Duty cycle must be between 0.0 and 1.0." );
169169 throw new IllegalArgumentException ("Illegal argument" );
@@ -174,7 +174,7 @@ public void set(int period, float duty) {
174174 }
175175
176176 // 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 );
178178 ret = NativeInterface .writeFile (fn , "1" );
179179 if (ret < 0 ) {
180180 throw new RuntimeException (fn + ": " + NativeInterface .getError (ret ));
0 commit comments