Git Product home page Git Product logo

mcp4725's Introduction

MCP4725 Library for STM32

This is a library for the MCP4725 DAC (datasheet) designed for STM32 MCUs. It uses the fast transmission mode whenever possible.

To use a DAC, first a new variable of the type MCP4725_t has to be created. Then the initialize function can be called. The setup looks like this:

// define struct for external DAC
MCP4725_t mcp4725;

MCP4725_Initialize(&mcp4725, &hi2c1, 0x62);

The reference of said variable is then passed to the initialize function, together with a reference to the I2C object. It is followed by the address (0x62 is the default address of most breakout boards).

A full example would look like this:

// define struct for external DAC
MCP4725_t mcp4725;

MCP4725_Initialize(&mcp4725, &hi2c1, 0x62);
MCP4725_SetVoltage(&mcp4725, 1458, MCP4725_DAC_ONLY);

// read the value back from the DAC
MCP4725_GetDataFromChip(&mcp4725);

Note that the I2C transmissions are blocking for now. Also the read function updates the voltage value in the struct after the data is received. The setter functions update the struct as well and then transmit the data.

Documentation

The documentation can be found in the header file MCP4725.h.

License

MIT

mcp4725's People

Contributors

timgoll avatar

Stargazers

 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.