Coder Social home page Coder Social logo

sensorutility's Introduction

SensorUtility

This is a small library for someone who wants to send their float sensor values in compact size over uart/wireless/spi/i2c networks.

Using one structure and two functions you can trasfer your to systems with different endianness without care about swaping order.

Structure

        float value;
        uint8_t type;
    }```

-		```float value``` value of your sensor
-		```uint8_t type``` sensor type (see header file)

# Functions

```int8_t write_sensor(void* data, uint8_t max_data_len, struct sensor_value* value, uint8_t* offset)``` is function for copying your sensor value into data buffer.

**Arguments:**
-		```void* data``` data buffer pointer for copying data into
-		```uint8_t max_data_len``` size of the buffer to prevent overflow
-		```struct sensor_value* value``` pointer to our sensor value structure to copy from
-		```uint8_t* offset``` pointer to offset uint where your data should start in buffer (offset is automatically increased by size of sensor_value)

**Return:**
-		```0``` if everything is alright
-		```EOVERFLOW``` if this operation could overflow data buffer

`int8_t read_sensor(void* data, uint8_t data_len, struct sensor_value* value, uint8_t* offset)` is function for copying your sensor value into data buffer.

**Arguments:**
-		```void* data``` data buffer pointer for copying data from
-		```uint8_t data_len``` size of the buffer to prevent overflow
-		```struct sensor_value* value``` pointer to our sensor value structure to copy to
-		```uint8_t* offset``` pointer to offset uint where your data should start in buffer (offset is automatically increased by size of sensor_value)

**Return:**
-		```0``` if everything is alright
-		```EOVERFLOW``` if this operation could overflow data buffer

sensorutility's People

Contributors

almusil avatar

Watchers

 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.