GithubHelp home page GithubHelp logo

vl53l0x-microbit's People

Contributors

yyhayami avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

nomissbowling

vl53l0x-microbit's Issues

Works well. Thank you.

初めまして

日本の方だと思いますので,日本語で失礼いたします。
Github超初心者(まだ一週間立っていません)ですので,Githubの世界がよくわからないので,失礼なこともあると思いますがご容赦願います。
拡張機能VL53L0X-microbitの公開をありがとうございます。
大変ありがたく使わせていただいております。

VL53L1X-microbitが欲しくなり,VL53L0X-microbitを参考にさせていただき,なんとか動くものが出来てきました。外観はVL53L0X-microbitに合わせるようにしてユーザの利用に差し支えないようにしているつもりです。
Arduinoのライブラリを参考にして,内容は使いたい機能だけを取り出しました。

さて,VL53L0X-microbitを参考にしていて,困った点がありました。

function writeReg16(raddr: number, d: number): void {
pins.i2cWriteNumber(i2cAddr, raddr, NumberFormat.UInt8BE, false)
pins.i2cWriteNumber(i2cAddr, d, NumberFormat.UInt16BE, false)
}

VL53L0X側からすると,
[I2Cアドレス][writeBit]+[レジスタアドレス]+[データMSB]+[テータLSB]
が来ればOKですが,この関数では
[I2Cアドレス][writeBit]+[レジスタアドレス]
[I2Cアドレス][writeBit]+[データMSB]+[テータLSB]
が送られてしまいます。
Microbit側からすると3バイトのデータを送る関数が欲しいのですが,それがありませんので一工夫必要です。
送信したいレジスタアドレスの2つ後ろのレジスタアドレスにある1バイトを読みだして,
[I2Cアドレス][writeBit]+[レジスタアドレス]+[データMSB]+[テータLSB]+[読みだした1バイト]
として送信します。
NumberFormat.UInt32BEでの送信が可能ですので,これが使えます。

VL53L1Xでは,レジスタアドレスが2バイトなので,1バイトのデータを送るときには合計で3バイト送信するので,このような工夫が必要でした。
2バイトデータや4バイトデータを送るときもちょっとした工夫が必要でした。

気づいた点をお送りさせていただきました。

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.