Heater for threaded program
Dependents: LEX_Threaded_Programming
Heater.h@2:7f15386fcc90, 2019-07-17 (annotated)
- Committer:
- omatthews
- Date:
- Wed Jul 17 13:55:33 2019 +0000
- Revision:
- 2:7f15386fcc90
- Parent:
- 1:4435d407d827
- Child:
- 3:313711a66929
- Child:
- 7:59ece353eea2
Commit for testing ADC error;
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 | 2:7f15386fcc90 | 35 | void read(); |
omatthews | 0:4e33cc8171f4 | 36 | void hold(int hold_time); |
omatthews | 1:4435d407d827 | 37 | |
omatthews | 1:4435d407d827 | 38 | |
omatthews | 2:7f15386fcc90 | 39 | |
omatthews | 2:7f15386fcc90 | 40 | //Getters and setters |
omatthews | 2:7f15386fcc90 | 41 | |
omatthews | 0:4e33cc8171f4 | 42 | void Set_R_set(float R); |
omatthews | 2:7f15386fcc90 | 43 | int Get_i(); |
omatthews | 2:7f15386fcc90 | 44 | int Get_v(); |
omatthews | 0:4e33cc8171f4 | 45 | float Get_R(); |
omatthews | 0:4e33cc8171f4 | 46 | |
omatthews | 1:4435d407d827 | 47 | void turn_on(); |
omatthews | 1:4435d407d827 | 48 | void turn_off(); |
omatthews | 0:4e33cc8171f4 | 49 | |
omatthews | 0:4e33cc8171f4 | 50 | |
omatthews | 0:4e33cc8171f4 | 51 | |
omatthews | 0:4e33cc8171f4 | 52 | protected: |
omatthews | 0:4e33cc8171f4 | 53 | |
omatthews | 0:4e33cc8171f4 | 54 | |
omatthews | 2:7f15386fcc90 | 55 | int curr; |
omatthews | 2:7f15386fcc90 | 56 | int v; |
omatthews | 0:4e33cc8171f4 | 57 | float R; |
omatthews | 0:4e33cc8171f4 | 58 | float R_set; |
omatthews | 1:4435d407d827 | 59 | |
omatthews | 0:4e33cc8171f4 | 60 | int i_port; |
omatthews | 0:4e33cc8171f4 | 61 | int v_port; |
omatthews | 0:4e33cc8171f4 | 62 | DigitalOut drive; |
omatthews | 0:4e33cc8171f4 | 63 | |
omatthews | 0:4e33cc8171f4 | 64 | }; |
omatthews | 0:4e33cc8171f4 | 65 | |
omatthews | 0:4e33cc8171f4 | 66 | #endif |
omatthews | 0:4e33cc8171f4 | 67 |