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@20:8c79659c71e4, 2018-06-20 (annotated)
- Committer:
- jrodenburg
- Date:
- Wed Jun 20 00:19:13 2018 +0000
- Revision:
- 20:8c79659c71e4
- Parent:
- 17:5098d8fbb298
Made 3 major changes:; 1. Updated how we read temperatures (I2C write all channel, than read all channels); 2. Got rid of inner cooling loop that stopped control loop if the channel was cooling and really close to set point ; 3. Send all temp. data
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 | 17:5098d8fbb298 | 18 | /** Write to LTC chip to select port to read from |
| jrodenburg | 0:a28a1035c31b | 19 | * |
| jrodenburg | 17:5098d8fbb298 | 20 | * This function is used select the LTC2487 channel we would like to read from |
| jrodenburg | 0:a28a1035c31b | 21 | * |
| jrodenburg | 17:5098d8fbb298 | 22 | * @param channel The channel we would like to read from |
| jrodenburg | 0:a28a1035c31b | 23 | */ |
| jrodenburg | 0:a28a1035c31b | 24 | |
| jrodenburg | 17:5098d8fbb298 | 25 | float writePort(int channel); |
| jrodenburg | 17:5098d8fbb298 | 26 | |
| jrodenburg | 17:5098d8fbb298 | 27 | /** Read value from LTC2487 |
| jrodenburg | 17:5098d8fbb298 | 28 | * |
| jrodenburg | 17:5098d8fbb298 | 29 | * This function is used to read data from LTC2487 from channel selected in writePort() |
| jrodenburg | 17:5098d8fbb298 | 30 | * |
| jrodenburg | 17:5098d8fbb298 | 31 | * @param N/A |
| jrodenburg | 17:5098d8fbb298 | 32 | */ |
| jrodenburg | 17:5098d8fbb298 | 33 | |
| jrodenburg | 17:5098d8fbb298 | 34 | float read(); |
| jrodenburg | 0:a28a1035c31b | 35 | |
| jrodenburg | 0:a28a1035c31b | 36 | /** Sets I2C address |
| jrodenburg | 0:a28a1035c31b | 37 | * |
| jrodenburg | 0:a28a1035c31b | 38 | * This function is used to set the I2C address |
| jrodenburg | 0:a28a1035c31b | 39 | * |
| jrodenburg | 0:a28a1035c31b | 40 | * @param address The I2C address |
| jrodenburg | 0:a28a1035c31b | 41 | */ |
| jrodenburg | 0:a28a1035c31b | 42 | |
| jrodenburg | 0:a28a1035c31b | 43 | void setAddress(int address); |
| jrodenburg | 0:a28a1035c31b | 44 | |
| jrodenburg | 0:a28a1035c31b | 45 | |
| jrodenburg | 0:a28a1035c31b | 46 | private: |
| jrodenburg | 0:a28a1035c31b | 47 | I2C i2c; |
| jrodenburg | 0:a28a1035c31b | 48 | uint8_t addrI2C; |
| jrodenburg | 0:a28a1035c31b | 49 | |
| jrodenburg | 0:a28a1035c31b | 50 | }; |
| jrodenburg | 0:a28a1035c31b | 51 |
