Coder Social home page Coder Social logo

lp5562's Introduction

npm version

LP5562

This package is a quick and dirty assembler for the Texas Instruments LP5562. Package is primarily written so that an open-source toolchain can be provided for the LED controller used in the keyswitch.one project.

Usage

First install via npm:

npm install --save lp5562

Then include it in your project

// if using typescript or ES6 modules
import {assemble} from 'lp5562'

// or if using ES5
var assemble = require('lp5562').assemble;

Typescript definitions are included in the package. The function's signature is:

assemble(program : string) : Uint16Array

where program is the string representation of the assembly program, and the resulting Uint16Array is an array of 48 16-bit WORDs representing the memory map of LP5562's program space.

assemble(`
  .engine1
  set_pwm 255

  flash:
    ramp 200, -128
    ramp 200, 128
    branch 5, flash

  ramp 200, -128
  ramp 200, -127
  end, i
`);

Produces:

Uint16Array[ 65344, 65283, 32515, 33186, 65283, 65027, 208, 0, 0, 0, ... 0 ]

All data is provided in big-endian format (as the LP5562 is an 8-bit device). Feed the Uint16Array#buffer to a Uint8Array or use a DataView if you need a different data representation.

Grammar

For the assembly language spec, see the grammar. As a rule of thumb, all instructions that work on the official assembler provided with the evaluation module should work here as well. See §3.4.1 and §3.4.2 in the EVM docs for syntax and parameters.

Contributing

This project is MIT Licensed. Pull requests welcome. Changes documented in CHANGELOG.md.

lp5562's People

Contributors

cixelyn 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.