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 TCTF_Control_Main by
LTC2487/LTC2487.h@0:a28a1035c31b, 2018-01-22 (annotated)
- Committer:
- jrodenburg
- Date:
- Mon Jan 22 20:11:52 2018 +0000
- Revision:
- 0:a28a1035c31b
- Child:
- 17:5098d8fbb298
Code that has I/O working, after replacing the hotswap buffer with a dumb buffer
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| jrodenburg | 0:a28a1035c31b | 1 | #include "mbed.h" |
| jrodenburg | 0:a28a1035c31b | 2 | |
| jrodenburg | 0:a28a1035c31b | 3 | class LTC2487 { |
| jrodenburg | 0:a28a1035c31b | 4 | public: |
| jrodenburg | 0:a28a1035c31b | 5 | |
| jrodenburg | 0:a28a1035c31b | 6 | /** Constructor |
| jrodenburg | 0:a28a1035c31b | 7 | * |
| jrodenburg | 0:a28a1035c31b | 8 | * @param sda I2C sda pin |
| jrodenburg | 0:a28a1035c31b | 9 | * @param scl I2C scl pin |
| jrodenburg | 0:a28a1035c31b | 10 | * @param address The hardware address of the LTC2487. This is the 3-bit |
| jrodenburg | 0:a28a1035c31b | 11 | * value that is physically set via A0, A1, and A2. |
| jrodenburg | 0:a28a1035c31b | 12 | * @param freq The I2C frequency. |
| jrodenburg | 0:a28a1035c31b | 13 | */ |
| jrodenburg | 0:a28a1035c31b | 14 | |
| jrodenburg | 0:a28a1035c31b | 15 | LTC2487(PinName sda, PinName scl, uint8_t address, int freq); |
| jrodenburg | 0:a28a1035c31b | 16 | |
| jrodenburg | 0:a28a1035c31b | 17 | |
| jrodenburg | 0:a28a1035c31b | 18 | /** Write to the output pins. |
| jrodenburg | 0:a28a1035c31b | 19 | * |
| jrodenburg | 0:a28a1035c31b | 20 | * This function is used to set output pins on or off. |
| jrodenburg | 0:a28a1035c31b | 21 | * |
| jrodenburg | 0:a28a1035c31b | 22 | * @param chnl The GPIO pin to set |
| jrodenburg | 0:a28a1035c31b | 23 | * @param values A bitmask indicating whether a pin should be on or off. |
| jrodenburg | 0:a28a1035c31b | 24 | */ |
| jrodenburg | 0:a28a1035c31b | 25 | |
| jrodenburg | 0:a28a1035c31b | 26 | float readOutput(int address); |
| jrodenburg | 0:a28a1035c31b | 27 | |
| jrodenburg | 0:a28a1035c31b | 28 | /** Sets I2C address |
| jrodenburg | 0:a28a1035c31b | 29 | * |
| jrodenburg | 0:a28a1035c31b | 30 | * This function is used to set the I2C address |
| jrodenburg | 0:a28a1035c31b | 31 | * |
| jrodenburg | 0:a28a1035c31b | 32 | * @param address The I2C address |
| jrodenburg | 0:a28a1035c31b | 33 | */ |
| jrodenburg | 0:a28a1035c31b | 34 | |
| jrodenburg | 0:a28a1035c31b | 35 | void setAddress(int address); |
| jrodenburg | 0:a28a1035c31b | 36 | |
| jrodenburg | 0:a28a1035c31b | 37 | |
| jrodenburg | 0:a28a1035c31b | 38 | private: |
| jrodenburg | 0:a28a1035c31b | 39 | I2C i2c; |
| jrodenburg | 0:a28a1035c31b | 40 | uint8_t addrI2C; |
| jrodenburg | 0:a28a1035c31b | 41 | |
| jrodenburg | 0:a28a1035c31b | 42 | }; |
| jrodenburg | 0:a28a1035c31b | 43 |
