Skip to content

Commit

Permalink
feat(get_mode): Add get_mode
Browse files Browse the repository at this point in the history
  • Loading branch information
miketrebilcock committed Jan 12, 2017
1 parent aa6fbba commit 976a486
Show file tree
Hide file tree
Showing 8 changed files with 227 additions and 46 deletions.
4 changes: 2 additions & 2 deletions docs/definitions.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<label for="nav-trigger" class="overlay"></label>

<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="pigpio.html">pigpio</a><ul class='methods'><li data-type='method'><a href="pigpio.html#close">close</a></li><li data-type='method'><a href="pigpio.html#getHardwareRevision">getHardwareRevision</a></li><li data-type='method'><a href="pigpio.html#pi">pi</a></li><li data-type='method'><a href="pigpio.html#set_glitch_filter">set_glitch_filter</a></li><li data-type='method'><a href="pigpio.html#set_mode">set_mode</a></li><li data-type='method'><a href="pigpio.html#set_pull_up_down">set_pull_up_down</a></li><li data-type='method'><a href="pigpio.html#setPwmDutycycle">setPwmDutycycle</a></li><li data-type='method'><a href="pigpio.html#setServoPulsewidth">setServoPulsewidth</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#define">define</a></li></ul>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="pigpio.html">pigpio</a><ul class='methods'><li data-type='method'><a href="pigpio.html#close">close</a></li><li data-type='method'><a href="pigpio.html#get_mode">get_mode</a></li><li data-type='method'><a href="pigpio.html#getHardwareRevision">getHardwareRevision</a></li><li data-type='method'><a href="pigpio.html#pi">pi</a></li><li data-type='method'><a href="pigpio.html#set_glitch_filter">set_glitch_filter</a></li><li data-type='method'><a href="pigpio.html#set_mode">set_mode</a></li><li data-type='method'><a href="pigpio.html#set_pull_up_down">set_pull_up_down</a></li><li data-type='method'><a href="pigpio.html#setPwmDutycycle">setPwmDutycycle</a></li><li data-type='method'><a href="pigpio.html#setServoPulsewidth">setServoPulsewidth</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#define">define</a></li></ul>
</nav>

<div id="main">
Expand Down Expand Up @@ -348,7 +348,7 @@ <h1 class="page-title">definitions.js</h1>
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Wed Jan 11 2017 21:31:24 GMT+0000 (GMT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Thu Jan 12 2017 21:14:03 GMT+0000 (GMT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>

<script>prettyPrint();</script>
Expand Down
4 changes: 2 additions & 2 deletions docs/global.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<label for="nav-trigger" class="overlay"></label>

<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="pigpio.html">pigpio</a><ul class='methods'><li data-type='method'><a href="pigpio.html#close">close</a></li><li data-type='method'><a href="pigpio.html#getHardwareRevision">getHardwareRevision</a></li><li data-type='method'><a href="pigpio.html#pi">pi</a></li><li data-type='method'><a href="pigpio.html#set_glitch_filter">set_glitch_filter</a></li><li data-type='method'><a href="pigpio.html#set_mode">set_mode</a></li><li data-type='method'><a href="pigpio.html#set_pull_up_down">set_pull_up_down</a></li><li data-type='method'><a href="pigpio.html#setPwmDutycycle">setPwmDutycycle</a></li><li data-type='method'><a href="pigpio.html#setServoPulsewidth">setServoPulsewidth</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#define">define</a></li></ul>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="pigpio.html">pigpio</a><ul class='methods'><li data-type='method'><a href="pigpio.html#close">close</a></li><li data-type='method'><a href="pigpio.html#get_mode">get_mode</a></li><li data-type='method'><a href="pigpio.html#getHardwareRevision">getHardwareRevision</a></li><li data-type='method'><a href="pigpio.html#pi">pi</a></li><li data-type='method'><a href="pigpio.html#set_glitch_filter">set_glitch_filter</a></li><li data-type='method'><a href="pigpio.html#set_mode">set_mode</a></li><li data-type='method'><a href="pigpio.html#set_pull_up_down">set_pull_up_down</a></li><li data-type='method'><a href="pigpio.html#setPwmDutycycle">setPwmDutycycle</a></li><li data-type='method'><a href="pigpio.html#setServoPulsewidth">setServoPulsewidth</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#define">define</a></li></ul>
</nav>

<div id="main">
Expand Down Expand Up @@ -191,7 +191,7 @@ <h4 class="name" id="define"><span class="type-signature">(constant) </span>defi
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Wed Jan 11 2017 21:31:24 GMT+0000 (GMT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Thu Jan 12 2017 21:14:03 GMT+0000 (GMT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>

<script>prettyPrint();</script>
Expand Down
4 changes: 2 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<label for="nav-trigger" class="overlay"></label>

<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="pigpio.html">pigpio</a><ul class='methods'><li data-type='method'><a href="pigpio.html#close">close</a></li><li data-type='method'><a href="pigpio.html#getHardwareRevision">getHardwareRevision</a></li><li data-type='method'><a href="pigpio.html#pi">pi</a></li><li data-type='method'><a href="pigpio.html#set_glitch_filter">set_glitch_filter</a></li><li data-type='method'><a href="pigpio.html#set_mode">set_mode</a></li><li data-type='method'><a href="pigpio.html#set_pull_up_down">set_pull_up_down</a></li><li data-type='method'><a href="pigpio.html#setPwmDutycycle">setPwmDutycycle</a></li><li data-type='method'><a href="pigpio.html#setServoPulsewidth">setServoPulsewidth</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#define">define</a></li></ul>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="pigpio.html">pigpio</a><ul class='methods'><li data-type='method'><a href="pigpio.html#close">close</a></li><li data-type='method'><a href="pigpio.html#get_mode">get_mode</a></li><li data-type='method'><a href="pigpio.html#getHardwareRevision">getHardwareRevision</a></li><li data-type='method'><a href="pigpio.html#pi">pi</a></li><li data-type='method'><a href="pigpio.html#set_glitch_filter">set_glitch_filter</a></li><li data-type='method'><a href="pigpio.html#set_mode">set_mode</a></li><li data-type='method'><a href="pigpio.html#set_pull_up_down">set_pull_up_down</a></li><li data-type='method'><a href="pigpio.html#setPwmDutycycle">setPwmDutycycle</a></li><li data-type='method'><a href="pigpio.html#setServoPulsewidth">setServoPulsewidth</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#define">define</a></li></ul>
</nav>

<div id="main">
Expand Down Expand Up @@ -71,7 +71,7 @@ <h2>Thanks</h2><p>Massive thanks for the inspiration and idea from <a href="http
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Wed Jan 11 2017 21:31:24 GMT+0000 (GMT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Thu Jan 12 2017 21:14:03 GMT+0000 (GMT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>

<script>prettyPrint();</script>
Expand Down
18 changes: 14 additions & 4 deletions docs/index.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<label for="nav-trigger" class="overlay"></label>

<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="pigpio.html">pigpio</a><ul class='methods'><li data-type='method'><a href="pigpio.html#close">close</a></li><li data-type='method'><a href="pigpio.html#getHardwareRevision">getHardwareRevision</a></li><li data-type='method'><a href="pigpio.html#pi">pi</a></li><li data-type='method'><a href="pigpio.html#set_glitch_filter">set_glitch_filter</a></li><li data-type='method'><a href="pigpio.html#set_mode">set_mode</a></li><li data-type='method'><a href="pigpio.html#set_pull_up_down">set_pull_up_down</a></li><li data-type='method'><a href="pigpio.html#setPwmDutycycle">setPwmDutycycle</a></li><li data-type='method'><a href="pigpio.html#setServoPulsewidth">setServoPulsewidth</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#define">define</a></li></ul>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="pigpio.html">pigpio</a><ul class='methods'><li data-type='method'><a href="pigpio.html#close">close</a></li><li data-type='method'><a href="pigpio.html#get_mode">get_mode</a></li><li data-type='method'><a href="pigpio.html#getHardwareRevision">getHardwareRevision</a></li><li data-type='method'><a href="pigpio.html#pi">pi</a></li><li data-type='method'><a href="pigpio.html#set_glitch_filter">set_glitch_filter</a></li><li data-type='method'><a href="pigpio.html#set_mode">set_mode</a></li><li data-type='method'><a href="pigpio.html#set_pull_up_down">set_pull_up_down</a></li><li data-type='method'><a href="pigpio.html#setPwmDutycycle">setPwmDutycycle</a></li><li data-type='method'><a href="pigpio.html#setServoPulsewidth">setServoPulsewidth</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#define">define</a></li></ul>
</nav>

<div id="main">
Expand Down Expand Up @@ -124,7 +124,6 @@ <h1 class="page-title">index.js</h1>
if (that._next !== undefined) {
that._next(undefined, reverse_string(data.toString('hex')));
}

});

this.client.on('error', (e) => {
Expand Down Expand Up @@ -212,7 +211,6 @@ <h1 class="page-title">index.js</h1>
pigpio.prototype.getHardwareRevision = function(cb) {
"use strict";
this._pi_gpio_command(def.PI_CMD_HWVER, 0, 0, cb, true);

};

/**
Expand All @@ -229,6 +227,18 @@ <h1 class="page-title">index.js</h1>

};

/**
* Returns the GPIO mode.
*
* @param {number} gpio - Port 0-53.
* @param {callback} callback - Function to be run when the data has been received.
*/
pigpio.prototype.get_mode = function (gpio, callback) {
"use strict";
assert_gpio_pin_in_range(gpio,0,53);
this._pi_gpio_command(def.PI_CMD_MODEG, gpio, 0, callback, true);
}

/**
* Sets or clears the internal GPIO pull-up/down resistor.
*
Expand Down Expand Up @@ -316,7 +326,7 @@ <h1 class="page-title">index.js</h1>
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Wed Jan 11 2017 21:31:24 GMT+0000 (GMT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Thu Jan 12 2017 21:14:03 GMT+0000 (GMT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>

<script>prettyPrint();</script>
Expand Down
174 changes: 165 additions & 9 deletions docs/pigpio.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<label for="nav-trigger" class="overlay"></label>

<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="pigpio.html">pigpio</a><ul class='methods'><li data-type='method'><a href="pigpio.html#close">close</a></li><li data-type='method'><a href="pigpio.html#getHardwareRevision">getHardwareRevision</a></li><li data-type='method'><a href="pigpio.html#pi">pi</a></li><li data-type='method'><a href="pigpio.html#set_glitch_filter">set_glitch_filter</a></li><li data-type='method'><a href="pigpio.html#set_mode">set_mode</a></li><li data-type='method'><a href="pigpio.html#set_pull_up_down">set_pull_up_down</a></li><li data-type='method'><a href="pigpio.html#setPwmDutycycle">setPwmDutycycle</a></li><li data-type='method'><a href="pigpio.html#setServoPulsewidth">setServoPulsewidth</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#define">define</a></li></ul>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="pigpio.html">pigpio</a><ul class='methods'><li data-type='method'><a href="pigpio.html#close">close</a></li><li data-type='method'><a href="pigpio.html#get_mode">get_mode</a></li><li data-type='method'><a href="pigpio.html#getHardwareRevision">getHardwareRevision</a></li><li data-type='method'><a href="pigpio.html#pi">pi</a></li><li data-type='method'><a href="pigpio.html#set_glitch_filter">set_glitch_filter</a></li><li data-type='method'><a href="pigpio.html#set_mode">set_mode</a></li><li data-type='method'><a href="pigpio.html#set_pull_up_down">set_pull_up_down</a></li><li data-type='method'><a href="pigpio.html#setPwmDutycycle">setPwmDutycycle</a></li><li data-type='method'><a href="pigpio.html#setServoPulsewidth">setServoPulsewidth</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#define">define</a></li></ul>
</nav>

<div id="main">
Expand Down Expand Up @@ -163,7 +163,7 @@ <h4 class="name" id="close"><span class="type-signature"></span>close<span class

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line99">line 99</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line98">line 98</a>
</li></ul></dd>


Expand Down Expand Up @@ -225,6 +225,162 @@ <h4 class="name" id="close"><span class="type-signature"></span>close<span class













<h4 class="name" id="get_mode"><span class="type-signature"></span>get_mode<span class="signature">(gpio, callback)</span><span class="type-signature"></span></h4>






<dl class="details">


<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line197">line 197</a>
</li></ul></dd>































</dl>





<div class="description">
Returns the GPIO mode.
</div>











<h5>Parameters:</h5>


<table class="params">
<thead>
<tr>

<th>Name</th>


<th>Type</th>





<th class="last">Description</th>
</tr>
</thead>

<tbody>


<tr>

<td class="name"><code>gpio</code></td>


<td class="type">


<span class="param-type">number</span>



</td>





<td class="description last">Port 0-53.</td>
</tr>



<tr>

<td class="name"><code>callback</code></td>


<td class="type">


<span class="param-type">callback</span>



</td>





<td class="description last">Function to be run when the data has been received.</td>
</tr>


</tbody>
</table>














Expand All @@ -247,7 +403,7 @@ <h4 class="name" id="getHardwareRevision"><span class="type-signature"></span>ge

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line173">line 173</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line172">line 172</a>
</li></ul></dd>


Expand Down Expand Up @@ -605,7 +761,7 @@ <h4 class="name" id="set_glitch_filter"><span class="type-signature"></span>set_

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line218">line 218</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line228">line 228</a>
</li></ul></dd>


Expand Down Expand Up @@ -766,7 +922,7 @@ <h4 class="name" id="set_mode"><span class="type-signature"></span>set_mode<span

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line185">line 185</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line183">line 183</a>
</li></ul></dd>


Expand Down Expand Up @@ -922,7 +1078,7 @@ <h4 class="name" id="set_pull_up_down"><span class="type-signature"></span>set_p

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line199">line 199</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line209">line 209</a>
</li></ul></dd>


Expand Down Expand Up @@ -1078,7 +1234,7 @@ <h4 class="name" id="setPwmDutycycle"><span class="type-signature"></span>setPwm

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line151">line 151</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line150">line 150</a>
</li></ul></dd>


Expand Down Expand Up @@ -1245,7 +1401,7 @@ <h4 class="name" id="setServoPulsewidth"><span class="type-signature"></span>set

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line129">line 129</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line128">line 128</a>
</li></ul></dd>


Expand Down Expand Up @@ -1422,7 +1578,7 @@ <h5>Parameters:</h5>
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Wed Jan 11 2017 21:31:24 GMT+0000 (GMT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Thu Jan 12 2017 21:14:03 GMT+0000 (GMT) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>

<script>prettyPrint();</script>
Expand Down
14 changes: 12 additions & 2 deletions js-pigpio/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ pigpio.prototype.pi = function(host, port, cb) {
if (that._next !== undefined) {
that._next(undefined, reverse_string(data.toString('hex')));
}

});

this.client.on('error', (e) => {
Expand Down Expand Up @@ -173,7 +172,6 @@ pigpio.prototype.setPwmDutycycle = function(userGpio, dutycycle) {
pigpio.prototype.getHardwareRevision = function(cb) {
"use strict";
this._pi_gpio_command(def.PI_CMD_HWVER, 0, 0, cb, true);

};

/**
Expand All @@ -190,6 +188,18 @@ pigpio.prototype.set_mode = function (gpio, mode) {

};

/**
* Returns the GPIO mode.
*
* @param {number} gpio - Port 0-53.
* @param {callback} callback - Function to be run when the data has been received.
*/
pigpio.prototype.get_mode = function (gpio, callback) {
"use strict";
assert_gpio_pin_in_range(gpio,0,53);
this._pi_gpio_command(def.PI_CMD_MODEG, gpio, 0, callback, true);
}

/**
* Sets or clears the internal GPIO pull-up/down resistor.
*
Expand Down
Loading

0 comments on commit 976a486

Please sign in to comment.