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.
Dependents: MAX5216_16_Bit_DAC_Hello_Code
Fork of MAX5487_Digital_Pot_Potentiometer_Rheostat_Resistor_Wiper by
MAX5487.cpp@3:4d4053c4c29e, 2018-07-15 (annotated)
- Committer:
- jungkeviny
- Date:
- Sun Jul 15 03:49:41 2018 +0000
- Revision:
- 3:4d4053c4c29e
- Parent:
- 1:bc368afe2ec8
Updated docs
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| jungkeviny | 1:bc368afe2ec8 | 1 | #include "MAX5487.h" |
| jungkeviny | 1:bc368afe2ec8 | 2 | |
| jungkeviny | 1:bc368afe2ec8 | 3 | MAX5487::MAX5487(SPI &spi, DigitalOut &pin) : m_spi(spi), m_pin(pin) |
| jungkeviny | 1:bc368afe2ec8 | 4 | { |
| jungkeviny | 1:bc368afe2ec8 | 5 | m_pin = 1; |
| jungkeviny | 1:bc368afe2ec8 | 6 | } |
| jungkeviny | 1:bc368afe2ec8 | 7 | |
| jungkeviny | 1:bc368afe2ec8 | 8 | |
| jungkeviny | 1:bc368afe2ec8 | 9 | void MAX5487::writeCommand(MAX5487::setting_t setting, int value) |
| jungkeviny | 1:bc368afe2ec8 | 10 | { |
| jungkeviny | 1:bc368afe2ec8 | 11 | if((value >> 8) > 0) { |
| jungkeviny | 1:bc368afe2ec8 | 12 | printf("value in writeCommand > 8 bits!\r\n"); |
| jungkeviny | 1:bc368afe2ec8 | 13 | return; |
| jungkeviny | 1:bc368afe2ec8 | 14 | } |
| jungkeviny | 1:bc368afe2ec8 | 15 | m_pin = 0; |
| jungkeviny | 1:bc368afe2ec8 | 16 | m_spi.write(setting); |
| jungkeviny | 1:bc368afe2ec8 | 17 | m_spi.write(value); |
| jungkeviny | 1:bc368afe2ec8 | 18 | m_pin = 1; |
| jungkeviny | 1:bc368afe2ec8 | 19 | } |
| jungkeviny | 1:bc368afe2ec8 | 20 | |
| jungkeviny | 1:bc368afe2ec8 | 21 | |
| jungkeviny | 1:bc368afe2ec8 | 22 | void MAX5487::writeCommand(MAX5487::setting_t setting) |
| jungkeviny | 1:bc368afe2ec8 | 23 | { |
| jungkeviny | 1:bc368afe2ec8 | 24 | m_pin = 0; |
| jungkeviny | 1:bc368afe2ec8 | 25 | m_spi.write(setting); |
| jungkeviny | 1:bc368afe2ec8 | 26 | m_pin = 1; |
| jungkeviny | 1:bc368afe2ec8 | 27 | } |
| jungkeviny | 1:bc368afe2ec8 | 28 |
