new
SoftMCP4922.h@0:aeca3abe0194, 2013-10-28 (annotated)
- Committer:
- magnetone
- Date:
- Mon Oct 28 12:08:13 2013 +0000
- Revision:
- 0:aeca3abe0194
new
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
magnetone | 0:aeca3abe0194 | 1 | #ifndef SOFT_MPC4922_H |
magnetone | 0:aeca3abe0194 | 2 | #define SOFT_MPC4922_H |
magnetone | 0:aeca3abe0194 | 3 | |
magnetone | 0:aeca3abe0194 | 4 | #include "mbed.h" |
magnetone | 0:aeca3abe0194 | 5 | |
magnetone | 0:aeca3abe0194 | 6 | class SoftMCP4922 |
magnetone | 0:aeca3abe0194 | 7 | { |
magnetone | 0:aeca3abe0194 | 8 | public: |
magnetone | 0:aeca3abe0194 | 9 | /* |
magnetone | 0:aeca3abe0194 | 10 | * MCP4922 - soft SPI |
magnetone | 0:aeca3abe0194 | 11 | * param |
magnetone | 0:aeca3abe0194 | 12 | * [in] sck: clock pin |
magnetone | 0:aeca3abe0194 | 13 | * [in] sdi: data pin |
magnetone | 0:aeca3abe0194 | 14 | * [in] cs: chip select pin |
magnetone | 0:aeca3abe0194 | 15 | * [in] ldac: latch pin |
magnetone | 0:aeca3abe0194 | 16 | * [in] shdn: shutdown pin |
magnetone | 0:aeca3abe0194 | 17 | * [in] ch: output channel |
magnetone | 0:aeca3abe0194 | 18 | */ |
magnetone | 0:aeca3abe0194 | 19 | SoftMCP4922( PinName sck, PinName sdi, PinName cs, PinName ldac, PinName shdn, int ch ); |
magnetone | 0:aeca3abe0194 | 20 | |
magnetone | 0:aeca3abe0194 | 21 | /* |
magnetone | 0:aeca3abe0194 | 22 | * write_u* |
magnetone | 0:aeca3abe0194 | 23 | * param |
magnetone | 0:aeca3abe0194 | 24 | * [in] value: value(*bit) |
magnetone | 0:aeca3abe0194 | 25 | */ |
magnetone | 0:aeca3abe0194 | 26 | void write_u16( unsigned short value ); |
magnetone | 0:aeca3abe0194 | 27 | void write_u12( unsigned short value ); |
magnetone | 0:aeca3abe0194 | 28 | void write_u10( unsigned short value ); |
magnetone | 0:aeca3abe0194 | 29 | void write_u8( unsigned char value ); |
magnetone | 0:aeca3abe0194 | 30 | |
magnetone | 0:aeca3abe0194 | 31 | private: |
magnetone | 0:aeca3abe0194 | 32 | void dacControl( unsigned char value ); |
magnetone | 0:aeca3abe0194 | 33 | |
magnetone | 0:aeca3abe0194 | 34 | DigitalOut m_sck; |
magnetone | 0:aeca3abe0194 | 35 | DigitalOut m_sdi; |
magnetone | 0:aeca3abe0194 | 36 | DigitalOut m_cs; |
magnetone | 0:aeca3abe0194 | 37 | DigitalOut m_ldac; |
magnetone | 0:aeca3abe0194 | 38 | DigitalOut m_shdn; |
magnetone | 0:aeca3abe0194 | 39 | int m_ch; |
magnetone | 0:aeca3abe0194 | 40 | }; |
magnetone | 0:aeca3abe0194 | 41 | |
magnetone | 0:aeca3abe0194 | 42 | |
magnetone | 0:aeca3abe0194 | 43 | |
magnetone | 0:aeca3abe0194 | 44 | #endif // SOFT_MPC4922_H |