All Projects → 1nv1 → php-periphery-serial

1nv1 / php-periphery-serial

Licence: MIT license
A php extension for peripheral I/O Serial in Linux (wrapper of c-periphery)

Programming Languages

c
50402 projects - #5 most used programming language
PHP
23972 projects - #3 most used programming language
C++
36643 projects - #6 most used programming language
M4
1887 projects

Projects that are alternatives of or similar to php-periphery-serial

Kau
An extensive collection of Kotlin Android Utils
Stars: ✭ 182 (+1300%)
Mutual labels:  extensions
extensions-kit
📦 Collection of Swift+Apple Frameworks extensions for speeding up software development [iOS & iPadOS].
Stars: ✭ 71 (+446.15%)
Mutual labels:  extensions
lumira-extension-viz
lumira
Stars: ✭ 84 (+546.15%)
Mutual labels:  extensions
Numi
Beautiful calculator app for macOS
Stars: ✭ 3,258 (+24961.54%)
Mutual labels:  extensions
SerialPundit
Serial port communication in Java - FTDI D2XX, HID API, X/Y modem
Stars: ✭ 116 (+792.31%)
Mutual labels:  serial-port
bl602-pac
Embedded Rust's Peripheral Access Crate for BL602 microcontrollers
Stars: ✭ 16 (+23.08%)
Mutual labels:  peripheral
Circle
让网页赏心悦目、让阅读回归初心。Circle 阅读模式提供更隐私、更轻松、更舒适的网页阅读体验
Stars: ✭ 158 (+1115.38%)
Mutual labels:  extensions
convey
Communication through a serial port or named pipe
Stars: ✭ 46 (+253.85%)
Mutual labels:  serial-port
D365FONinjaDevTools
To make of you a Ninja Developer in Dynamics 365 For Finance and Operations
Stars: ✭ 70 (+438.46%)
Mutual labels:  extensions
UnitySubstanceExtensions
Repository for extensions to the Substance plugin introduced in Unity 2018.1.
Stars: ✭ 17 (+30.77%)
Mutual labels:  extensions
Home
A configurable and eXtensible Xml serializer for .NET.
Stars: ✭ 208 (+1500%)
Mutual labels:  extensions
Qliksense Extension Tutorial
A comprehensive tutorial how to create Qlik Sense Visualization Extensions.
Stars: ✭ 244 (+1776.92%)
Mutual labels:  extensions
NString
A collection of utilities for working with strings in .NET.
Stars: ✭ 34 (+161.54%)
Mutual labels:  extensions
Browser Base
Modern and feature-rich web browser base based on Electron
Stars: ✭ 2,417 (+18492.31%)
Mutual labels:  extensions
EPPlus.Core.Extensions
An extensions library for EPPlus package to generate and manipulate Excel files easily.
Stars: ✭ 66 (+407.69%)
Mutual labels:  extensions
Torchfunc
PyTorch functions and utilities to make your life easier
Stars: ✭ 177 (+1261.54%)
Mutual labels:  extensions
man-in-the-middle
Modify requests, inject JavaScript and CSS into pages
Stars: ✭ 74 (+469.23%)
Mutual labels:  extensions
standardnotes-extensions
Standard Notes Extensions
Stars: ✭ 16 (+23.08%)
Mutual labels:  extensions
extensions
Code Generators and Extensions for vanilla-rtb stack
Stars: ✭ 16 (+23.08%)
Mutual labels:  extensions
katlib
Companion to Kotlin standard library
Stars: ✭ 70 (+438.46%)
Mutual labels:  extensions

php-periphery-serial Build Status GitHub release License

A php extension for peripheral I/O Serial in GNU/Linux.

Introduction

The goal of this project is build a wrapper (serial I/O) of c-periphery library.

Warning

This project really has two goal, the first is create a wrapper and the second is learn about php extensions. It's my first project around this.

Right now I uploaded to sourceforge two compilations of the extension. One is for x86_64 target system and the other was build on a x86. The last one was tested with real electronics hardware without problems.

Next steps

  • Public attributes
  • Testing arguments
  • Test again over real hardware (x86/x86_64)
  • Documentation of class
  • I will keep uploading compiled versions
  • Errors support

Documentation

You can access to documentation to class in this link.

Download

You can download the compiled library in the sourceforge page.

Build

Previous, do you need install the developer package of ^PHP7x. In Fedora:

# dnf install php-devel

Now, clone the repo:

$ git clone --recurse-submodules -j8 https://github.com/1nv1/php-periphery-serial.git

To compile, you need to do these steps

$ phpize
$ ./configure --enable-periphery_serial
$ make
# make install

Do you need clean the project?

$ make clean && phpize --clean

Example

This is a simple example:

<?php

// Class for use periphery-serial
require_once dirname(__FILE__).$relative_path_to."/class/Periphery.php";

// Create an instance
$pb = new Periphery\Serial();

// Yo can see the version of c-periphery embedded
echo "Version: ".$pb->version().PHP_EOL;

// Now, open the serial port: path to device and baudrate
$res = $pb->open("/dev/ttyUSB0", 38400) ? 'yes' : 'no';
if ($res == 'no') {
  echo "Error at open!".PHP_EOL;
  die();
}
echo "Open: yes".PHP_EOL;

echo "Flush...".PHP_EOL;
$pb->flush();

// Take the "string" to send and convert it in array
$send = str_split("RP");
echo "Write: ".$pb->write($send, 2).PHP_EOL;
echo "Read: ";

// Do you need wait 30 bytes response with a 2 senconds of timeout?
$res = $pb->read(30, 2000);
if (!empty($res)) { var_dump($res); }
else { echo PHP_EOL; }

// You expects 30 bytes with a 2 senconds of timeout
echo "Close: ".($pb->close() ? 'yes' : 'no').PHP_EOL;

License

php-periphery-serial is MIT licensed. See the included LICENSE file.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].