Rivian Irvine Team
/
TCTF_Control_Main
Control Code with I/O and ADC working
LTC2487/LTC2487.h@16:82d941b1ef21, 2018-06-20 (annotated)
- Committer:
- jrodenburg
- Date:
- Wed Jun 20 00:30:48 2018 +0000
- Revision:
- 16:82d941b1ef21
- Parent:
- 0:a28a1035c31b
- Child:
- 20:cdeed4dad690
Made 3 primary revisions:; 1. Sent all temp. data over serial; 2. Sped up A/D reading by writing all channels than reading ; 3. Got rid of chiller inner cooling loop
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 | 16:82d941b1ef21 | 18 | /** Write to LTC chip to select port to read from |
jrodenburg | 0:a28a1035c31b | 19 | * |
jrodenburg | 16:82d941b1ef21 | 20 | * This function is used select the LTC2487 channel we would like to read from |
jrodenburg | 0:a28a1035c31b | 21 | * |
jrodenburg | 16:82d941b1ef21 | 22 | * @param channel The channel we would like to read from |
jrodenburg | 0:a28a1035c31b | 23 | */ |
jrodenburg | 0:a28a1035c31b | 24 | |
jrodenburg | 16:82d941b1ef21 | 25 | float writePort(int channel); |
jrodenburg | 16:82d941b1ef21 | 26 | |
jrodenburg | 16:82d941b1ef21 | 27 | /** Read value from LTC2487 |
jrodenburg | 16:82d941b1ef21 | 28 | * |
jrodenburg | 16:82d941b1ef21 | 29 | * This function is used to read data from LTC2487 from channel selected in writePort() |
jrodenburg | 16:82d941b1ef21 | 30 | * |
jrodenburg | 16:82d941b1ef21 | 31 | * @param N/A |
jrodenburg | 16:82d941b1ef21 | 32 | */ |
jrodenburg | 16:82d941b1ef21 | 33 | |
jrodenburg | 16:82d941b1ef21 | 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 |