コード例 #1
0
ファイル: lcd.php プロジェクト: summychou/berryio
function lcd_initialise()
{
    // Set the required GPIO pins to output
    if (!gpio_set_mode(LCD_RS_GPIO, 'out') || !gpio_set_mode(LCD_ES_GPIO, 'out') || !gpio_set_mode(LCD_D4_GPIO, 'out') || !gpio_set_mode(LCD_D5_GPIO, 'out') || !gpio_set_mode(LCD_D6_GPIO, 'out') || !gpio_set_mode(LCD_D7_GPIO, 'out')) {
        return FALSE;
    }
    // Send Initialise Codes
    if (!_lcd_set_mode(FALSE) || !_lcd_send(0b110011) || !_lcd_send(0b110010)) {
        return FALSE;
    }
    // Reset LCD
    if (!lcd_command('2_line_5x8', 'on_no_cursor', 'clear', 'text_forwards')) {
        return FALSE;
    }
    return TRUE;
}
コード例 #2
0
ファイル: gpio.php プロジェクト: summychou/berryio
function gpio_set_modes($modes)
{
    $count = 0;
    foreach ($modes as $pin => $mode) {
        if (gpio_set_mode($pin, $mode)) {
            $count++;
        }
    }
    return $count;
}
コード例 #3
0
ファイル: gpio_set_mode.php プロジェクト: summychou/berryio
<?php

/*------------------------------------------------------------------------------
  BerryIO GPIO Set Mode 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 mode information');
    return FALSE;
}
// Set the GPIO Mode
if (gpio_set_mode($args[0], $args[1]) === FALSE) {
    $content .= message('ERROR: Cannot set GPIO pin "' . $args[0] . '" into mode "' . $args[1] . '"', 'gpio_status');
    return FALSE;
}
if ($GLOBALS['EXEC_MODE'] != 'api') {
    $content .= go_to('gpio_status');
}