function _lcd_set_mode($character_mode) { // Make sure the enable line is low before we start if (!gpio_set_value(LCD_ES_GPIO, 0)) { return FALSE; } // Set Register Select to the correct mode mode if (!gpio_set_value(LCD_RS_GPIO, $character_mode ? 1 : 0)) { return FALSE; } time_nanosleep(0, LCD_TIMING_TSU1); return TRUE; }
function gpio_set_values($values) { $count = 0; foreach ($values as $pin => $value) { if (gpio_set_value($pin, $value)) { $count++; } } return $count; }
<?php /*------------------------------------------------------------------------------ BerryIO GPIO Set Value Command ------------------------------------------------------------------------------*/ $title = 'GPIO Control'; // Load the GPIO functions require_once FUNCTIONS . 'gpio.php'; // Check the args if (count($args) != 2) { $content .= usage('Please provide pin and value information'); return FALSE; } // Set the GPIO value if (gpio_set_value($args[0], $args[1]) === FALSE) { $content .= message('ERROR: Cannot set GPIO pin "' . $args[0] . '" to value "' . $args[1] . '" (is it in out mode?)', 'gpio_status'); return FALSE; } if ($GLOBALS['EXEC_MODE'] != 'api') { $content .= go_to('gpio_status'); }