Git Product home page Git Product logo

ble_uart_controller_test's People

Contributors

collincunningham avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

ble_uart_controller_test's Issues

Misleading code, lack of documentation

Got here from your Adafruit blog post at https://learn.adafruit.com/bluefruit-le-connect/controller.

void rxCallback(uint8_t *buffer, uint8_t len)

The rxCallback() function's second parameter is simply named "len", which suggests it's the length of the buffer. If my investigations are correct, this is misleading. Can you confirm the following:

  1. the rxCallback() function is ALWAYS provided a 20-byte buffer
  2. the second parameter might more accurately be named "validLen", to indicate the number of bytes of data was received for this packet
  3. For supported commands, is the data packet defined as:
struct {
    uint8_t CommandIndicator; // must be ASCII '!'
    uint8_t CommandType; // one of Q, A, G, M 
    uint8_t CommandSpecificData; // 
    uint8_t CRC; // specifically, CRC being always at offset 19, thus requiring 20 bytes always
} OPTION_A;
  1. For supported commands, is the data packet instead defined as:
struct {
    uint8_t CommandIndicator; // must be ASCII '!'
    uint8_t CommandType; // one of Q, A, G, M
    union {
        struct {
            uint8_t float_x[4]; // must be cast to a float, stored little-endian
            uint8_t float_y[4]; // must be cast to a float, stored little-endian
            uint8_t float_z[4]; // must be cast to a float, stored little-endian
            uint8_t float_w[4]; // must be cast to a float, stored little-endian
            uint8_t CRC; // specifically, offset == 19
        } QuaternionData;
        struct {
            uint8_t float_x[4]; // must be cast to a float, stored little-endian
            uint8_t float_y[4]; // must be cast to a float, stored little-endian
            uint8_t float_z[4]; // must be cast to a float, stored little-endian
            uint8_t CRC; // specifically, offset == 15
        } AccelerometerData;
        // ….
    };
} OPTION_B;

This is important, as the sample code has some errors, either way....

Thanks!

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.