# Returns null on success
fun file_rename_to(dest: String): nullable String import String.to_cstring,
NativeString.to_s, String.as nullable `{
- int res = rename(String_to_cstring(recv), String_to_cstring(dest));
+ int res = rename(String_to_cstring(self), String_to_cstring(dest));
if (res == 0) return null_String();
return String_as_nullable(NativeString_to_s(strerror(errno)));
`}
`}
# The pin `id` depends on wiringPi setup used
- fun id: Int `{ return recv->id; `}
+ fun id: Int `{ return self->id; `}
# Sets the mode of the pin
- fun mode(mode: RPiPinMode) `{ pinMode(recv->id, mode); `}
+ fun mode(mode: RPiPinMode) `{ pinMode(self->id, mode); `}
# This sets the pull-up or pull-down resistor mode on the given pin,
# which should be set as an input.
- fun pullup_dncontrol(pud: PUDControl) `{ pullUpDnControl(recv->id, pud); `}
+ fun pullup_dncontrol(pud: PUDControl) `{ pullUpDnControl(self->id, pud); `}
# Writes the value HIGH or LOW (true or false) to the given pin which must
# have been previously set as an output.
- fun write(high: Bool) `{ digitalWrite(recv->id, high? HIGH: LOW); `}
+ fun write(high: Bool) `{ digitalWrite(self->id, high? HIGH: LOW); `}
# Writes the value to the PWM register for the given pin.
# The Raspberry Pi has one on-board PWM pin, pin 1 (BMC_GPIO 18, Phys 12)
# and the range is 0-1024.
# Other PWM devices may have other PWM ranges.
- fun pwm_write(value: Int) `{ pwmWrite(recv->id, value); `}
+ fun pwm_write(value: Int) `{ pwmWrite(self->id, value); `}
# This function returns the value read at the given pin.
# It will be HIGH or LOW (true or false) depending on the logic level at the pin.
- fun read: Bool `{ return digitalRead(recv->id) == HIGH? true: false; `}
+ fun read: Bool `{ return digitalRead(self->id) == HIGH? true: false; `}
end
# RPI Pin modes