Giter Site home page Giter Site logo

mb85's Introduction

Fujitsu MB85 FRAM

Simple wrapper around I²C (i2c-bus) implementation to provide read / write capability.

npm Version GitHub package.json version CI CodeQL GitHub Downloads Per Month GitHub last commit Package Quality

API

Construction is achived via the statis from and fromId methods of MB85RC.

const id = ... // detected via I²C, or user specified 
const fram = MB85RC.fromId(bus, id)

Feature string

The feature set exposed as the Fujitsu product codes.

size

The density expressed as numeric value.

densityHuman

The density expressed as prodcut code string (example: '1M', '512K', ect)

busHuman

The bus as product code string ('RC' for I²C)

read(offset, length)

Direct access to read at an offset for desired length. Retruning a Promise that resolves to a Buffer.

write(offset, buffer)

Direct write to an offset given a buffer of desired length to be writen. Returning a Promise that resolves when completed.

Devcie ID

The provided library is also provides a way of identifying a chip based on its assigned Id value.

This can be passed in, however, it becomes more usefull with the bus level deviceId call. This uses a bus level discovery not supported by most chips. By using this method, the chips feature inforamtion can detected.

const i2c = require('i2c-bus')
const { I2CAddressedBus } = require('@johntalton/and-other-delights')
const { MB85RC, DEFAULT_MB85_ADDRESS } = require('@johntalton/mb85')

const busNumber = 1
const busAddress = DEFAULT_MB85_ADDRESS // 0x50

const bus1 = await i2c.openPromisified(busNumber)
const id = await bus1.deviceId()
const ab = new I2CAddressedBus(bus1, busAddress)
const fram = MB85RC.fromId(ab, id)

console.log('Fujitsu FRAM MB85', fram.busHuman, fram.densityHuman, fram.featuresHuman)
// Fujitsu FRAM MB85 RC 256K V

mb85's People

Contributors

dependabot[bot] avatar johntalton avatar

Watchers

 avatar  avatar

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.