Jump to: navigation, search

Difference between revisions of "RaceCapturePro scripting"

(initial spike of RaceCapture/Pro scripting documentation)
 
m (syntax correction)
 
(12 intermediate revisions by the same user not shown)
Line 1: Line 1:
==GPIO functions==
+
==Logger Functions==
===''getGpio(port)''===
+
Provides the state of the specified GPIO port.
+
*'''port''' : 0 - 2
+
*'''returns''' : 0=low; 1=high
+
  
===''setGpio(port,state)''===
+
===''startLogging()''===
Sets a GPIO port to the specified state
+
Start logging data to a new logfile, using the current configuration
*'''port''' : 0 - 2
+
*'''state''' : 0=low;1=high
+
*'''returns''' : nil
+
  
===''getButton()''===
+
===''stopLogging()''===
Returns the status of the front panel button
+
Stops a current logging session, if active
*'''returns''' 1=button pressed; 0=button not pressed
+
 
 +
===''setLed(led,state)''===
 +
Sets a LED to the specified state
 +
*'''led''' : 0-2
 +
*'''state''' : 0=off; 1=on
  
==SD Card functions==
+
===''state isSDCardPresent()''===
===''isSDCardPresent()''===
+
 
Indicates if an SD Card is inserted
 
Indicates if an SD Card is inserted
*'''returns''' : 1=SD card is present; 0=SD card is missing
+
*'''state''' : 1=SD card is present; 0=SD card is missing
  
===''isSDCardWritable()''===
+
===''state isSDCardWritable()''===
 
Indicates if the SD card is writable
 
Indicates if the SD card is writable
*'''returns''' : 1=SD card is writable; 0=SD card is write protected
+
*'''state''' : 1=SD card is writable; 0=SD card is write protected
  
==PWM functions==
+
===''flashLoggerConfig()''===
Sets the duty cycle percentage for the specified PWM channel
+
Writes the current logger configuration to flash memory
 +
 
 +
==DAC functions==
 +
===''value getAnalog(channel)''===
 +
Gets the voltage for the specified analog channel
 +
*'''channel''' : 0 - 7
 +
*'''value''' : voltage
 +
 
 +
===''value getAnalogRaw(channel)''===
 +
Gets the raw ADC value for the specified analog channel
 +
*'''channel''' : 0 - 7
 +
*'''value''' : raw ADC value
 +
 
 +
===''setAnalogLabel(channel,label,units)''===
 +
Sets the label for the specified analog channel
 +
*'''channel''' : 0 - 7
 +
*'''label''' : channel label
 +
*'''units''' : channel units label
 +
 
 +
===''label,units getAnalogLabel(channel)''===
 +
Gets the labels for the specified analog channel
 +
*'''channel''' : 0 - 7
 +
*'''label''' : channel label
 +
*'''units''' : channel units label
 +
 +
===''setAnalogSampleRate(channel,rate)''===
 +
Sets the sample rate for the specified analog channel
 +
*'''channel''' : 0 - 7
 +
*'''rate''' : sample rate
 +
 
 +
===''rate getAnalogSampleRate(channel)''===
 +
Gets the sample rate for the specified analog channel
 +
*'''channel''' : 0 - 7
 +
*'''rate''' : sample rate
 +
 +
===''setAnalogScaling(channel,scaling)''===
 +
Sets the scaling value for the specified analog channel
 +
*'''channel''' : 0 - 7
 +
*'''scaling''' : the decimal scaling value for the specified analog channel. Logged values are multiplied by this scaling value.
 +
 
 +
===''scaling getAnalogScaling(channel)''===
 +
Get the scaling value for the specified analog channel
 +
*'''channel''' : 0 - 7
 +
*'''scaling''' : the decimal scaling value for the specified analog channel. Logged values are multiplied by this scaling value.
 +
 
 +
==PWM / DAC functions==
 +
 
 +
===''setAnalogOut(channel,voltage)''===
 +
Sets the analog output voltage for the specified PWM/DAC channel
 +
*'''channel''' : 0 - 3
 +
*'''voltage''' : 0.00 - 5.00
 +
 
 +
Sets the duty cycle percentage for the specified PWM/DAC channel
 
===''setPwmDutyCycle(channel,duty)''===
 
===''setPwmDutyCycle(channel,duty)''===
 
*'''channel''' : 0 - 3
 
*'''channel''' : 0 - 3
Line 31: Line 79:
  
 
===''setPwmDutyCycleRaw(channel,duty)''===
 
===''setPwmDutyCycleRaw(channel,duty)''===
Sets the raw duty cycle value for the specified PWM channel
+
Sets the raw duty cycle value for the specified PWM/DAC channel
 
*'''channel''' : 0 - 3
 
*'''channel''' : 0 - 3
*'''duty''' :  cycle 0-100
+
*'''duty''' :  duty cycle 0-100
  
===''setPWMPeriod''===
+
===''setPwmPeriod(channel,period)''===
 
Sets the period for the specified PWM channel
 
Sets the period for the specified PWM channel
 
*'''channel''' : 0 - 3
 
*'''channel''' : 0 - 3
 
*'''period''' : <TODO define this>
 
*'''period''' : <TODO define this>
  
===''setPWMPeriodRaw''===
+
===''setPwmPeriodRaw(channel,period)''===
Sets the raw period value for the specified PWM channel
+
Sets the raw period value for the specified PWM/DAC channel
 
*'''channel''' : 0 - 3
 
*'''channel''' : 0 - 3
 
*'''period''' : <TODO define this>
 
*'''period''' : <TODO define this>
  
==Digital to Analog functions==
+
===''setPwmClockFrequency(frequency)''===
===''setAnalogOut''===
+
Sets the clock frequency for the PWM/DAC generator
Sets the analog output voltage for the specified PWM channel
+
*'''frequency''' : the base PWM frequency (10 - 2000)
 +
 
 +
===''frequency getPwmClockFrequency()''===
 +
Gets the clock frequency for the PWM/DAC generator
 +
*'''frequency''' : the base PWM frequency (10 - 2000)
 +
 +
===''setPwmLabel(channel,label)''===
 +
Sets the label for the specified PWM/DAC channel
 
*'''channel''' : 0 - 3
 
*'''channel''' : 0 - 3
*'''voltage''' : 0.00 - 5.00
+
*'''label''' : channel label
 +
 
 +
===''label getPwmLabel()''===
 +
Gets the label for the specified PWM/DAC channel
 +
*'''channel''' : 0 - 3
 +
*'''label''' : channel label
 +
 +
===''setPwmSampleRate(channel,rate)''===
 +
Sets the sample rate for the specified PWM/DAC channel
 +
*'''channel''' : 0 - 3
 +
*'''rate''' : sample rate
 +
 
 +
===''label getPwmSampleRate(channel)''===
 +
Gets the sample rate for the specified PWM/DAC channel
 +
*'''channel''' : 0 - 3
 +
*'''label''' : channel label
 +
 +
===''setPwmOutputConfig(channel,config)''===
 +
Sets the configuration for the specified PWM/DAC channel
 +
*'''channel''' : 0 - 3
 +
*'''config''' : 0=analog; 1=frequency
 +
 
 +
===''config getPwmOutputConfig(channel)''===
 +
Gets the configuration for the specified PWM/DAC channel
 +
*'''channel''' : 0 - 3
 +
*'''config''' : 0=analog; 1=frequency
 +
 +
===''setPwmLoggingConfig(channel,config)''===
 +
Sets the Logging configuration for the specified PWM/DAC channel
 +
*'''channel''' : 0 - 3
 +
*'''config''' : 0=Log PWM Period; 1=Log PWM Duty Cycle; 2=Log DAC volts
 +
 
 +
===''config getPwmLoggingConfig(channel)''===
 +
Gets the Logging configuration for the specified PWM/DAC channel
 +
*'''channel''' : 0 - 3
 +
*'''config''' : 0=Log PWM Period; 1=Log PWM Duty Cycle; 2=Log DAC volts
 +
 +
===''setPwmStartupDutyCycle(channel,duty)''===
 +
Sets the startup PWM duty cycle for the specified PWM/DAC channel
 +
*'''channel''' : 0 - 3
 +
*'''duty''' : duty cycle 0 - 100
 +
 
 +
===''channel getPwmStartupDutyCycle(duty)''===
 +
Gets the startup duty cycle for the specified PWM/DAC channel
 +
*'''channel''' : 0 - 3
 +
*'''duty''' : duty cycle 0 - 100
 +
 +
===''setPwmStartupPeriod(channel,period)''===
 +
Sets the startup period for the specified PWM/DAC channel
 +
*'''channel''' : 0 - 3
 +
*'''period''' : period 1 - 2000
 +
 
 +
===''period getPwmStartupPeriod(channel)''===
 +
Gets the startup period for the specified PWM/DAC channel
 +
*'''channel''' : 0 - 3
 +
*'''period''' : period 1 - 2000
 +
 
 +
===''setPwmVoltageScaling(channel,scaling)''===
 +
Sets the voltage scaling for the specified PWM/DAC channel. Used when in DAC mode
 +
*'''channel''' : 0 - 3
 +
*'''scaling''' : voltage scaling
 +
 
 +
===''scaling getPwmVoltageScaling(channel)''===
 +
Gets the voltage scaling for the specified PWM/DAC channel. Used when in DAC mode
 +
*'''channel''' : 0 - 3
 +
*'''scaling''' : voltage scaling
  
 
==Timer functions==
 
==Timer functions==
  
===''getRPM(channel)''===
+
===''rpm getTimerRpm(channel)''===
 
Gets the calculated RPM for the specified timer channel
 
Gets the calculated RPM for the specified timer channel
 
*'''channel''' : 0 - 2
 
*'''channel''' : 0 - 2
*'''returns''' : value, in RPM
+
*'''rpm''' : value, in RPM
  
===''getPeriodMs(channel)''===
+
===''period getTimerPeriodMs(channel)''===
 
Gets the calculated period, in mS, for the specified timer channel
 
Gets the calculated period, in mS, for the specified timer channel
 
*'''channel''' : 0 - 2
 
*'''channel''' : 0 - 2
*'''returns''' : value, in mS
+
*'''period''' : value, in mS
  
===''getPeriodUsec(channel)''===
+
===''period getTimerPeriodUsec(channel)''===
 
Gets the calculated period, in uS, for the specified timer channel
 
Gets the calculated period, in uS, for the specified timer channel
 
*'''channel''' : 0 - 2
 
*'''channel''' : 0 - 2
*'''returns''' : value, in uS
+
*'''period''' : value, in uS
  
===''getFrequency(channel)''===
+
===''freq getTimerFrequency(channel)''===
 
Gets the calculated frequency, in Hz, for the specified timer channel
 
Gets the calculated frequency, in Hz, for the specified timer channel
 
*'''channel''' : 0 - 2
 
*'''channel''' : 0 - 2
*'''returns''' : value, in Hz
+
*'''freq''' : value, in Hz
  
===''getTimerRaw(channel)''===
+
===''value getTimerRaw(channel)''===
 
Gets the raw value for the specified timer channel
 
Gets the raw value for the specified timer channel
 
*'''channel''' : 0 - 2
 
*'''channel''' : 0 - 2
*'''returns''' : raw timer count value
+
*'''value''' : raw timer count value
  
===''getTimerCount(channel)''===
+
===''count getTimerCount(channel)''===
 
Gets the count value for the specified timer channel, when configured as a slow timer
 
Gets the count value for the specified timer channel, when configured as a slow timer
 
*'''channel''' : 0 - 2
 
*'''channel''' : 0 - 2
*'''returns''' : slow timer counts
+
*'''count''' : slow timer counts
  
 
===''resetTimerCount(channel)''===
 
===''resetTimerCount(channel)''===
Line 87: Line 207:
 
*'''channel''' : 0 - 2
 
*'''channel''' : 0 - 2
  
==Analog to Digital functions==
+
===''setTimerLabel(channel,label,units)''===
===''getAnalog(channel)''===
+
Sets the labels for the the specified timer channel
Gets the voltage for the specified analog channel
+
*'''channel''' : timer channel 0 - 2
*'''channel''' : 0 - 7
+
*'''label''' : channel label
*'''returns''' : voltage
+
*'''units''' : units label
  
===''getAnalogRaw(channel)''===
+
===''label,units getTimerLabel(channel)''===
Gets the raw ADC value for the specified analog channel
+
Gets the labels for the the specified timer channel
*'''channel''' : 0 - 7
+
*'''channel''' : timer channel 0 - 2
*'''returns''' : raw ADC value
+
*'''label''' : channel label
 +
*'''units''' : units label
 +
 +
===''setTimerSampleRate(channel)''===
 +
Sets the sample rate for the specified timer channel
 +
*'''channel''' : timer channel 0 - 2
 +
*'''rate''' : sample rate
  
 +
===''rate getTimerSampleRate(channel)''===
 +
Gets the sample rate for the specified timer channel
 +
*'''channel''' : timer channel 0 - 2
 +
*'''rate''' : sample rate
 +
 +
===''setTimerConfig(channel,config)''===
 +
Sets the configuration for the specified timer channel
 +
*'''channel''' : timer channel 0 - 2
 +
*'''configuration''' : 0 = RPM; 1 = frequency(Hz) ; 2 = period(uS) ; 3 = period(mS)
  
readSerial
+
===''config getTimerConfig(channel)''===
writeSerial
+
Gets the configuration for the specified timer channel
 +
*'''channel''' : timer channel 0 - 2
 +
*'''configuration''' : 0 = RPM; 1 = frequency(Hz) ; 2 = period(uS) ; 3 = period(mS)
 +
 +
===''setTimerPulsePerRevolution(channel,value)''===
 +
Sets the pulse-per-revolution for the specified timer channel.
 +
*'''channel''' : timer channel 0 - 2
 +
*'''value'''' : the number of pulses representing a complete revolution of a rotational device (crankshaft, wheel, etc)
  
getGPSLatitude
+
===''value getTimerPulsePerRevolution(channel)''===
getGPSLongitude
+
Gets the pulse-per-revolution for the specified timer channel.
getGPSVelocity
+
*'''channel''' : timer channel 0 - 2
getGPSQuality
+
*'''value''' : the number of pulses representing a complete revolution of a rotational device (crankshaft, wheel, etc)
getGPSTime
+
 
getGPSSecondsSinceMidnight
+
===''setTimerDivider(channel,divider)''===
getTimeDiff
+
Sets the clock divider for the specified timer channel.
getTimeSince
+
*'''channel''' : timer channel 0 - 2
+
*'''divider''' : 2 = Master Clock / 2; 8 = Master Clock / 8; 32 = Master Clock / 32; 128 = Master Clock / 128; 1024 = Master Clock / 1024
readAccel
+
 
readAccelRaw
+
===''divider getTimerDivider(channel)''===
 +
Gets the clock divider for the specified timer channel.
 +
*'''channel''' : timer channel 0 - 2
 +
*'''divider''' : 2 = Master Clock / 2; 8 = Master Clock / 8; 32 = Master Clock / 32; 128 = Master Clock / 128; 1024 = Master Clock / 1024
 
 
startLogging
+
===''calculateTimerScaling(channel)''===
stopLogging
+
Recalculates the timer scaling, from the current timer divider and pulse per revolution values for the specified channel.
 +
*'''channel''' : timer channel 0 - 2
  
setLED
+
===''value getTimerScaling(channel)''===
 +
Gets the current calculated scaling value for the specified timer channel
 +
*'''channel''' : timer channel 0 - 2
 +
*'''value''' : the current scaling value
  
//Logger configuration editing
+
==GPIO functions==
flashLoggerConfig
+
===''state getGpio(port)''===
 +
Provides the state of the specified GPIO port.
 +
*'''port''' : 0 - 2
 +
*'''state''' : 0=low; 1=high
 +
 
 +
===''setGpio(port,state)''===
 +
Sets a GPIO port to the specified state
 +
*'''port''' : 0 - 2
 +
*'''state''' : 0=low;1=high
 +
 
 +
===''setGpioLabel(port,label)''===
 +
Sets the label for the specified GPIO port
 +
*'''port''' : GPIO port 0 - 2
 +
*'''label''' : label
  
setAnalogLabel
+
===''label getGpioLabel(port)''===
getAnalogLabel
+
Gets the label for the specified GPIO port
 +
*'''port''' : GPIO port 0 - 2
 +
*'''label''' : label
 
 
setAnalogSampleRate
+
===''setGpioSampleRate(port,rate)''===
getAnalogSampleRate
+
Sets the sample rate for the specified GPIO port
 +
*'''port''' : GPIO port 0 - 2
 +
*'''rate''' : sample rate
 +
 
 +
===''rate getGpioSampleRate(port)''===
 +
*'''port''' : GPIO port 0 - 2
 +
*'''rate''' : sample rate
 
 
setAnalogScaling
+
===''config setGpioConfig(port,config)''===
getAnalogScaling
+
Sets the configuration of the specified GPIO port
 +
*'''port''' : GPIO port 0 - 2
 +
*'''config''' : 0 = configure as input; 1 = configure as output
 +
 
 +
===''config getGpioConfig(port)''===
 +
Gets the configuration of the specified GPIO port
 +
*'''port''' : GPIO port 0 - 2
 +
*'''config''' : 0 = configure as input; 1 = configure as output
 +
 
 +
===''state getButton()''===
 +
Returns the status of the front panel button
 +
*'''state''' 1=button pressed; 0=button not pressed
 +
 
 +
==''Accelerometer functions''==
 +
 
 +
===''value readAccel(channel)''===
 +
'''TODO document Yaw Sensor'''
 +
Reads the specified Accelerometer channel
 +
*'''channel''' : 0-3
 +
*'''value''' : The accelerometer value, in G
 +
 
 +
===''value readAccelRaw(channel)''===
 +
Reads the specified Accelerometer channel
 +
*'''channel''' : 0-3
 +
*'''value''' : The raw accelerometer value
 +
 
 +
===''setAccelInstalled(installed)''===
 +
Sets the installed state of the accelerometer module
 +
*'''installed''' : 1 = installed; 0 = not installed
 +
 
 +
===''installed getAccelInstalled()''===
 +
Gets the installed state of the accelerometer module
 +
*'''installed''' : 1 = installed; 0 = not installed
 
 
setPWMClockFrequency
+
===''setAccelLabel(channel,label)''===
getPWMClockFrequency
+
Sets the label for the specified accelerometer channel
 +
*'''channel''' : accerometer channel 0 - 3
 +
*'''label''' : channel label
 +
 
 +
===''label getAccelLabel(channel)''===
 +
Gets the label for the specified accelerometer channel
 +
*'''channel''' : accerometer channel 0 - 3
 +
*'''label''' : channel label
 
 
setPWMLabel
+
===''setAccelSampleRate(channel,rate)''===
getPWMLabel
+
Sets the sample rate for the specified accelerometer channel
 +
*'''channel''' : accerometer channel 0 - 3
 +
*'''rate''' : sample rate
 +
 
 +
===''rate getAccelSampleRate(channel)''===
 +
Gets the sample rate for the specified accelerometer channel
 +
*'''channel''' : accerometer channel 0 - 3
 +
*'''rate''' : sample rate
 
 
setPWMSampleRate
+
===setAccelIdleSampleRate(channel,rate)''===
getPWMSampleRate
+
Sets the sample rate for the specified accelerometer channel when not logging
 +
*'''channel''' : accerometer channel 0 - 3
 +
*'''rate''' : sample rate
 +
 
 +
===''rate getAccelIdleSampleRate(channel)''===
 +
Gets the sample rate for the specified accelerometer channel when not logging
 +
*'''channel''' : accerometer channel 0 - 3
 +
*'''rate''' : sample rate
 
 
setPWMOutputConfig
+
===''setAccelConfig(channel,config)''===
getPWMOutputConfig
+
Sets the configuration for the specified accelerometer channel
 +
*'''channel''' : accerometer channel 0 - 3
 +
*'''config''' : 0 = disabled ; 1 = normal orientation; 2 = inverted orientation
 +
 
 +
===''config getAccelConfig(channel)''===
 +
Gets the configuration for the specified accelerometer channel
 +
*'''channel''' : accerometer channel 0 - 3
 +
*'''config''' : 0 = disabled ; 1 = normal orientation; 2 = inverted orientation
 
 
setPWMLoggingConfig
+
===''setAccelChannel(physical,logical)''===
getPWMLoggingConfig
+
Maps the logical channel to the specified physical accelerometer channel
 +
*'''physical''' : Physical accelerometer port : 0 = X; 1 = Y; 2 = Z; 3 = Yaw
 +
*'''logical''' : Logical accelerometer port :  0 = X; 1 = Y; 2 = Z; 3 = Yaw
 +
 
 +
===''logical getAccelChannel(physical)''===
 +
Gets the logical mapping for the specified physical accelerometer channel
 +
*'''physical''' : Physical accelerometer port : 0 = X; 1 = Y; 2 = Z; 3 = Yaw
 +
*'''logical''' : Logical accelerometer port :  0 = X; 1 = Y; 2 = Z; 3 = Yaw
 
 
setPWMStartupDutyCycle
+
===''setAccelZeroValue(channel,value)''===
getPWMStartupDutyCycle
+
Sets the zero or resting value for the specified accelerometer channel
+
*'''channel''' : accelerometer channel 0 - 3
setPWMStartupPeriod
+
*'''value''' : zero value
getPWMStartupPeriod
+
 
 +
===''value getAccelZeroValue(channel)''===
 +
Gets the zero or resting value for the specified accelerometer channel
 +
*'''channel''' : accelerometer channel 0 - 3
 +
*'''value''' : zero value
 +
 
 +
===''calibrateAccelZero()''===
 +
Perform automatic zero calibration of all accelerometer channels
 +
 
 +
==GPS functions==
 +
 
 +
'''TODO- consider collapsing this into a lat,long = GetGPSLocation() function'''
 +
===''value getGPSLatitude()''===
 +
Gets the current GPS Latitude
 +
*'''value''' : GPS Latitude in decimal degrees
 +
 
 +
===''value getGPSLongitude()''===
 +
Gets the current GPS Longitude
 +
*'''value''' : GPS Longitude in decimal degrees
 +
 
 +
===''value getGPSVelocity()''===
 +
Gets the current GPS velocity
 +
*'''value''' : GPS velocity in Kph
 +
 
 +
===''value getGPSQuality()''===
 +
Gets the current GPS Quality indicator
 +
'''TODO find out the values'''
 +
*'''value''' : the GPS quality indicator
 +
 
 +
===''value getGPSTime()''===
 +
Gets the current GPS time of day
 +
*'''value''' : the current GPS time of day, in UTC decimal format
 +
 
 +
===''value getGPSSecondsSinceMidnight()''===
 +
Gets the current GPS time of day, in seconds since midnight
 +
*'''value''' : decimal seconds since midnight
 +
 
 +
===''value getTimeDiff(from,to)''===
 +
Calculates the period between the specified time, within a 24 hour period. Accounts for midnight transition.
 +
*'''from''' : from time, in seconds since midnight
 +
*'''to''' : to time, in seconds since midnight
 +
*'''value''' : time difference, in seconds since midnight
 +
 
 +
===''value getTimeSince(time)''===
 +
Calculates period between the current GPS time and the specified time, within a 24 hour period. Accounts for midnight transition.
 +
*'''time''' : the from time, in seconds since midnight
 +
*'''value''' : time since, in seconds since midnight
 +
 
 +
===''setGPSInstalled(installed)''===
 +
Sets the installation state of the GPS feature
 +
*'''installed''' : 1 = GPS installed; 0 = GPS not installed
 +
 
 +
===''installed getGPSInstalled()''===
 +
Gets the installation state of the GPS feature
 +
*'''installed''' : 1 = GPS nstalled; 0 = GPS not installed
 
 
setPWMVoltageScaling
+
===''setGPSQualityLabel(label)''===
getPWMVoltageScaling
+
Sets the label for the GPS quality field
 +
*'''label''' : label
 +
 
 +
===''label getGPSQualityLabel()''===
 +
Gets the label for the GPS quality field
 +
*'''label''' : label
 
 
setGPSInstalled
+
===''setGPSSatsLabel(label)''===
getGPSInstalled
+
Sets the label for the GPS stats field
 +
*'''label''' : label
 +
 
 +
===''label getGPSSatsLabel()''===
 +
Sets the label for the GPS stats field
 +
*'''label''' : label
 
 
setGPSQualityLabel
+
===''setGPSLatitudeLabel(label)''===
getGPSQualityLabel
+
Sets the label for the GPS latitude field
 +
*'''label''' : label
 +
 
 +
===''label getGPSLatitudeLabel()''===
 +
Gets the label for the GPS latitude field
 +
*'''label''' : label
 
 
setGPSSatsLabel
+
===''setGPSLongitudeLabel(label)''===
getGPSSatsLabel
+
Sets the label for the GPS Longitude field
 +
*'''label''' : label
 +
 
 +
===''label getGPSLongitudeLabel()''===
 +
Gets the label for the GPS Longitude field
 +
*'''label''' : label
 +
 
 +
===''setGPSTimeLabel(label)''===
 +
Sets the label for the GPS time field
 +
*'''label''' : label
 +
 
 +
===''label getGPSTimeLabel()''===
 +
Gets the label for the GPS time field
 +
*'''label''' : label
 
 
setGPSLatitudeLabel
+
===''setGPSVelocityLabel(label)''===
getGPSLatitudeLabel
+
Sets the GPS velocity label
 +
*'''label''' : label
 +
 
 +
===''label getGPSVelocityLabel()''===
 +
Gets the GPS velocity label
 +
*'''label''' : label
 
 
setGPSLongitudeLabel
+
===''setGPSPositionSampleRate(rate)''===
getGPSLongitudeLabel
+
Sets the sample rate for the GPS position
 +
*'''rate''' : sample rate
 +
 
 +
===''rate getGPSPositionSampleRate()''===
 +
Gets the sample rate for the GPS position
 +
*'''rate''' : sample rate
 
 
setGPSTimeLabel
+
===''setGPSVelocitySampleRate(rate)''===
getGPSTimeLabel
+
Sets the sample rate for the GPS velocity
+
*'''rate''' : sample rate
setGPSVelocityLabel
+
 
getGPSVelocityLabel
+
===''rate getGPSVelocitySampleRate()''===
+
Gets the sample rate for the GPS velocity
setGPSPositionSampleRate
+
*'''rate''' : sample rate
getGPSPositionSampleRate
+
+
setGPSVelocitySampleRate
+
getGPSVelocitySampleRate
+
+
setGPSTimeSampleRate
+
getGPSTimeSampleRate
+
+
setGpioLabel
+
getGpioLabel
+
+
setGpioSampleRate
+
getGpioSampleRate
+
 
 
setGpioConfig
+
===''setGPSTimeSampleRate(rate)''===
getGpioConfig
+
Sets the sample rate for the GPS time
+
*'''rate''' : sample rate
setTimerLabel
+
 
getTimerLabel
+
===''getGPSTimeSampleRate()''===
+
Gets the sample rate for the GPS time
setTimerSampleRate
+
*'''rate''' : sample rate
getTimerSampleRate
+
 
+
==Serial Port functions==
setTimerConfig
+
 
getTimerConfig
+
===''data readSerial(port)''===
+
Reads a line from the specified serial port
setTimerPulsePerRevolution
+
*'''port''' : 0 - 1
getTimerPulsePerRevolution
+
*'''data''' : The read string
+
 
setTimerDivider
+
===''writeSerial(port,data)''===
getTimerDivider
+
Writes a string to the specified serial port
+
*'''port''' : 0 - 1
calculateTimerScaling
+
*'''data''' : data to write
getTimerScaling
+
+
==Supported Sample Rates==
setAccelInstalled
+
*'''0''' - Sampling disabled
getAccelInstalled
+
*'''1''' - 1Hz
+
*'''5''' - 5Hz
setAccelLabel
+
*'''10''' - 10Hz
getAccelLabel
+
*'''20''' - 20Hz
+
*'''30''' - 30Hz
setAccelSampleRate
+
*'''50''' - 50Hz
getAccelSampleRate
+
*'''100''' - 100Hz
+
setAccelIdleSampleRate
+
getAccelIdleSampleRate
+
+
setAccelConfig
+
getAccelConfig
+
+
setAccelChannel
+
getAccelChannel
+
+
setAccelZeroValue
+

Latest revision as of 22:30, 23 December 2011

Contents

Logger Functions

startLogging()

Start logging data to a new logfile, using the current configuration

stopLogging()

Stops a current logging session, if active

setLed(led,state)

Sets a LED to the specified state

  • led : 0-2
  • state : 0=off; 1=on

state isSDCardPresent()

Indicates if an SD Card is inserted

  • state : 1=SD card is present; 0=SD card is missing

state isSDCardWritable()

Indicates if the SD card is writable

  • state : 1=SD card is writable; 0=SD card is write protected

flashLoggerConfig()

Writes the current logger configuration to flash memory

DAC functions

value getAnalog(channel)

Gets the voltage for the specified analog channel

  • channel : 0 - 7
  • value : voltage

value getAnalogRaw(channel)

Gets the raw ADC value for the specified analog channel

  • channel : 0 - 7
  • value : raw ADC value

setAnalogLabel(channel,label,units)

Sets the label for the specified analog channel

  • channel : 0 - 7
  • label : channel label
  • units : channel units label

label,units getAnalogLabel(channel)

Gets the labels for the specified analog channel

  • channel : 0 - 7
  • label : channel label
  • units : channel units label

setAnalogSampleRate(channel,rate)

Sets the sample rate for the specified analog channel

  • channel : 0 - 7
  • rate : sample rate

rate getAnalogSampleRate(channel)

Gets the sample rate for the specified analog channel

  • channel : 0 - 7
  • rate : sample rate

setAnalogScaling(channel,scaling)

Sets the scaling value for the specified analog channel

  • channel : 0 - 7
  • scaling : the decimal scaling value for the specified analog channel. Logged values are multiplied by this scaling value.

scaling getAnalogScaling(channel)

Get the scaling value for the specified analog channel

  • channel : 0 - 7
  • scaling : the decimal scaling value for the specified analog channel. Logged values are multiplied by this scaling value.

PWM / DAC functions

setAnalogOut(channel,voltage)

Sets the analog output voltage for the specified PWM/DAC channel

  • channel : 0 - 3
  • voltage : 0.00 - 5.00

Sets the duty cycle percentage for the specified PWM/DAC channel

setPwmDutyCycle(channel,duty)

  • channel : 0 - 3
  • duty : duty cycle 0-100

setPwmDutyCycleRaw(channel,duty)

Sets the raw duty cycle value for the specified PWM/DAC channel

  • channel : 0 - 3
  • duty : duty cycle 0-100

setPwmPeriod(channel,period)

Sets the period for the specified PWM channel

  • channel : 0 - 3
  • period : <TODO define this>

setPwmPeriodRaw(channel,period)

Sets the raw period value for the specified PWM/DAC channel

  • channel : 0 - 3
  • period : <TODO define this>

setPwmClockFrequency(frequency)

Sets the clock frequency for the PWM/DAC generator

  • frequency : the base PWM frequency (10 - 2000)

frequency getPwmClockFrequency()

Gets the clock frequency for the PWM/DAC generator

  • frequency : the base PWM frequency (10 - 2000)

setPwmLabel(channel,label)

Sets the label for the specified PWM/DAC channel

  • channel : 0 - 3
  • label : channel label

label getPwmLabel()

Gets the label for the specified PWM/DAC channel

  • channel : 0 - 3
  • label : channel label

setPwmSampleRate(channel,rate)

Sets the sample rate for the specified PWM/DAC channel

  • channel : 0 - 3
  • rate : sample rate

label getPwmSampleRate(channel)

Gets the sample rate for the specified PWM/DAC channel

  • channel : 0 - 3
  • label : channel label

setPwmOutputConfig(channel,config)

Sets the configuration for the specified PWM/DAC channel

  • channel : 0 - 3
  • config : 0=analog; 1=frequency

config getPwmOutputConfig(channel)

Gets the configuration for the specified PWM/DAC channel

  • channel : 0 - 3
  • config : 0=analog; 1=frequency

setPwmLoggingConfig(channel,config)

Sets the Logging configuration for the specified PWM/DAC channel

  • channel : 0 - 3
  • config : 0=Log PWM Period; 1=Log PWM Duty Cycle; 2=Log DAC volts

config getPwmLoggingConfig(channel)

Gets the Logging configuration for the specified PWM/DAC channel

  • channel : 0 - 3
  • config : 0=Log PWM Period; 1=Log PWM Duty Cycle; 2=Log DAC volts

setPwmStartupDutyCycle(channel,duty)

Sets the startup PWM duty cycle for the specified PWM/DAC channel

  • channel : 0 - 3
  • duty : duty cycle 0 - 100

channel getPwmStartupDutyCycle(duty)

Gets the startup duty cycle for the specified PWM/DAC channel

  • channel : 0 - 3
  • duty : duty cycle 0 - 100

setPwmStartupPeriod(channel,period)

Sets the startup period for the specified PWM/DAC channel

  • channel : 0 - 3
  • period : period 1 - 2000

period getPwmStartupPeriod(channel)

Gets the startup period for the specified PWM/DAC channel

  • channel : 0 - 3
  • period : period 1 - 2000

setPwmVoltageScaling(channel,scaling)

Sets the voltage scaling for the specified PWM/DAC channel. Used when in DAC mode

  • channel : 0 - 3
  • scaling : voltage scaling

scaling getPwmVoltageScaling(channel)

Gets the voltage scaling for the specified PWM/DAC channel. Used when in DAC mode

  • channel : 0 - 3
  • scaling : voltage scaling

Timer functions

rpm getTimerRpm(channel)

Gets the calculated RPM for the specified timer channel

  • channel : 0 - 2
  • rpm : value, in RPM

period getTimerPeriodMs(channel)

Gets the calculated period, in mS, for the specified timer channel

  • channel : 0 - 2
  • period : value, in mS

period getTimerPeriodUsec(channel)

Gets the calculated period, in uS, for the specified timer channel

  • channel : 0 - 2
  • period : value, in uS

freq getTimerFrequency(channel)

Gets the calculated frequency, in Hz, for the specified timer channel

  • channel : 0 - 2
  • freq : value, in Hz

value getTimerRaw(channel)

Gets the raw value for the specified timer channel

  • channel : 0 - 2
  • value : raw timer count value

count getTimerCount(channel)

Gets the count value for the specified timer channel, when configured as a slow timer

  • channel : 0 - 2
  • count : slow timer counts

resetTimerCount(channel)

Resets the count value for the timer channel, when configured as a slow timer

  • channel : 0 - 2

setTimerLabel(channel,label,units)

Sets the labels for the the specified timer channel

  • channel : timer channel 0 - 2
  • label : channel label
  • units : units label

label,units getTimerLabel(channel)

Gets the labels for the the specified timer channel

  • channel : timer channel 0 - 2
  • label : channel label
  • units : units label

setTimerSampleRate(channel)

Sets the sample rate for the specified timer channel

  • channel : timer channel 0 - 2
  • rate : sample rate

rate getTimerSampleRate(channel)

Gets the sample rate for the specified timer channel

  • channel : timer channel 0 - 2
  • rate : sample rate

setTimerConfig(channel,config)

Sets the configuration for the specified timer channel

  • channel : timer channel 0 - 2
  • configuration : 0 = RPM; 1 = frequency(Hz) ; 2 = period(uS) ; 3 = period(mS)

config getTimerConfig(channel)

Gets the configuration for the specified timer channel

  • channel : timer channel 0 - 2
  • configuration : 0 = RPM; 1 = frequency(Hz) ; 2 = period(uS) ; 3 = period(mS)

setTimerPulsePerRevolution(channel,value)

Sets the pulse-per-revolution for the specified timer channel.

  • channel : timer channel 0 - 2
  • value' : the number of pulses representing a complete revolution of a rotational device (crankshaft, wheel, etc)

value getTimerPulsePerRevolution(channel)

Gets the pulse-per-revolution for the specified timer channel.

  • channel : timer channel 0 - 2
  • value : the number of pulses representing a complete revolution of a rotational device (crankshaft, wheel, etc)

setTimerDivider(channel,divider)

Sets the clock divider for the specified timer channel.

  • channel : timer channel 0 - 2
  • divider : 2 = Master Clock / 2; 8 = Master Clock / 8; 32 = Master Clock / 32; 128 = Master Clock / 128; 1024 = Master Clock / 1024

divider getTimerDivider(channel)

Gets the clock divider for the specified timer channel.

  • channel : timer channel 0 - 2
  • divider : 2 = Master Clock / 2; 8 = Master Clock / 8; 32 = Master Clock / 32; 128 = Master Clock / 128; 1024 = Master Clock / 1024

calculateTimerScaling(channel)

Recalculates the timer scaling, from the current timer divider and pulse per revolution values for the specified channel.

  • channel : timer channel 0 - 2

value getTimerScaling(channel)

Gets the current calculated scaling value for the specified timer channel

  • channel : timer channel 0 - 2
  • value : the current scaling value

GPIO functions

state getGpio(port)

Provides the state of the specified GPIO port.

  • port : 0 - 2
  • state : 0=low; 1=high

setGpio(port,state)

Sets a GPIO port to the specified state

  • port : 0 - 2
  • state : 0=low;1=high

setGpioLabel(port,label)

Sets the label for the specified GPIO port

  • port : GPIO port 0 - 2
  • label : label

label getGpioLabel(port)

Gets the label for the specified GPIO port

  • port : GPIO port 0 - 2
  • label : label

setGpioSampleRate(port,rate)

Sets the sample rate for the specified GPIO port

  • port : GPIO port 0 - 2
  • rate : sample rate

rate getGpioSampleRate(port)

  • port : GPIO port 0 - 2
  • rate : sample rate

config setGpioConfig(port,config)

Sets the configuration of the specified GPIO port

  • port : GPIO port 0 - 2
  • config : 0 = configure as input; 1 = configure as output

config getGpioConfig(port)

Gets the configuration of the specified GPIO port

  • port : GPIO port 0 - 2
  • config : 0 = configure as input; 1 = configure as output

state getButton()

Returns the status of the front panel button

  • state 1=button pressed; 0=button not pressed

Accelerometer functions

value readAccel(channel)

TODO document Yaw Sensor Reads the specified Accelerometer channel

  • channel : 0-3
  • value : The accelerometer value, in G

value readAccelRaw(channel)

Reads the specified Accelerometer channel

  • channel : 0-3
  • value : The raw accelerometer value

setAccelInstalled(installed)

Sets the installed state of the accelerometer module

  • installed : 1 = installed; 0 = not installed

installed getAccelInstalled()

Gets the installed state of the accelerometer module

  • installed : 1 = installed; 0 = not installed

setAccelLabel(channel,label)

Sets the label for the specified accelerometer channel

  • channel : accerometer channel 0 - 3
  • label : channel label

label getAccelLabel(channel)

Gets the label for the specified accelerometer channel

  • channel : accerometer channel 0 - 3
  • label : channel label

setAccelSampleRate(channel,rate)

Sets the sample rate for the specified accelerometer channel

  • channel : accerometer channel 0 - 3
  • rate : sample rate

rate getAccelSampleRate(channel)

Gets the sample rate for the specified accelerometer channel

  • channel : accerometer channel 0 - 3
  • rate : sample rate

setAccelIdleSampleRate(channel,rate)

Sets the sample rate for the specified accelerometer channel when not logging

  • channel : accerometer channel 0 - 3
  • rate : sample rate

rate getAccelIdleSampleRate(channel)

Gets the sample rate for the specified accelerometer channel when not logging

  • channel : accerometer channel 0 - 3
  • rate : sample rate

setAccelConfig(channel,config)

Sets the configuration for the specified accelerometer channel

  • channel : accerometer channel 0 - 3
  • config : 0 = disabled ; 1 = normal orientation; 2 = inverted orientation

config getAccelConfig(channel)

Gets the configuration for the specified accelerometer channel

  • channel : accerometer channel 0 - 3
  • config : 0 = disabled ; 1 = normal orientation; 2 = inverted orientation

setAccelChannel(physical,logical)

Maps the logical channel to the specified physical accelerometer channel

  • physical : Physical accelerometer port : 0 = X; 1 = Y; 2 = Z; 3 = Yaw
  • logical : Logical accelerometer port : 0 = X; 1 = Y; 2 = Z; 3 = Yaw

logical getAccelChannel(physical)

Gets the logical mapping for the specified physical accelerometer channel

  • physical : Physical accelerometer port : 0 = X; 1 = Y; 2 = Z; 3 = Yaw
  • logical : Logical accelerometer port : 0 = X; 1 = Y; 2 = Z; 3 = Yaw

setAccelZeroValue(channel,value)

Sets the zero or resting value for the specified accelerometer channel

  • channel : accelerometer channel 0 - 3
  • value : zero value

value getAccelZeroValue(channel)

Gets the zero or resting value for the specified accelerometer channel

  • channel : accelerometer channel 0 - 3
  • value : zero value

calibrateAccelZero()

Perform automatic zero calibration of all accelerometer channels

GPS functions

TODO- consider collapsing this into a lat,long = GetGPSLocation() function

value getGPSLatitude()

Gets the current GPS Latitude

  • value : GPS Latitude in decimal degrees

value getGPSLongitude()

Gets the current GPS Longitude

  • value : GPS Longitude in decimal degrees

value getGPSVelocity()

Gets the current GPS velocity

  • value : GPS velocity in Kph

value getGPSQuality()

Gets the current GPS Quality indicator TODO find out the values

  • value : the GPS quality indicator

value getGPSTime()

Gets the current GPS time of day

  • value : the current GPS time of day, in UTC decimal format

value getGPSSecondsSinceMidnight()

Gets the current GPS time of day, in seconds since midnight

  • value : decimal seconds since midnight

value getTimeDiff(from,to)

Calculates the period between the specified time, within a 24 hour period. Accounts for midnight transition.

  • from : from time, in seconds since midnight
  • to : to time, in seconds since midnight
  • value : time difference, in seconds since midnight

value getTimeSince(time)

Calculates period between the current GPS time and the specified time, within a 24 hour period. Accounts for midnight transition.

  • time : the from time, in seconds since midnight
  • value : time since, in seconds since midnight

setGPSInstalled(installed)

Sets the installation state of the GPS feature

  • installed : 1 = GPS installed; 0 = GPS not installed

installed getGPSInstalled()

Gets the installation state of the GPS feature

  • installed : 1 = GPS nstalled; 0 = GPS not installed

setGPSQualityLabel(label)

Sets the label for the GPS quality field

  • label : label

label getGPSQualityLabel()

Gets the label for the GPS quality field

  • label : label

setGPSSatsLabel(label)

Sets the label for the GPS stats field

  • label : label

label getGPSSatsLabel()

Sets the label for the GPS stats field

  • label : label

setGPSLatitudeLabel(label)

Sets the label for the GPS latitude field

  • label : label

label getGPSLatitudeLabel()

Gets the label for the GPS latitude field

  • label : label

setGPSLongitudeLabel(label)

Sets the label for the GPS Longitude field

  • label : label

label getGPSLongitudeLabel()

Gets the label for the GPS Longitude field

  • label : label

setGPSTimeLabel(label)

Sets the label for the GPS time field

  • label : label

label getGPSTimeLabel()

Gets the label for the GPS time field

  • label : label

setGPSVelocityLabel(label)

Sets the GPS velocity label

  • label : label

label getGPSVelocityLabel()

Gets the GPS velocity label

  • label : label

setGPSPositionSampleRate(rate)

Sets the sample rate for the GPS position

  • rate : sample rate

rate getGPSPositionSampleRate()

Gets the sample rate for the GPS position

  • rate : sample rate

setGPSVelocitySampleRate(rate)

Sets the sample rate for the GPS velocity

  • rate : sample rate

rate getGPSVelocitySampleRate()

Gets the sample rate for the GPS velocity

  • rate : sample rate

setGPSTimeSampleRate(rate)

Sets the sample rate for the GPS time

  • rate : sample rate

getGPSTimeSampleRate()

Gets the sample rate for the GPS time

  • rate : sample rate

Serial Port functions

data readSerial(port)

Reads a line from the specified serial port

  • port : 0 - 1
  • data : The read string

writeSerial(port,data)

Writes a string to the specified serial port

  • port : 0 - 1
  • data : data to write

Supported Sample Rates

  • 0 - Sampling disabled
  • 1 - 1Hz
  • 5 - 5Hz
  • 10 - 10Hz
  • 20 - 20Hz
  • 30 - 30Hz
  • 50 - 50Hz
  • 100 - 100Hz