Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
159 commits
Select commit Hold shift + click to select a range
c2065b3
Merge pull request #155 from MarkAYoder/master
jadonk Sep 14, 2017
5313099
Partial update for Blue and PocketBeagle
Nov 2, 2017
4ca67c5
Partial fix for multiple bone.js keys
Nov 2, 2017
2498c50
More bone.js Blue and PocketBeagle updates
Nov 2, 2017
1369dd6
Add test-pocketbeagle.js
Nov 3, 2017
f7f5cd0
Update version string to 0.6.2
Nov 2, 2017
4857543
Partial update for Blue and PocketBeagle
Nov 5, 2017
d54cbf9
Partial update for Blue and PocketBeagle
Nov 5, 2017
258870c
Partial update for Blue and PocketBeagle
Nov 5, 2017
034e55e
Add more entries to bone.js
Nov 3, 2017
aa67a2a
Fixes for PB/Blue and new pin keys
Nov 9, 2017
87ba86b
Fix test-getpinmode
Nov 9, 2017
adcf37d
Update some PocketBeagle pins
Nov 9, 2017
0788444
More bone.js cleanup
Nov 9, 2017
3cca890
Add some tests for bone.js
Nov 9, 2017
55600c3
bone.js fixes
Nov 9, 2017
4456a5e
Update bone.js
jadonk Nov 10, 2017
709c739
Update bone.js
jadonk Nov 10, 2017
9ef174f
Update bone.js
jadonk Nov 11, 2017
3d48910
Update bone.js
jadonk Nov 11, 2017
beba8ad
Update bone.js
jadonk Nov 11, 2017
6ffd24f
Update bone.js
jadonk Nov 11, 2017
2ba98a3
Update test-bone.js
jadonk Nov 11, 2017
74ee6c5
Update bone.js
jadonk Nov 11, 2017
b09181f
Update bone.js
jadonk Nov 11, 2017
2f82465
Update bone.js
jadonk Nov 11, 2017
6dfecfb
Update test-bone.js
jadonk Nov 11, 2017
469c905
Update bone.js
jadonk Nov 11, 2017
7c24a0a
Update bone.js
jadonk Nov 11, 2017
9d983f9
Update test-bone.js
jadonk Nov 11, 2017
6d62a0b
Update test-bone.js
jadonk Nov 11, 2017
78f3bc0
Update bone.js
jadonk Nov 11, 2017
8a95ba5
Update test-bone.js
jadonk Nov 11, 2017
12ccfad
Update bone.js
jadonk Nov 11, 2017
0ff2dcd
Update bone.js
jadonk Nov 11, 2017
b087a85
Update bone.js
jadonk Nov 12, 2017
17c2737
Update bone.js
jadonk Nov 12, 2017
b9692c7
Update test-bone.js
jadonk Nov 12, 2017
28ed000
Update .travis.yml
jadonk Nov 12, 2017
86e72c7
Update test-getpinmode.js
jadonk Nov 12, 2017
8f9d879
Update bone.js
jadonk Nov 13, 2017
662aa06
package.json: add 0.6.2-beta1
jadonk Nov 28, 2017
a3cad67
test-bone.js: Add WIFI LED
jadonk Nov 28, 2017
4abd369
pinMode: downgrade missing mux name to warning
Nov 28, 2017
2c358e0
bone.js: add some missing mux names
Nov 28, 2017
28ec757
index.js: remove kernel version print at start
Nov 28, 2017
332e9e7
hw_mainline.js: search multiple paths for pinmux file
Nov 28, 2017
f861e0e
test-bone.js: Add WIFI LED
Nov 28, 2017
80ee493
Remove duplicate property muxRegOffset
jasonthorsness Nov 29, 2017
22ac0e4
Update LED handling for Blue
Nov 29, 2017
17017e1
package.json: update to 0.6.2-beta2
Nov 29, 2017
772b6ab
package.json/my.js: remove ffi dependency
Dec 5, 2017
1ea979f
package.json: fix typo
Dec 5, 2017
49f1495
Update PWM support
Dec 20, 2017
94cf96f
0.6.2-beta3
Dec 20, 2017
812367a
Merge pull request #157 from jaosth/master
jadonk Dec 20, 2017
e460194
hw_mainline.js: Add pullup/pulldown support
Dec 20, 2017
08f082b
Update univeralName entries
Dec 20, 2017
bd93287
hw_mainline: PWM disable/enable around frequency updates
Jan 1, 2018
78a9f1e
0.6.2-beta4
Jan 1, 2018
6579786
Handle pinctrl file for newer kernels
Jan 9, 2018
f8e4d0d
Demote unfound pinmux to a debug statement
Jan 9, 2018
bcc9d4d
0.6.2-beta6
Jan 11, 2018
59407b4
0.6.2
jadonk Jan 27, 2018
db739ea
Fix reference to LSBFIRST in shiftOut
Mar 1, 2018
a8c2168
Update to 0.6.3
Mar 1, 2018
9221fee
Disable roboticscape for now
Mar 1, 2018
b30bf6d
README.md: add prefix to install instructions
Mar 1, 2018
ae48732
README.md: recommend clearing npm cache
Mar 1, 2018
802dad7
Update my.js
vaishnavachath Mar 25, 2018
d7b6d29
Update index.js
vaishnavachath Mar 26, 2018
2ff59df
bone.js: add universalName for P8_13/P2_3
Mar 27, 2018
295813e
Update index.js
vaishnavachath Apr 24, 2018
ebb4082
Update index.js
vaishnavachath Apr 25, 2018
78ed23f
Merge pull request #162 from vaishnav98/master
jadonk Apr 25, 2018
451348b
Run js-beautify on all source
Apr 25, 2018
e7a8c40
Merge branch 'master' of https://github.com/jadonk/bonescript
Apr 25, 2018
d160db8
Style fixes
Apr 25, 2018
3d37dc3
Edit pin-mux definition P8_40
vaishnavachath May 6, 2018
6769946
Merge pull request #164 from vaishnav98/master
jadonk May 7, 2018
e78fd07
replace exports with module.exports
vaishnavachath May 13, 2018
bc480c0
Merge pull request #166 from vaishnav98/master
jadonk May 13, 2018
6de3458
style fixes only : suggested in pull#166
vaishnavachath May 13, 2018
2c346a8
changed to f.setGlobals in src/index.js
vaishnavachath May 13, 2018
145c932
Update .travis.yml
jadonk May 13, 2018
8246bbf
Update .travis.yml
jadonk May 13, 2018
c575fb6
Merge pull request #167 from vaishnav98/master
jadonk May 13, 2018
1f485b8
Update package.json
jadonk May 13, 2018
3925a41
Fix coveralls
May 13, 2018
87d9e0e
js-beautify rc.js
May 13, 2018
8cf683a
autorun.js: add code to improve test coverage
May 14, 2018
1c88b4e
Update .travis.yml
May 14, 2018
9962eb8
Disable test-autorun due to failure on travis-ci
May 14, 2018
78a7ca4
Merge branch 'master' of github.com:jadonk/bonescript
May 14, 2018
35d3dbf
Try testing Travis-CI defaults
May 14, 2018
db6691c
Add timeout to test-autorun.js
May 14, 2018
0f026a4
Trying other travis-ci configs
May 14, 2018
2922ac6
Still trying to fix Travis-CI
May 14, 2018
f9dae0a
test-autorun.js: use /tmp
May 14, 2018
2664986
.travis.yml not the problem
May 14, 2018
da948bf
test-autorun.js: add debug statement and more time
May 14, 2018
0ec0e95
Fruitless attemps to fix test-autorun.js
May 14, 2018
cad5f4e
beautify
May 14, 2018
2148f35
autorun.js: update for travis-ci
May 15, 2018
e03ad17
patch to handle debugfs not mounted
vaishnavachath May 16, 2018
a7282d9
Merge pull request #169 from vaishnav98/master
jadonk May 16, 2018
67f292c
C Module Support Implementation using node module 'ffi'
vaishnavachath May 18, 2018
44d09d8
Merge pull request #170 from vaishnav98/master
jadonk May 21, 2018
61d2fa2
attachInterrupt: use toString to convert buffer
May 22, 2018
bf2abcf
merge disable_pwm_output to master
vaishnavachath May 22, 2018
e5b6489
attachInterrupt: use toString to convert buffer (#6)
vaishnavachath May 22, 2018
ce7fd65
Merge pull request #171 from vaishnav98/master
jadonk May 23, 2018
9918a09
ffiimp.js: rebuild each time
May 24, 2018
a059836
ffiimp.js: Fix compatibility with older node.js version
May 24, 2018
4eda77d
include out/in args for dummy()
vaishnavachath May 24, 2018
2ac415e
removed main() from ffi-test
vaishnavachath May 24, 2018
2a508aa
fix faulty condition digitalWrite on AnalogOut
vaishnavachath May 27, 2018
ea9541e
Merge pull request #172 from vaishnav98/master
jadonk Jun 5, 2018
f76e7a9
probable fix for PWM udev delay
vaishnavachath Jun 6, 2018
e8ed803
Merge pull request #173 from vaishnav98/master
jadonk Jun 8, 2018
e208474
Update version
Jun 8, 2018
8746239
Fix version
Jun 8, 2018
10d3ca3
Bump systemd to 0.3.1 and make new release
jadonk Jun 8, 2018
a9ca418
Bump serialport to 6.0.5, node to 6.0.0 and make new release
jadonk Jun 8, 2018
6f6d834
Support nodestyle callbacks (#8)
vaishnavachath Jun 9, 2018
3dd3878
make minor modification to readPinMux callback
vaishnavachath Jun 10, 2018
47454f7
Added test-rpc.js
Jun 13, 2018
fbdb180
add deprecation warnings to previous style of callbacks
vaishnavachath Jun 13, 2018
83fb428
Added test-rpc.js (#9)
vaishnavachath Jun 13, 2018
e27f6e6
modify rpc test
vaishnavachath Jun 13, 2018
4f3ed2b
add analogWrite() test _ remove unnecessary blank lines
vaishnavachath Jun 13, 2018
fb6ac66
fix for browser
vaishnavachath Jun 14, 2018
5eb2e02
Fix for supporting node_style callback via rpc
vaishnavachath Jun 14, 2018
1767934
add some test cases for dual style callback implementation
vaishnavachath Jun 15, 2018
9edda68
fix error message in readPinMux
vaishnavachath Jun 15, 2018
fabb59f
modify hw_simulator for nodestyle cb, add rpc cb test for remaining c…
vaishnavachath Jun 15, 2018
dafabd9
Merge branch 'master' into master
vaishnavachath Jun 15, 2018
57722e1
neater fix for test-rpc
vaishnavachath Jun 17, 2018
0e15de4
change port from fixed port: 80 on rpc client
vaishnavachath Jun 22, 2018
481525c
Merge pull request #174 from vaishnav98/master
jadonk Jun 22, 2018
e1ce164
add comments, no functional changes
vaishnavachath Jun 25, 2018
b23b030
add session based authentication for rpc
vaishnavachath Jun 25, 2018
4f5f33c
add TypeScript definitions
vaishnavachath Jun 26, 2018
dc9f1e9
moved authentication to socket.io
vaishnavachath Jun 26, 2018
93e6753
socket-io middleware authentication
vaishnavachath Jun 28, 2018
8dd9386
add/modify test-cases
vaishnavachath Jun 29, 2018
0dbbc62
fix: callback on analogwrite on DOUT
vaishnavachath Jul 2, 2018
5f27270
add callback case to test-digitalwrite
vaishnavachath Jul 2, 2018
118f3e9
fix: callback on digitalWrite on AOUT
vaishnavachath Jul 2, 2018
70f1d73
Merge pull request #175 from vaishnav98/master
jadonk Jul 9, 2018
7c46bb0
modifications to typescript definitions
vaishnavachath Jul 10, 2018
0c7c11f
Merge pull request #176 from vaishnav98/typescript_defs
jadonk Jul 20, 2018
b52f88d
add rcServo,rcIMU,rcBMP functions
vaishnavachath Jul 20, 2018
dfe8850
update package.json for rc
vaishnavachath Jul 27, 2018
3e0e4bb
Merge pull request #178 from vaishnav98/master
jadonk Jul 27, 2018
1631209
Update package.json
Jul 29, 2018
90d1439
Prepare 0.7.0 release
Jul 29, 2018
b968db7
Merge branch 'master' of github.com:jadonk/bonescript
Aug 21, 2018
1dcc7ff
src/bonescript: make myrequire file scoped
Jan 23, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
sudo: required
language: node_js
dist: trusty
node_js:
- "0.10"
- "0.12"
- "4"
- "6"
- "7"
- "8"
- "10"
after_script:
- npm run-script coveralls
notifications:
Expand Down
70 changes: 43 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,37 +23,30 @@ and to further provide support for rapidly creating GUIs for your embedded
applications through the use of HTML5/JavaScript web pages.


Installation
------------
BoneScript comes installed on your BeagleBone. To update
to the latest revision or install it on another distribution, use 'npm':

Global Installation
-------------------
BoneScript comes installed on your BeagleBone. To update to the latest revision, use 'npm'
on a recent BeagleBoard.org Debian image from https://beagleboard.org/latest-images
and perform:
````sh
TERM=none npm install -g bonescript
TERM=none sudo npm cache clear
TERM=none sudo npm install -g --prefix /usr/local --unsafe-perm bonescript
sudo shutdown -r now
````

Angstrom prerequisites:
````sh
opkg update
opkg install python-misc python-modules
````

Debian and Ubuntu prerequisites:
* Credit to http://learn.adafruit.com/introduction-to-the-beaglebone-black-device-tree/compiling-an-overlay
````sh
sudo apt-get install -y build-essential g++ python-setuptools python2.7-dev
wget -c https://raw.github.com/RobertCNelson/tools/master/pkgs/dtc.sh
chmod +x dtc.sh
./dtc.sh
````
Testing on other distributions is limited.

Some steps to consider:
There are some additional installation steps that can be performed, but are typically
installed by other mechanisms on the BeagleBoard.org Debian images. These setup
background services (bone101 webserver with bonescript RPC and bonescript autorun
service) as well as configure environment variables for these services and other
globally run scripts.
````sh
cp bonescript/etc/default/node /etc/default/node
cp bonescript/etc/profile.d/node.sh /etc/profile.d/node.sh
cp bonescript/systemd/\* /lib/systemd/system
systemctl enable bonescript.socket
systemctl enable bonescript-autorun.service
sudo cp bonescript/etc/default/node /etc/default/node
sudo cp bonescript/etc/profile.d/node.sh /etc/profile.d/node.sh
sudo cp bonescript/systemd/\* /lib/systemd/system
sudo systemctl enable bonescript.socket
sudo systemctl enable bonescript-autorun.service
````

Launching applications persistently
Expand Down Expand Up @@ -83,7 +76,7 @@ Directory layout

Template
========
For a Bonescript application, you must currently manually 'require' the
For a BoneScript application, you must currently manually 'require' the
bonescript library. Functions are then referenced through the object
provided back from require.

Expand Down Expand Up @@ -159,6 +152,19 @@ Uses https://github.com/korevec/node-i2c
* i2cReadBytes(port, command, length, [callback])
* i2cStream(port, command, length, [callback])

Robot Control
-------------
__new in 0.7.0__ Runs on BeagleBone Blue; or BeagleBone Black or BeagleBone Black Wireless with BeagleBoard.org Robotics Cape
* rcInitialize([callback])
* rcState([state], [callback]) -> state
* rcLED(led, [value], [callback]) -> value
* rcOn(event, [callback])
* rcMotor(motor, value, [callback])
* rcServo(option, value, [callback])
* rcBMP([option], [callback]) -> value
* rcIMU([option], [callback]) -> value
* rcEncoder(encoder, [value], [callback]) -> value

Bits/Bytes, Math, Trigonometry and Random Numbers
-------------------------------------------------
* lowByte(value)
Expand Down Expand Up @@ -210,6 +216,16 @@ that respond to events in the system. What makes JavaScript so much easier
than other languages for doing this is that it keeps the full context around
the handler, so you don't have to worry about it.

What's New
==========

0.7.0 key updates
-----------------
Most of these fixes came from a [Google Summer of Code 2018 project](https://github.com/vaishnav98/bone101/wiki/BeagleBoard-GSoC'18:-Fixing-Bugs-in-BoneScript-and-Improving-BeagleBone-User-Interface)
* Fixes in PWM output during analogWrite updates
* Added function calls for Robot Control library support on BeagleBone Blue or Robotics Cape
* Added support for node-style callbacks with error and data separated (optional)

Plans
=====
* SPI support
Expand Down
2 changes: 1 addition & 1 deletion autorun.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ var b = require('bonescript');

var directory = (process.env.AUTORUN_DIR) ? process.env.AUTORUN_DIR : '/var/lib/cloud9/autorun';

b.autorun(directory);
b.autorun(directory);
23 changes: 23 additions & 0 deletions lint-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"indent_size": 4,
"indent_char": " ",
"indent_with_tabs": false,
"eol": "\n",
"end_with_newline": false,
"indent_level": 0,
"preserve_newlines": true,
"max_preserve_newlines": 10,
"space_in_paren": false,
"space_in_empty_paren": false,
"jslint_happy": true,
"space_after_anon_function": false,
"brace_style": "collapse",
"unindent_chained_methods": false,
"break_chained_methods": false,
"keep_array_indentation": false,
"unescape_strings": false,
"wrap_line_length": 0,
"e4x": false,
"comma_first": false,
"operator_position": "before-newline"
}
6 changes: 3 additions & 3 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = process.env.BONESCRIPT_COV
? require('./src-cov/index')
: require('./src/index');
module.exports = process.env.BONESCRIPT_COV ?
require('./src-cov/index') :
require('./src/index');
30 changes: 19 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,39 +15,47 @@
"gpio",
"arduino"
],
"version": "0.6.1",
"version": "0.7.1",
"homepage": "http://beagleboard.org/bonescript",
"license": "MIT",
"repository": {
"type": "git",
"url": "git://github.com/jadonk/bonescript"
},
"main": "main",
"types": "./src/index.d.ts",
"engines": {
"node": ">= 0.12.1"
"node": ">= 6.0.0"
},
"dependencies": {
"chokidar": "2.0.3",
"express": "4.13.4",
"socket.io": "1.4.5",
"systemd": "0.2.6",
"systemd": "0.3.1",
"winston": "2.1.1",
"express": "4.13.4",
"ffi": "2.0.0"
"@types/verror": "latest",
"shelljs": "0.8.2"
},
"optionalDependencies": {
"serialport": "3.1.2",
"serialport": "6.0.5",
"@types/serialport": "latest",
"i2c": "0.2.3",
"epoll": "0.1.18",
"pi-spi": "1.0.1",
"roboticscape": "0.0.2"
"pi-spi": "1.0.2",
"roboticscape": "0.0.8",
"ffi": "2.2.0"
},
"devDependencies": {
"jscoverage": "~0.5.1",
"nodeunit": "~0.9.0",
"coveralls": "~2.10.0"
"coveralls": "~3.0.1",
"js-beautify": "^1.7.5",
"jscoverage": "~0.6.0",
"nodeunit": "^0.11.2",
"socket.io-client": "1.4.5"
},
"scripts": {
"start": "node server.js",
"test": "NODE_PATH=.. nodeunit test",
"beautify": "NODE_PATH=.. js-beautify --config lint-config.json -r -f *.js src/*.js test/*.js",
"coveralls": "NODE_PATH=.. jscoverage src && NODE_PATH=.. BONESCRIPT_COV=1 nodeunit --reporter=lcov test | coveralls"
}
}
37 changes: 27 additions & 10 deletions server.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,38 @@
var b = require('bonescript');
var util = require('util');
var fs = require('fs');
var configFile = '/etc/default/bonescript';
var server;
//read the configuration from configFile
fs.readFile(configFile, {
encoding: 'ascii'
}, function read(err, data) {
if (err) {
server = b.serverStart(); //start server with default settings
} else {
data = JSON.parse(data); //start server with saved config
server = b.serverStart(data.port, data.directory, {
data: data.passphrase,
hash: data.hash
});
}
onServerStart();
});

var server = b.serverStart();

server.on('server$listening', serverListening);
server.on('server$error', serverError);
server.on('server$connection', serverConnection);
function onServerStart() {
server.on('server$listening', serverListening);
server.on('server$error', serverError);
server.on('server$connection', serverConnection);
}

function serverListening() {
if(debug) winston.debug('Server listening');
if (debug) winston.debug('Server listening');
}

function serverError(error) {
if(debug) winston.debug('Server error: ' + JSON.stringify(error));
if (debug) winston.debug('Server error: ' + JSON.stringify(error));
}

function serverConnection(connection) {
if(debug) winston.debug('Server connection: ' + connection);
}

if (debug) winston.debug('Server connection: ' + connection);
}
Loading