Giter VIP home page Giter VIP logo

chip-gpio's People

Contributors

denis2222 avatar jeremyscalpello avatar scotty-p avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

chip-gpio's Issues

Write down a TODO list

What this mapping actually stands for?

var MAPPING = [408, 409, 410, 411, 412, 413, 414, 415];

Does chip-gpio works with all the chip's GPIO? Perhaps shouldn't we make like a TODO list for this lib? I could help filling the missing pieces.

Publish new version to npm please

Hey, I love this little library. Thanks for making it!

I'm however using this with 4.4.13 and the mappings have changed. I see that you've accepted a merge request that fixes this issue. Could you please publish this change to npm?

$ npm version patch # Updates package.json to version 1.1.1 and creates a git commit and tag
$ npm publish

I think this should be marked as a "patch" as it's not technically adding any features. It's also kind of a bug that old versions of this package don't work on the newest kernel.

unexport not defined

When terminating a node script from the terminal i receive the error below. This is happening with the test.js

Am i missing something?

^C/home/chip/Desktop/gpio/chip-gpio/gpio.js:16
gpio.unexport();
^

ReferenceError: gpio is not defined
at process.exit (/home/chip/Desktop/gpio/chip-gpio/gpio.js:16:5)
at emitNone (events.js:80:13)
at process.emit (events.js:179:7)
at Signal.wrap.onsignal (node.js:837:46)

README: Requirements doesn't include Python

In the README, The requirements list build-essential only, where Python is also required to be installed.

After installing Python, chip-gpio was built successfully.

# apt-get install build-essential python

chip-gpio question

I noticed that chip-gpio is based on onoff and have a question ๐Ÿ˜„

I took a look at the implementation of chip-gpio and noticed that read method is implemented as follows:

Gpio.prototype.read = function () {
    fs.readSync(this.valueFd, this.readBuffer, 0, 1, 0);
    var valString = fs.readFileSync(this.gpioPath + 'value', 'utf8');
    return parseInt(valString.split('\n')[0]);
    //return this.readBuffer[0] === new Buffer('1')[0] ? 1 : 0;
};

This is the equivalent of the readSync method in onoff which is implemented as follows:

Gpio.prototype.readSync = function () {
  fs.readSync(this.valueFd, this.readBuffer, 0, 1, 0);
  return this.readBuffer[0] === ONE[0] ? 1 : 0;
};

The question is, why was the implementation changed? Did the onoff version not work? I'm afraid I don't have a Chip board to try it out myself.

One more question, do you know if an unmodified version of onoff works on Chip boards?

4.4 support

# npm install chip-gpio --save
-
> [email protected] install /home/chip/secu/node_modules/chip-gpio/node_modules/epoll
> node-gyp rebuild

make: Entering directory '/home/chip/secu/node_modules/chip-gpio/node_modules/epoll/build'
  CXX(target) Release/obj.target/epoll/src/epoll.o
In file included from ../src/epoll.cc:15:0:
../node_modules/nan/nan.h:324:47: error: 'REPLACE_INVALID_UTF8' is not a member of 'v8::String'
   static const unsigned kReplaceInvalidUtf8 = v8::String::REPLACE_INVALID_UTF8;
                                               ^
epoll.target.mk:84: recipe for target 'Release/obj.target/epoll/src/epoll.o' failed
make: *** [Release/obj.target/epoll/src/epoll.o] Error 1
make: Leaving directory '/home/chip/secu/node_modules/chip-gpio/node_modules/epoll/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/share/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:809:12)
gyp ERR! System Linux 4.4.13-ntc-mlc
gyp ERR! command "nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/chip/secu/node_modules/chip-gpio/node_modules/epoll
gyp ERR! node -v v0.10.29
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok 
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian
 
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the epoll package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls epoll
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 4.4.13-ntc-mlc
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "chip-gpio" "--save"
npm ERR! cwd /home/chip/secu
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.4.21
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/chip/secu/npm-debug.log
npm ERR! not ok code 0

I found the workaround here: https://github.com/fivdi/onoff/wiki/Node.js-v0.10.29-and-native-addons-on-the-Raspberry-Pi

Running the sample code, I get the following error:

/home/chip/secu/node_modules/chip-gpio/index.js:7
if (os.release().startsWith("4.4")) {
                 ^
TypeError: Object 4.4.13-ntc-mlc has no method 'startsWith'
    at Object.<anonymous> (/home/chip/secu/node_modules/chip-gpio/index.js:7:18)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/home/chip/secu/test.js:1:74)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.