New project Bonejs

I’ve recently created very simple wrapper code for several peripherals, and one cmd line tool. In a similar context as Bonescript. Except the code I’ve written is very minimal and simple. I’ve been working on this in my spare time, while also working on other project simultaneously. So I may not have thought of everything. However, I would be more than happy to hear complaints, gripes, or suggestions. Just remember there is not much code, and each “module” file is to the point and for one purpose( or small set of similar purposes ) only.

https://github.com/wphermans/Bonejs

I’ll be adding a new wrapper file for devmem2.c for those of you who might be interested. I’m still skeptical whether this is very useful or not. But I’ve written an example that “toggles” the USR LEDs in a Cylon like pattern. I think at minimum that it could be used as a learning tool - Of how one can access ( read, and write ) to GPIO registers.

Oh, and right. The Cylon blink pattern uses ~5-6% CPU. Which is not too bad for a Nodejs app. I’ll have to compare that with a C mmap() / /dev/mem implementation, and see how it stacks up.

pwm: https://github.com/wphermans/Bonejs/blob/master/documentation/pwm-readme.md

and

devmem: https://github.com/wphermans/Bonejs/blob/master/documentation/devmem-readme.md

Added. Both are very similar to using each from the cmdline. Personally, I think the devmem wrapper is very cool, but I’m not exactly sure how useful it would, or could be in a production environment.

As stated in the last post. the devmem example twiddles the GPIO registers for the USR LEDs. Using GPIO_DATAOUT directly rather than GPIO_SETDATAOUT, and GPIO_CLEARDATAOUT. The result in my opinion while achieving the same end result, it more inline with low level micro-controller development C code. Thus perhaps easier for someone coming from a bare metal environment to grasp - Initially.

Anyway, have at it, and have fun.

Granted, I do agree. That discussing low level micro-controller C code, when describing Javascript is a bit odd. But in reality, the heavy lifting is done in C, while Javascript just wraps the executable, and making it perhaps easier to use ?

Quite honestly, a couple of years ago I could not see myself doing something of this nature from Javascript, In fact, I’m still somewhat of a C “purist”. But I do see a lot of good in Javascript, and mixing implementations with C to make life easier.

Granted, I do agree. That discussing low level micro-controller C code, when describing Javascript is a bit odd. But in reality, the heavy lifting is done in C, while Javascript just wraps the executable, and making it perhaps easier to use ?

Quite honestly, a couple of years ago I could not see myself doing something of this nature from Javascript, In fact, I’m still somewhat of a C “purist”. But I do see a lot of good in Javascript, and mixing implementations with C to make life easier.

I still “think” in C, but JavaScript really can be rather handy. As much as people seem to want to get rid of curly braces, I still appreciate them over making whitespace meaningful. Besides, everyone has a JavaScript interpreter readily at their disposal almost without exception.

I still "think" in C, but JavaScript really can be rather handy. As much as

people seem to want to get rid of curly braces, I still appreciate them
over making whitespace meaningful. Besides, everyone has a JavaScript
interpreter readily at their disposal almost without exception.

I still think in C too, but that's where a lot of us C programmers can get
into trouble with Javascript. *If* we do not understand the Javascript
language well. Reading the book "Javascript, the good parts" did a lot to
putting me on the right track, but only after a couple years of misusing
the language. Speaking of curly braces, placement of curly braces is
important in Javascript. This is something that may sound silly from a C
programmers standpoint. But it is true.

Anyway, syntax is similar to C in many cases, but that's really where the
similarities end. While I also have a love / hate relationship the non
blocking nature of Javascript. It is an awesome feature, but at the same
time "callback hell" can be difficult to avoid.

Now days though, I actually write all my prototype code in Javascript.
Before porting to C, if I port the code at all. Simply because it is
quicker, and easier to get things done in Javascript. Despite having far
more hands on experience with C, and other procedural type languages.
*shrug* It's all good.

Additionally, I guess you could say that I never really took Javascript seriously as a language prior to using Nodejs. Hell, I never really saw web development period as something all that important. Mostly because the languages used, in web technologies, really are not that hard to learn. However, there is a hell of a lot more to web development, than just the languages. . .

Also, probably 90% of the Javascript developers out there do not really know what they’re doing. This is something I was guilty of myself for a few years.

Passed that, you have “features” such as function chaining, that I personally still think are so wrong. Yes, it is possible, and it may even work well in most cases. But can you read, understand, and follow the code ? I doubt it . . .