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.
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 nWP, PinName nSHDN, PinName nCs) | |
Create an instance of the MCP4261 connected via specfied SPI instance. | |
MCP4261 (PinName nWP, PinName nSHDN, PinName mosi, PinName miso, PinName sck, PinName nCs) | |
Create an instance of the MCP4261 connected with SPI pins. | |
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 | nWP, | ||
PinName | nSHDN, | ||
PinName | nCs | ||
) |
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 | ( | PinName | nWP, |
PinName | nSHDN, | ||
PinName | mosi, | ||
PinName | miso, | ||
PinName | sck, | ||
PinName | nCs | ||
) |
Create an instance of the MCP4261 connected with SPI pins.
- Parameters:
-
nWP The Hardware Write Protect Control pin. nSHDN The Shutdown pin. mosi The SPI Master Output, Slave Input pin. miso The SPI Master Input, Slave Output pin. sck The SPI Serial Clock 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 71 of file MCP4261.cpp.
void inc | ( | bool | number ) |
Increment wiper.
- Parameters:
-
number The selected wiper to increment.
Definition at line 53 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 134 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 147 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 42 of file MCP4261.cpp.
void shdn | ( | bool | act ) |
HARDWARE SHUTDOWN PIN (SHDN)
- Parameters:
-
act SHDN is Active = true and Inactive = false
Definition at line 160 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 102 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 121 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 108 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 166 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 48 of file MCP4261.cpp.
Generated on Sat Jul 16 2022 11:55:24 by
