IDE stubs @ 1.0.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/io-ch422g 1.0.0 — IDE helper, not loaded at runtime.
namespace Baremetal\I2c\Driver {
/**
* The CH422G I/O expander: pins exio0 to exio7 (all outputs) and oc0 to oc3. Writes are whole registers: the
* driver keeps a copy, so set() changes only the pin named. Other drivers use the same pins by name from the
* board file ("exio2"); they share this copy.
*/
class Ch422g extends \Baremetal\I2c\Device
{
/**
* The chip on $bus (its fixed addresses 0x24, 0x38, 0x23 and 0x26). The first object on a bus writes the
* outputs (all high except $inputs) and turns exio0 to exio7 into outputs; later ones share that state, and
* inputs they list that are not inputs yet are written low and refused from then on (inputs only grow).
*
* @param string $inputs EXIO pins wired to inputs, as 'exio0,exio5': kept low, refused by set() and get().
* @throws \ValueError When $inputs is not a list of EXIO pins.
* @throws \RuntimeException When the chip does not answer.
*/
public function __construct(\Baremetal\I2c\Bus $bus, string $inputs = '') {}
/** The expander described by the board's block (by default 'expander'), on the bus of its 'i2c' block. */
public static function onboard(string $block = 'expander'): Ch422g {}
/**
* Drives a pin high (true) or low (false).
*
* @throws \ValueError When $pin is not exio0 to exio7 or oc0 to oc3.
* @throws \LogicException When $pin is an input of the board.
* @throws \RuntimeException When the write fails.
*/
public function set(string $pin, bool $on): void {}
/**
* The level last set on an output pin. The CH422G cannot read its pins while they are outputs, so an input
* of the board throws instead of guessing.
*
* @throws \ValueError When $pin is not exio0 to exio7 or oc0 to oc3.
* @throws \LogicException When $pin is an input of the board.
*/
public function get(string $pin): bool {}
}
}