Heater files
Dependents: LEX-Demo-Firmware-Logging LEX-Demo-Firmware-Logging
Heater.h@1:4435d407d827, 2019-07-17 (annotated)
- Committer:
- omatthews
- Date:
- Wed Jul 17 13:00:41 2019 +0000
- Revision:
- 1:4435d407d827
- Parent:
- 0:4e33cc8171f4
- Child:
- 2:7f15386fcc90
Implemented heaters
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
omatthews | 0:4e33cc8171f4 | 1 | /*------------------------------------------------------------------------------ |
omatthews | 0:4e33cc8171f4 | 2 | Library header file for heater operations |
omatthews | 0:4e33cc8171f4 | 3 | Date: 16/07/2018 |
omatthews | 0:4e33cc8171f4 | 4 | |
omatthews | 0:4e33cc8171f4 | 5 | |
omatthews | 0:4e33cc8171f4 | 6 | ------------------------------------------------------------------------------*/ |
omatthews | 0:4e33cc8171f4 | 7 | |
omatthews | 0:4e33cc8171f4 | 8 | #ifndef Heater_H |
omatthews | 0:4e33cc8171f4 | 9 | #define Heater_H |
omatthews | 0:4e33cc8171f4 | 10 | #include "mbed.h" |
omatthews | 0:4e33cc8171f4 | 11 | #include "ADS8568_ADC.h" |
omatthews | 0:4e33cc8171f4 | 12 | |
omatthews | 1:4435d407d827 | 13 | #define MEAS_DELAY 50 // measurement delay after turning on FET (us) |
omatthews | 1:4435d407d827 | 14 | #define N_ROLL_AVG 10 // rolling average for R values |
omatthews | 1:4435d407d827 | 15 | #define ALL_CH 15 //value of convst bus to read all chanels simultaneosly |
omatthews | 0:4e33cc8171f4 | 16 | |
omatthews | 0:4e33cc8171f4 | 17 | class Heater |
omatthews | 0:4e33cc8171f4 | 18 | { |
omatthews | 0:4e33cc8171f4 | 19 | public: |
omatthews | 0:4e33cc8171f4 | 20 | /** Constructor |
omatthews | 0:4e33cc8171f4 | 21 | * @param MOSI SPI pin |
omatthews | 0:4e33cc8171f4 | 22 | * @param MISO SPI pin |
omatthews | 0:4e33cc8171f4 | 23 | * @param SCLK SPI pin |
omatthews | 0:4e33cc8171f4 | 24 | * @param nCS SPI pin |
omatthews | 0:4e33cc8171f4 | 25 | * @param ADC reset pin |
omatthews | 0:4e33cc8171f4 | 26 | * @param Conv chA pin |
omatthews | 0:4e33cc8171f4 | 27 | * @param Conv chB pin |
omatthews | 0:4e33cc8171f4 | 28 | * @param Conv chC pin |
omatthews | 0:4e33cc8171f4 | 29 | * @param Conv chD pin |
omatthews | 0:4e33cc8171f4 | 30 | */ |
omatthews | 0:4e33cc8171f4 | 31 | Heater(int i_port, int v_port, DigitalOut drive, float R_set = 1); |
omatthews | 0:4e33cc8171f4 | 32 | |
omatthews | 0:4e33cc8171f4 | 33 | //Public member functions |
omatthews | 0:4e33cc8171f4 | 34 | |
omatthews | 0:4e33cc8171f4 | 35 | void read_R(); |
omatthews | 0:4e33cc8171f4 | 36 | void hold(int hold_time); |
omatthews | 1:4435d407d827 | 37 | |
omatthews | 1:4435d407d827 | 38 | |
omatthews | 0:4e33cc8171f4 | 39 | void Set_R_set(float R); |
omatthews | 1:4435d407d827 | 40 | |
omatthews | 0:4e33cc8171f4 | 41 | float Get_R(); |
omatthews | 0:4e33cc8171f4 | 42 | |
omatthews | 1:4435d407d827 | 43 | void turn_on(); |
omatthews | 1:4435d407d827 | 44 | void turn_off(); |
omatthews | 0:4e33cc8171f4 | 45 | |
omatthews | 0:4e33cc8171f4 | 46 | |
omatthews | 0:4e33cc8171f4 | 47 | |
omatthews | 0:4e33cc8171f4 | 48 | protected: |
omatthews | 0:4e33cc8171f4 | 49 | |
omatthews | 0:4e33cc8171f4 | 50 | |
omatthews | 1:4435d407d827 | 51 | float curr; |
omatthews | 0:4e33cc8171f4 | 52 | float v; |
omatthews | 0:4e33cc8171f4 | 53 | float R; |
omatthews | 0:4e33cc8171f4 | 54 | float R_set; |
omatthews | 1:4435d407d827 | 55 | |
omatthews | 0:4e33cc8171f4 | 56 | int i_port; |
omatthews | 0:4e33cc8171f4 | 57 | int v_port; |
omatthews | 0:4e33cc8171f4 | 58 | DigitalOut drive; |
omatthews | 0:4e33cc8171f4 | 59 | |
omatthews | 0:4e33cc8171f4 | 60 | }; |
omatthews | 0:4e33cc8171f4 | 61 | |
omatthews | 0:4e33cc8171f4 | 62 | #endif |
omatthews | 0:4e33cc8171f4 | 63 |