📄 thermaldemo.c
字号:
/* thermalDemo.c - Dy 4 VME-182/183 temperature sensor demonstration code *//********************************************************************** * * Copyright (c) 2003-2005, Dy 4 Systems All rights reserved. * This Source Code is the Property of Dy 4 Systems Inc. and can * only be used in accordance with Source Code License * Agreement of Dy 4 Systems Inc. dba (doing business as) * CURTISS-WRIGHT CONTROLS EMBEDDED COMPUTING, "CWCEC". * **********************************************************************//*modification history--------------------01f,28mar05,aak remove the note, include bsp.h (CR#2752)01e,11jan05,rcd ported to VME-183.01d,16nov04,mb PT 2288: fixed sensor numbering (now numbered 1-4)01c,23oct04,mb PT 2250: replaced DEBUGMP with printf printf seems to be adding stability to the demo code01b,18aug04,aak display a note (PT#2096)01a,28jun03,dy4 created */#include "vxWorks.h"#include "taskLib.h"#include "stdio.h"#include "sysLib.h"#include "tickLib.h"#include "logLib.h"#include "errnoLib.h"#include "h/drv/dy4/boardName.h"#include "bsp.h"extern int tempHandlerRan[DY4THERMAL_MAX];int tempHandlerRan[DY4THERMAL_MAX];void tempSensTest ( void );/* --------------------------------------------------------------------------- *//* tempHandler - interrupt handler for all temp sensors *//* --------------------------------------------------------------------------- */void tempHandler ( int id ) { int tmp; /* * This read is necessary to clear the interrupt */ dy4ThermalReadTemp( id, DY4THERMAL_CELSIUS, &tmp ); logMsg("MSG:Sensor %d, temp %d\n", id + 1, tmp,0,0,0,0 ); /* * Handle the over/under temp condition here */ tempHandlerRan[id] = TRUE; }/* --------------------------------------------------------------------------- *//* init - stuff that would be called in sysLib.c *//* --------------------------------------------------------------------------- */STATUS init (void) { int i; /* * Initialize temperature sensors */ printf("MSG:init:Calling dy4ThermalHwInit..."); dy4ThermalHwInit(); printf("done.\n"); /* * Connect our handler */ for (i = 0; i < DY4THERMAL_MAX; i++) { dy4ThermalConnect( i, tempHandler, i ); } printf("MSG:init:Calling dy4ThermalHwInit2..."); dy4ThermalHwInit2(); printf("done.\n"); return( OK ); }/* --------------------------------------------------------------------------- *//* The entry point for the test *//* --------------------------------------------------------------------------- */void thermal ( void ) { int i; init(); /*only call this function once */ for(i=0;i<10;i++) { printf("---------------------------------\n"); printf("Test Iteration: %d \n",i+1); printf("---------------------------------\n"); tempSensTest(); } printf("MSG:thermal:dy4ThermalTest: done\n"); taskDelay( 5 * sysClkRateGet() ); }/* --------------------------------------------------------------------------- *//* END OF FILE *//* --------------------------------------------------------------------------- */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -