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.
Fork of MCP4261 by
MCP4261 Class Reference
Interface to the 7/8-Bit Single/Dual SPI Digital POT with Non-Volatile Memory. More...
#include <MCP4261.h>
Public Member Functions | |
| MCP4261 (SPI &spi, PinName nCs, PinName nWP, PinName nSHDN) | |
| Create an instance of the MCP4261 connected via specfied SPI instance. | |
| MCP4261 (SPI &spi, PinName nCs, PinName nWP) | |
| Create an instance of the MCP4261 connected via specfied SPI instance (use wthen SHDN is linked to Global reset). | |
| int | read (char address) |
| Read an Address. | |
| void | write (char address, int data) |
| Write to Address. | |
| void | inc (bool number) |
| Increment wiper. | |
| void | dec (bool number) |
| Decrement wiper. | |
| int | status () |
| Read the Status register. | |
| int | tcon () |
| Read the tcon register. | |
| void | tcon (int data) |
| write to tcon register. | |
| int | wiper (bool number) |
| Read the Volatile Wiper. | |
| void | wiper (bool number, int data) |
| write to Volatile Wiper. | |
| int | nvwiper (bool number) |
| Read the non-volatile wiper (Power On Reset start value). | |
| void | nvwiper (bool number, int data) |
| write to non-volatile wiper (Power On Reset start value). | |
| void | shdn (bool act) |
| HARDWARE SHUTDOWN PIN (SHDN) | |
| void | wp (bool act) |
| HARDWARE WRITE PROTECT PIN (WP) | |
Detailed Description
Interface to the 7/8-Bit Single/Dual SPI Digital POT with Non-Volatile Memory.
Using the driver:
- remenber to setup SPI in main routine or use pins instance.
Defaults in this driver on start up:
- as default is HARDWARE WRITE PROTECT PIN "Off".
- as default is HARDWARE SHUTDOWN PIN "Off".
Definition at line 64 of file MCP4261.h.
Constructor & Destructor Documentation
| MCP4261 | ( | SPI & | spi, |
| PinName | nCs, | ||
| PinName | nWP, | ||
| PinName | nSHDN | ||
| ) |
Create an instance of the MCP4261 connected via specfied SPI instance.
- Parameters:
-
spi The mbed SPI instance (make in main routine) nWP The Hardware Write Protect Control pin. nSHDN The Shutdown pin. nCs The SPI chip select pin.
Definition at line 30 of file MCP4261.cpp.
| MCP4261 | ( | SPI & | spi, |
| PinName | nCs, | ||
| PinName | nWP | ||
| ) |
Create an instance of the MCP4261 connected via specfied SPI instance (use wthen SHDN is linked to Global reset).
- Parameters:
-
spi The mbed SPI instance (make in main routine) nWP The Hardware Write Protect Control pin. nCs The SPI chip select pin.
Definition at line 35 of file MCP4261.cpp.
Member Function Documentation
| void dec | ( | bool | number ) |
Decrement wiper.
- Parameters:
-
number The selected wiper to decrement.
Definition at line 69 of file MCP4261.cpp.
| void inc | ( | bool | number ) |
Increment wiper.
- Parameters:
-
number The selected wiper to increment.
Definition at line 51 of file MCP4261.cpp.
| int nvwiper | ( | bool | number ) |
Read the non-volatile wiper (Power On Reset start value).
- Parameters:
-
number The wiper number = '0' or '1'
- Returns:
- The 16 bits read.
Definition at line 133 of file MCP4261.cpp.
| void nvwiper | ( | bool | number, |
| int | data | ||
| ) |
write to non-volatile wiper (Power On Reset start value).
- Parameters:
-
number The wiper number = '0' or '1' data The 16 bits to write to the register
Definition at line 146 of file MCP4261.cpp.
| int read | ( | char | address ) |
Read an Address.
- Parameters:
-
address The selected register to read from.
- Returns:
- The 16 bits read.
Definition at line 40 of file MCP4261.cpp.
| void shdn | ( | bool | act ) |
HARDWARE SHUTDOWN PIN (SHDN)
- Parameters:
-
act SHDN is Active = true and Inactive = false
Definition at line 159 of file MCP4261.cpp.
| int status | ( | ) |
| int tcon | ( | ) |
| void tcon | ( | int | data ) |
write to tcon register.
- Parameters:
-
data The 16 bits to write to the register
Definition at line 100 of file MCP4261.cpp.
| void wiper | ( | bool | number, |
| int | data | ||
| ) |
write to Volatile Wiper.
- Parameters:
-
number The wiper number = '0' or '1' data The 16 bits to write to the register
Definition at line 120 of file MCP4261.cpp.
| int wiper | ( | bool | number ) |
Read the Volatile Wiper.
- Parameters:
-
number The wiper number = '0' or '1'
- Returns:
- The 16 bits read.
Definition at line 106 of file MCP4261.cpp.
| void wp | ( | bool | act ) |
HARDWARE WRITE PROTECT PIN (WP)
- Parameters:
-
act WP is Active = true and Inactive = false
Definition at line 165 of file MCP4261.cpp.
| void write | ( | char | address, |
| int | data | ||
| ) |
Write to Address.
- Parameters:
-
address The selected register to write to. data The 16 bits to write to the register
Definition at line 46 of file MCP4261.cpp.
Generated on Wed Jul 13 2022 19:15:10 by
1.7.2
