npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

bbhw-ts

v1.0.0

Published

Need to have [i2c-bus](https://github.com/fivdi/i2c-bus) library installed in your `NODE_PATH` on the beaglebone black.

Downloads

5

Readme

Setup

Need to have i2c-bus library installed in your NODE_PATH on the beaglebone black.

sudo apt-get install nodejs npm
export NODE_PATH=/usr/local/lib/node_modules
npm i i2c-bus

Need to have pins configured in their respective modes before using...

Example:

#!/bin/sh
config-pin P9_11 gpio
config-pin P9_13 gpio
config-pin P9_17 i2c
config-pin P9_18 i2c
config-pin P9_19 i2c
config-pin P9_20 i2c
config-pin P9_22 pwm
config-pin P9_42 pwm
echo ds1338 0x68 | sudo tee /sys/class/i2c-adapter/i2c-1/new_device
sudo hwclock -w -f /dev/rtc1

Example program

import { Direction, GPIO } from "bbhw-ts"
import { I2C } from "bbhw-ts"
import { PWM } from "bbhw-ts"
import { msleep } from "bbhw-ts"

export const POWERMON_ADDR = 0x21
export const MAX11614_ADDR = 0x33

let gpioLED = new GPIO(60, Direction.OUT)
let userButton = new GPIO(72, Direction.IN)
let i2cDevice1 = new I2C(1)
let pwm = new PWM("P9_22")

// Set PWM 
pwm.setPwmFrequencyAndValue({ frequency: 5000, value: 0.75 })

// GPIO in/out
while(true) {
    let button = userButton.getValue()
    console.log({ button })
    gpioLED.setValue(1)
    msleep(500)
    gpioLED.setValue(0)
    msleep(500)
}

// Reading the power info from MAX chip:
const wbuf = Buffer.from([0x8A, 0x0F]);
const rbuf = Buffer.alloc(2);
i2cDevice1.tx(MAX11614_ADDR, wbuf, rbuf)
console.log(`Max Chip setup block read response: ${rbuf[0]}, ${rbuf[1]}`)
while(true) {
    let powerRead = Buffer.alloc(16);
    i2cDevice1.tx(MAX11614_ADDR, undefined, powerRead)
    console.log(powerRead[0])
    console.log(powerRead[1])
    console.log(powerRead[2])
    console.log(powerRead[3])
    console.log(powerRead[4])
    console.log(powerRead[5])
    console.log(powerRead[6])
    console.log(powerRead[7])
    console.log(powerRead[8])
    console.log(powerRead[9])
    console.log(powerRead[10])
    console.log(powerRead[11])
    console.log(powerRead[12])
    console.log(powerRead[13])
    console.log(powerRead[14])
    console.log(powerRead[15])
    msleep(1000)
}