Index: ADuCM360_demo_cn0359/src/hal/drivers/adc.cpp =================================================================== diff -u -r8d80f35bf88694bd50d769b9bab31db8364a9004 -re5e6c6f79e38c2f82de516ea81069dfe0fc558b5 --- ADuCM360_demo_cn0359/src/hal/drivers/adc.cpp (.../adc.cpp) (revision 8d80f35bf88694bd50d769b9bab31db8364a9004) +++ ADuCM360_demo_cn0359/src/hal/drivers/adc.cpp (.../adc.cpp) (revision e5e6c6f79e38c2f82de516ea81069dfe0fc558b5) @@ -36,8 +36,10 @@ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ - +#ifdef EVAL_BUILD #include +#endif // EVAL_BUILD + #include #include #include @@ -50,9 +52,10 @@ #include #include #include +#include #define ADC0FLT_AF (15<<8) -#define ADC0FLT_SF 124 +#define ADC0FLT_SF 31 #define ADC1FLT_AF (15<<8) #define ADC1FLT_SF 124 @@ -71,6 +74,8 @@ static int position = 0; +static float raw_temp_res; // Raw Temperature Resistance + ssize_t adc_read(void *buf, size_t count) { if ((position + count) > sizeof(adc_file)) { @@ -394,16 +399,29 @@ t.timer_app.argv = new char*; new_timer(t); + + // If automated polling / publihsing flag is enabled + if(true == is_auto_publish_enbld()) + { + // Start publihsing raw conductivity measurements + app msg; + msg.argc = 0; + msg.fun = auto_publish; + msg.argv = new char*; + post_message(msg); + } break; } ++result.adc0_hit; - + +#ifdef EVAL_BUILD app msg; msg.argc = 0; msg.fun = on_conductivity; msg.argv = new char*; post_message(msg); +#endif // EVAL_BUILD return 0; } @@ -496,10 +514,14 @@ if (adc1_result >= 0x09d54f53) { //PT1000 result.temp = res2temp(6.e3f * adc1_result / (1074547130368ll - (3ll * adc1_result))); //normalized to 1 at 0°C + raw_temp_res = (6.e3f * adc1_result / (1074547130368ll - + (3ll * adc1_result))); result.rtd_type = 1000; } else { //PT100 result.temp = res2temp(6.e4f * adc1_result / (1074547130368ll - (3ll * adc1_result))); //normalized to 1 at 0°C + raw_temp_res = (6.e4f * adc1_result / (1074547130368ll - + (3ll * adc1_result))); result.rtd_type = 100; } @@ -511,11 +533,11 @@ result.temp = 25; } - app msg; - msg.argc = 0; - msg.fun = on_rtd; - msg.argv = new char*; - post_message(msg); +// app msg; +// msg.argc = 0; +// msg.fun = on_rtd; +// msg.argv = new char*; +// post_message(msg); pADI_ADC1->CON = (pADI_ADC1->CON & ~ADC1CON_ADCREF_MSK & ~ADC1CON_ADCDIAG_MSK & ~ADC1CON_ADCCP_MSK & ~ADC1CON_ADCCN_MSK) @@ -529,6 +551,11 @@ return 0; } +float get_raw_temperature_resistance(void) +{ + return raw_temp_res; +} + #ifdef __cplusplus extern "C" {