NAME

    RPi::WiringPi::Core - Perl wrapper for Raspberry Pi's wiringPi Core and
    System functions

DESCRIPTION

    WARNING: Until version 1.00 has been released, the API along with
    functionality may change at any time without any notice. If you happen
    to be testing with this software and find something broken, please
    contact me.

    This is an XS-based module, and requires wiringPi <http://wiringpi.com>
    to be installed.

    It provides Perl method access to (at this time, most of) the wiringPi
    Core <http://wiringpi.com/reference/core-functions> along with a few of
    its system functions.

    Although this module can be used directly, it's generally used as a
    base class for other modules. You may want to use the RPi::WiringPi
    module instead of this one.

CORE METHODS

 new()

    Returns a new RPi::WiringPi::Core object.

 setup()

    Maps to int wiringPiSetup()

    See wiringPi setup functions <http://wiringpi.com/reference/setup> for
    for information on this method.

    Note that only one of the setup*() methods can be called per program
    run.

 setup_sys()

    Maps to int wiringPiSetupSys()

    See wiringPi setup functions <http://wiringpi.com/reference/setup> for
    for information on this method.

    Note that only one of the setup*() methods can be called per program
    run.

 setup_phys()

    Maps to int wiringPiSetupPhys()

    See wiringPi setup functions <http://wiringpi.com/reference/setup> for
    for information on this method.

    Note that only one of the setup*() methods can be called per program
    run.

 setup_gpio()

    Maps to int wiringPiSetupGpio()

    See wiringPi setup functions <http://wiringpi.com/reference/setup> for
    for information on this method.

    Note that only one of the setup*() methods can be called per program
    run.

 pin_mode($pin, $mode)

    Maps to void pinMode(int pin, int mode)

    Puts the GPIO pin in either INPUT or OUTPUT mode.

    Parameters:

        $pin

    Mandatory: The GPIO pin number, using wiringPi's pin number
    representation.

        $mode

    Mandatory: 0 for INPUT, 1 OUTPUT, 2 PWM_OUTPUT and 3 GPIO_CLOCK.

 read_pin($pin);

    Maps to int digitalRead(int pin)

    Returns the current state (HIGH/on, LOW/off) of a given pin.

    Parameters:

        $pin

    Mandatory: The wiringPi number representation of the GPIO pin.

 write_pin($pin, $state)

    Maps to void digitalWrite(int pin)

    Sets the state (HIGH/on, LOW/off) of a given pin.

    Parameters:

        $pin

    Mandatory: The wiringPi number representation of the GPIO pin.

        $state

    Mandatory: 1 to turn the pin on (HIGH), and 0 to turn it LOW (off).

 pull_up_down($pin, $direction)

    Maps to void pullUpDnControl(int pin, int pud)

    Enable/disable the built-in pull up/down resistors for a specified pin.

    Parameters:

        $pin

    Mandatory: The wiringPi number representation of the GPIO pin.

        $direction

    Mandatory: 2 for UP, 1 for DOWN and 0 to disable the resistor.

 pwm_write($pin, $value)

    Maps to void pwmWrite(int pin, int value)

    Sets the Pulse Width Modulation duty cycle (on-time) of the pin.

    Parameters:

        $pin

    Mandatory: The wiringPi number representation of the GPIO pin.

        $value

    Mandatory: 0 to 1023. 0 is 0% (off) and 1023 is 100% (fully on).

 get_alt($pin)

    Maps to int getAlt(int pin)

    This returns the current mode of the pin (using getAlt() C call). Modes
    are INPUT 0, OUTPUT 1, PWM 2 and CLOCK 3.

    Parameters:

        $pin

    Mandatory: The wiringPi number representation of the GPIO pin.

BOARD METHODS

 board_rev()

    Maps to int piBoardRev()

    Returns the Raspberry Pi board's revision.

 wpi_to_gpio($pin_num)

    Maps to int wpiPinToGpio(int pin)

    Converts a wiringPi pin number to the Broadcom (BCM) representation,
    and returns it.

    Parameters:

        $pin_num

    Mandatory: The wiringPi representation of a pin number.

 phys_to_gpio($pin_num)

    Maps to int physPinToGpio(int pin)

    Converts the pin number on the physical board to the Broadcom (BCM)
    representation, and returns it.

    Parameters:

        $pin_num

    Mandatory: The pin number on the physical Raspberry Pi board.

 pwm_set_range($range);

    Maps to void pwmSetRange(int range)

    Sets the range register of the Pulse Width Modulation (PWM)
    functionality. It defaults to 1024 (0-1023).

    Parameters:

        $range

    Mandatory: An integer between 0 and 1023.

AUTHOR

    Steve Bertrand, <steveb@cpan.org>

COPYRIGHT AND LICENSE

    Copyright (C) 2016 by Steve Bertrand

    This library is free software; you can redistribute it and/or modify it
    under the same terms as Perl itself, either Perl version 5.18.2 or, at
    your option, any later version of Perl 5 you may have available.

