IDE stubs @ 1.1.0
The PHP declarations of the functions, classes and constants this package adds, with their docblocks, so PhpStorm and Intelephense can complete and type-check your firmware code.
You don't need to download them: on every composer install and
composer update, conductor copies them into
vendor/php-baremetal/ide-stubs/, which IDEs index without configuration.
They are never loaded at runtime.
<?php
// php-baremetal/ext-gpio 1.1.0 — IDE helper, not loaded at runtime.
namespace {
/**
* Input mode for gpio_mode().
*/
const GPIO_INPUT = 0;
/**
* Output mode for gpio_mode(); the pin stays readable.
*/
const GPIO_OUTPUT = 1;
/**
* Makes a pin an input or an output, after resetting it to its default state.
*
* The reset selects the GPIO function, disconnects any peripheral from the pin and enables the internal
* pull-up, so an input reads 1 when nothing drives it. Output mode keeps the input on, so gpio_read()
* returns what the pin is driving. The output level is not set: call gpio_write() right after it to start
* from a known state. The pin number is not range-checked: a pin the chip does not have raises no PHP
* error and the call does nothing.
*
* @param int $pin The chip's GPIO number (not a header position).
* @param int $mode GPIO_INPUT (0) or GPIO_OUTPUT; any value other than 0 means output.
* @return void
* @throws \TypeError When an argument is not an int (strict int arguments).
*/
function gpio_mode(int $pin, int $mode): void {}
/**
* Sets the level of an output pin; on a pin configured as an input it has no visible effect.
*
* @param int $pin The chip's GPIO number of an output pin.
* @param int $level 0 for low; any other value for high.
* @return void
* @throws \TypeError When an argument is not an int (strict int arguments).
*/
function gpio_write(int $pin, int $level): void {}
/**
* Reads the current level of a pin; it works on inputs and on outputs (an output reads back the driven level).
*
* @param int $pin The chip's GPIO number.
* @return int The level of the pin: 0 or 1.
* @throws \TypeError When $pin is not an int (strict int arguments).
*/
function gpio_read(int $pin): int {}
/**
* Tells that the extension is in the firmware; without ext-gpio the function does not exist.
*
* @return bool Always true.
*/
function gpio_available(): bool {}
}