Git Product home page Git Product logo

ams_as5600's Introduction

Contributors Forks Stargazers Issues MIT License


AMS AS5600 Driver

C driver for the AMS AS5600 magnetic rotary position sensor
Explore the docs »

View Demo · Report Bug · Request Feature

Table of Contents

  1. Getting Started
  2. Usage
  3. Roadmap
  4. Contributing
  5. License
  6. Contact
  7. Acknowledgements

Getting Started

To get a local copy up and running follow these simple steps.

Installation

  1. Navigate to your project's source directory

  2. Clone the repo

    git clone https://github.com/raulgotor/ams_as5600.git
  3. Write a transfer function (see next section)

Usage

Transfer function

A transfer function is needed by the driver to know how to use the I2C of your specific hardware. Above, a simple example of how this could be implemented for STM32 MCUs using the STM32 HAL Libraries is shown:

I2C_HandleTypeDef * hi2c;

uint32_t const my_i2c_xfer(uint8_t const slave_address,
                           uint8_t const * const p_tx_buffer,
                           size_t const tx_buffer_size,
                           uint8_t * const p_rx_buffer,
                           size_t const rx_buffer_size)
{

        uint32_t const timeout = 100;
        HAL_StatusTypeDef result = HAL_OK;
        bool is_rx_operation = true;
        
        if ((NULL == p_tx_buffer) || (0 == tx_buffer_size)) {
                result = HAL_ERROR;

        } else if ((NULL == p_rx_buffer) || (0 == rx_buffer_size)) {
                is_rx_operation = false;
        }

        if (HAL_OK == result) {
                // TX operation
                result = HAL_I2C_Master_Transmit(hi2c,
                                                 slave_address,
                                                 p_tx_buffer,
                                                 (uint16_t)tx_buffer_size,
                                                 timeout);
        }
        
        if ((HAL_OK == result) && (is_rx_operation)) {
                // RX operation
                result = HAL_I2C_Master_Receive(hi2c,
                                                slave_address,
                                                p_rx_buffer,
                                                rx_buffer_size,
                                                timeout);
        }
        
        return result;
}

Module initialization

After declaring the transfer function, initialize the module with the following call:

as5600_error_t result = as5600_init(my_i2c_xfer);

Further documentation

Please refer to the in code documentation and to the AMS AS5600 Datasheet

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Raúl Gotor

Project Link: https://github.com/raulgotor/ams_as5600

Acknowledgements

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.