Mindstorms 3rd Party ROBOTC Drivers RobotC
[Home] [Download] [Submit a bug/suggestion] [ROBOTC Forums] [Blog] [Support this project]

hitechnic-force.h

Go to the documentation of this file.
00001 /*!@addtogroup HiTechnic
00002  * @{
00003  * @defgroup htforce Force Sensor
00004  * HiTechnic Force Sensor
00005  * @{
00006  */
00007 
00008 /*
00009  * $Id: hitechnic-force.h 133 2013-03-10 15:15:38Z xander $
00010  */
00011 
00012 #ifndef HTF
00013 #define __HTF_H__
00014 /** \file hitechnic-force.h
00015  * \brief HiTechnic Force Sensor driver
00016  *
00017  * hitechnic-force.h provides an API for the HiTechnic Force sensor.
00018  *
00019  * Changelog:
00020  * - 0.1: Initial release
00021  *
00022  * Credits:
00023  * - Big thanks to HiTechnic for providing me with the hardware necessary to write and test this.
00024  *
00025  * License: You may use this code as you wish, provided you give credit where its due.
00026  *
00027  * THIS CODE WILL ONLY WORK WITH ROBOTC VERSION 3.59 AND HIGHER. 
00028 
00029  * \author Xander Soldaat (xander_at_botbench.com)
00030  * \date 30 September 2012
00031  * \version 0.1
00032  * \example hitechnic-force-test1.c
00033  */
00034 
00035 #pragma systemFile
00036 
00037 #ifndef __COMMON_H__
00038 #include "common.h"
00039 #endif
00040 
00041 int HTFreadSensor(tSensors link);
00042 
00043 #ifdef __HTSMUX_SUPPORT__
00044 int HTFreadSensor(tMUXSensor muxsensor);
00045 #endif
00046 
00047 /**
00048  * Get the raw value from the sensor
00049  * @param link the HTF port number
00050  * @return raw value of the sensor
00051  */
00052 int HTFreadSensor(tSensors link) {
00053   return 1023 - SensorRaw[link];
00054 }
00055 
00056 
00057 /**
00058  * Get the raw value from the sensor
00059  * @param muxsensor the SMUX sensor port number
00060  * @return raw value of the sensor
00061  */
00062 #ifdef __HTSMUX_SUPPORT__
00063 int HTFreadSensor(tMUXSensor muxsensor) {
00064   return 1023 - HTSMUXreadAnalogue(muxsensor);
00065 }
00066 #endif // __HTSMUX_SUPPORT__
00067 
00068 
00069 #endif // __HTF_H__
00070 
00071 /*
00072  * $Id: hitechnic-force.h 133 2013-03-10 15:15:38Z xander $
00073  */
00074 /* @} */
00075 /* @} */