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

Light Sensor
[Lego]

Files

file  LEGOLS-driver.h
 

Lego Light Sensor driver.


Defines

#define LEGOLSDAT   "legols.dat"

Functions

int LSvalRaw (tSensors link)
int LSvalNorm (tSensors link)
void LScalLow (tSensors link)
void LScalLow (int lowval)
void LScalHigh (tSensors link)
void LScalHigh (int highval)
void LSsetActive (tSensors link)
void LSsetInactive (tSensors link)
int LSvalNorm (tMUXSensor muxsensor)
void LScalLow (tMUXSensor muxsensor)
int LSvalRaw (tMUXSensor muxsensor)
void LScalHigh (tMUXSensor muxsensor)
void LSsetActive (tMUXSensor muxsensor)
void LSsetInactive (tMUXSensor muxsensor)
void _LScheckSensor (tSensors link)
void _LSwriteCalVals (int lowval, int highval)
void _LSreadCalVals (int &lowval, int &highval)

Variables

int lslow = 0
int lshigh = 1023
bool legols_calibrated = false

Detailed Description

Light Sensor


Define Documentation

#define LEGOLSDAT   "legols.dat"

Datafile for Light Sensor calibration info

Definition at line 41 of file LEGOLS-driver.h.


Function Documentation

void _LScheckSensor ( tSensors  link )

Check if the sensor is set to raw and that it's been configured as a LightActive or Inactive sensor. If not, set the default to sensorLightInActive.

Note: this is an internal function and should not be called directly

Parameters:
linkthe Light Sensor port number

Definition at line 263 of file LEGOLS-driver.h.

void _LSreadCalVals ( int &  lowval,
int &  highval 
)

Read the low and high calibration values from a data file.

Note: this is an internal function and should not be called directly

Parameters:
lowvalthe low calibration value
highvalthe high calibration value

Definition at line 338 of file LEGOLS-driver.h.

void _LSwriteCalVals ( int  lowval,
int  highval 
)

Write the low and high calibration values to a data file.

Note: this is an internal function and should not be called directly

Parameters:
lowvalthe low calibration value
highvalthe high calibration value

Definition at line 279 of file LEGOLS-driver.h.

void LScalHigh ( tSensors  link )

Calibrate the Light Sensor's high calibration value with the current raw sensor reading.

Parameters:
linkthe Light Sensor port number
Examples:
LEGOLS-SMUX-test2.c, and LEGOLS-test2.c.

Definition at line 182 of file LEGOLS-driver.h.

void LScalHigh ( tMUXSensor  muxsensor )

Calibrate the Light Sensor's high calibration value with the current raw sensor reading.

Parameters:
muxsensorthe SMUX sensor port number

Definition at line 195 of file LEGOLS-driver.h.

void LScalHigh ( int  highval )

Calibrate the Light Sensor's high calibration value with the supplied value.

Parameters:
highvalthe sensor's high calibration value

Definition at line 206 of file LEGOLS-driver.h.

void LScalLow ( tSensors  link )

Calibrate the Light Sensor's low calibration value with the current raw sensor reading.

Parameters:
linkthe Light Sensor port number
Examples:
LEGOLS-SMUX-test2.c, and LEGOLS-test2.c.

Definition at line 148 of file LEGOLS-driver.h.

void LScalLow ( int  lowval )

Calibrate the Light Sensor's low calibration value with the supplied value.

Parameters:
lowvalthe sensor's low calibration value

Definition at line 172 of file LEGOLS-driver.h.

void LScalLow ( tMUXSensor  muxsensor )

Calibrate the Light Sensor's low calibration value with the current raw sensor reading.

Parameters:
muxsensorthe SMUX sensor port number

Definition at line 161 of file LEGOLS-driver.h.

void LSsetActive ( tMUXSensor  muxsensor )

Configure the sensor as a LightActive sensor

Parameters:
muxsensorthe SMUX sensor port number

Definition at line 228 of file LEGOLS-driver.h.

void LSsetActive ( tSensors  link )

Configure the sensor as a LightActive sensor

Parameters:
linkthe Light Sensor port number
Examples:
LEGOLS-SMUX-test1.c, LEGOLS-SMUX-test2.c, LEGOLS-test1.c, and LEGOLS-test2.c.

Definition at line 216 of file LEGOLS-driver.h.

void LSsetInactive ( tSensors  link )

Configure the sensor as a LightInactive sensor

Parameters:
linkthe Light Sensor port number
Examples:
LEGOLS-SMUX-test1.c, and LEGOLS-test1.c.

Definition at line 238 of file LEGOLS-driver.h.

void LSsetInactive ( tMUXSensor  muxsensor )

Configure the sensor as a LightInactive sensor

Parameters:
muxsensorthe SMUX sensor port number

Definition at line 250 of file LEGOLS-driver.h.

int LSvalNorm ( tSensors  link )

Read the normalised value of the Light Sensor, based on the low and high values.

Parameters:
linkthe Light Sensor port number
Returns:
the normalised value
Examples:
LEGOLS-SMUX-test1.c, LEGOLS-SMUX-test2.c, LEGOLS-test1.c, and LEGOLS-test2.c.

Definition at line 100 of file LEGOLS-driver.h.

int LSvalNorm ( tMUXSensor  muxsensor )

Read the normalised value of the Light Sensor, based on the low and high values.

Parameters:
muxsensorthe SMUX sensor port number
Returns:
the normalised value

Definition at line 126 of file LEGOLS-driver.h.

int LSvalRaw ( tMUXSensor  muxsensor )

Read the raw value of the Light Sensor.

Parameters:
muxsensorthe SMUX sensor port number
Returns:
the raw value of the Light Sensor

Definition at line 90 of file LEGOLS-driver.h.

int LSvalRaw ( tSensors  link )

Read the raw value of the Light Sensor.

Parameters:
linkthe Light Sensor port number
Returns:
the raw value of the Light Sensor
Examples:
LEGOLS-SMUX-test1.c, LEGOLS-SMUX-test2.c, LEGOLS-test1.c, and LEGOLS-test2.c.

Definition at line 77 of file LEGOLS-driver.h.


Variable Documentation

bool legols_calibrated = false

Has the sensor been calibrated yet

Definition at line 46 of file LEGOLS-driver.h.

int lshigh = 1023

High calibration value

Examples:
LEGOLS-SMUX-test2.c, and LEGOLS-test2.c.

Definition at line 45 of file LEGOLS-driver.h.

int lslow = 0

Low calibration value

Examples:
LEGOLS-SMUX-test2.c, and LEGOLS-test2.c.

Definition at line 44 of file LEGOLS-driver.h.