Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
AnalogIO_1ch/MCP4921.hpp
- Committer:
- MikamiUitOpen
- Date:
- 2014-07-28
- Revision:
- 0:b027da9cfc23
- Child:
- 1:18123753e1d0
File content as of revision 0:b027da9cfc23:
//------------------------------------------------------ // Class for DAC, MCP4921 // // Default pin assign // D11 SPI Master Out Slave In // D13 SPI Serial Clock // D10 SPL Slave Select // // 2014/07/18, Copyright (c) 2014 MIKAMI, Naoki //------------------------------------------------------ #ifndef MCP4921_HPP #define MCP4921_HPP #include "mbed.h" namespace Mikami { class DacMCP4921 { public: // Constructor DacMCP4921(PinName mosi = SPI_MOSI, // D11 PinName sclk = SPI_SCK, // D13 PinName cs = SPI_CS, // D10 int hz = 20000000); // -1.0f <= valeu <= 1.0f void Write(float value); // 0 <= valeu <= 4095 void Write(uint16_t value); // generate LDAC pulse for dual DAC void Ldac(); private: SPI mySpi_; // SPI object DigitalOut myCs_; // for chip select // for use internally void WriteDac(uint16_t value); }; } #endif // MCP4921_HPP