RaceCapturePro Lua Scripting: Difference between revisions

(→‎Scripting functions for RaceCapture/Pro: more formatting and additional functions)
Line 1: Line 1:
This page is under construction. Check back soon!
This page is under construction. Check back soon!


__NOTOC__
==Scripting functions for RaceCapture/Pro==
==Scripting functions for RaceCapture/Pro==


===getGpio===
===getGpio( port )===
Retrieves the state of the GPIO ports
Retrieves the state of the GPIO ports


'''state getGpio(port)'''
*params
 
** port: integer 0 - 2
*params: port - integer 0 - 2
*returns:
*returns: 1 = port is high, 0 = port is low
** state: 1 = port is high, 0 = port is low


When the port is configured for input mode, a voltage high input (> 2 volts) will read as 1; a voltage low will read as 0. A disconnected port will read as high due to the internal pullup resistor.
When the port is configured for input mode, a voltage high input (> 2 volts) will read as 1; a voltage low will read as 0. A disconnected port will read as high due to the internal pullup resistor.
Line 15: Line 16:
When the port is configured as output, the port reads 1 when the port is activated (output transistor is connected to ground) and 0 when the port is deactivated (pullup resistor is active)
When the port is configured as output, the port reads 1 when the port is activated (output transistor is connected to ground) and 0 when the port is deactivated (pullup resistor is active)


===setGpio===
===setGpio ( port, state )===
Sets the state of the GPIO port when the port is configured for output mode.  
Sets the state of the GPIO port when the port is configured for output mode.  


'''setGpio(port, state)'''
*params
** port: integer 0 - 2, state - 1 = output active; 0 = output inactive
*returns:
** none


*params: port - integer 0 - 2, state - 1 = output active; 0 = output inactive
When the state specified is 1, the output is active (transistor is connected to ground). When state is 0, transistor is disconnected, and pullup resistor is active.
*returns: none
 
When the state specified is 1, the output is active (transistor is conneced to ground). When state is 0, transistor is disconnected, and pullup resistor is active.


When configured for input mode this function has no effect.
When configured for input mode this function has no effect.


===getButton===
===getButton()===
Gets the state of the front panel pushbutton.
Gets the state of the front panel pushbutton.


'''state getButton()'''
*params
 
** none
*params: none
*returns
*returns: 1 = pushbutton is depressed; 0 = pushbutton is not depressed
** state: 1 = pushbutton is depressed; 0 = pushbutton is not depressed


===isSDCardPresent===
===isSDCardPresent===
Line 40: Line 41:
'''present isSDCardPresent()'''
'''present isSDCardPresent()'''


*params: none
*params
*returns: 1 = SD card is present in socket; 0 = SD card not present
** none
*returns
** present: 1 = SD card is present in socket; 0 = SD card not present


===isSDCardWritable===
===isSDCardWritable()===  
Indicates if the SD card is writable (lock switch on SD card is active)
Indicates if the SD card is writable (lock switch on SD card is active)


'''writable isSDCardWritable()'''
*params
** none
*returns
** writable: 1 = SD card is writable; 0 = SD card is not writable
 
===setPwmDutyCycle( port, dutyCyclePct )===


*params: none
*params
*returns: 1 = SD card is writable; 0 = SD card is not writable
** port: PWM / Analog output port 0 - 3
*returns
** none


===setPWMDutyCycle===
Sets the duty cycle of the specified PWM / Analog output port to the specified duty cycle percentage
===setPWMDutyCycleRaw===
 
===setPwmPeriod===
===setPwmPeriod( port, period )===
===setPwmPeriodRaw===
 
===setAnalogOut===
*params
** port: PWM / Analog output port 0 - 3
** period: The period value
** returns
* none
 
Sets the period of the specified PWM / Analog output port to the specified period
 
===setAnalogOut( port, voltage )===
 
*params
** port: PWM / Analog output port 0 - 3
** voltage: the specified output voltage ( 0 - 5v)
** returns
* none
 
Sets the output voltage of the specified PWM / Analog output port to the specified period. A convenience function equivalent to setPwmDutyCycle that translates voltage to PWM percentage.


===getTimerRpm===
===getTimerRpm===
===getTimerPeriodMs===
===getTimerPeriodMs===
===getTimerPeriodUsec===
===getTimerPeriodUsec===

Revision as of 14:23, 9 April 2013

This page is under construction. Check back soon!


Scripting functions for RaceCapture/Pro

getGpio( port )

Retrieves the state of the GPIO ports

  • params
    • port: integer 0 - 2
  • returns:
    • state: 1 = port is high, 0 = port is low

When the port is configured for input mode, a voltage high input (> 2 volts) will read as 1; a voltage low will read as 0. A disconnected port will read as high due to the internal pullup resistor.

When the port is configured as output, the port reads 1 when the port is activated (output transistor is connected to ground) and 0 when the port is deactivated (pullup resistor is active)

setGpio ( port, state )

Sets the state of the GPIO port when the port is configured for output mode.

  • params
    • port: integer 0 - 2, state - 1 = output active; 0 = output inactive
  • returns:
    • none

When the state specified is 1, the output is active (transistor is connected to ground). When state is 0, transistor is disconnected, and pullup resistor is active.

When configured for input mode this function has no effect.

getButton()

Gets the state of the front panel pushbutton.

  • params
    • none
  • returns
    • state: 1 = pushbutton is depressed; 0 = pushbutton is not depressed

isSDCardPresent

Indicates if an SD card is present in the socket

present isSDCardPresent()

  • params
    • none
  • returns
    • present: 1 = SD card is present in socket; 0 = SD card not present

isSDCardWritable()

Indicates if the SD card is writable (lock switch on SD card is active)

  • params
    • none
  • returns
    • writable: 1 = SD card is writable; 0 = SD card is not writable

setPwmDutyCycle( port, dutyCyclePct )

  • params
    • port: PWM / Analog output port 0 - 3
  • returns
    • none

Sets the duty cycle of the specified PWM / Analog output port to the specified duty cycle percentage

setPwmPeriod( port, period )

  • params
    • port: PWM / Analog output port 0 - 3
    • period: The period value
    • returns
  • none

Sets the period of the specified PWM / Analog output port to the specified period

setAnalogOut( port, voltage )

  • params
    • port: PWM / Analog output port 0 - 3
    • voltage: the specified output voltage ( 0 - 5v)
    • returns
  • none

Sets the output voltage of the specified PWM / Analog output port to the specified period. A convenience function equivalent to setPwmDutyCycle that translates voltage to PWM percentage.

getTimerRpm

getTimerPeriodMs

getTimerPeriodUsec

getTimerFrequency

getTimerRaw

resetTimerCount

getTimerCount

getAnalog

getAnalogRaw

readSerial

writeSerial

getGpsLatitude

getGpsLongitude

getGpsSpeed

getGpsQuality

getGpsTime

getLapCount

getLapTime

getGpsSec

getAtStartFinish

getTimeDiff

getTimeSince

getAccel

getAccelRaw

startLogging

stopLogging

setLed

flashLoggerConfig

setAnalogSampleRate

getAnalogSampleRate

setAnalogScaling

getAnalogScaling

setPwmClockFrequency

getPwmClockFrequency

setPwmSampleRate

getPwmSampleRate

setPwmOutputConfig

getPwmOutputConfig

setPwmLoggingConfig

getPwmLoggingConfig

setPwmStartupDutyCycle

getPwmStartupDutyCycle

setPwmStartupPeriod

getPwmStartupPeriod

setPwmVoltageScaling

getPwmVoltageScaling

setGpsInstalled

getGpsInstalled

setGpsStartFinish

getGpsStartFinish

setGpsPositionSampleRate

getGpsPositionSampleRate

setGpsSpeedSampleRate

getGpsSpeedSampleRate

setGpsTimeSampleRate

getGpsTimeSampleRate

setLapCountSampleRate

getLapCountSampleRate

setLapTimeSampleRate

getLapTimeSampleRate

setGpioSampleRate

getGpioSampleRate

setGpioConfig

getGpioConfig

setTimerSampleRate

getTimerSampleRate

setTimerConfig

getTimerConfig

setTimerPulsePerRevolution

getTimerPulsePerRevolution

setTimerDivider

getTimerDivider

calculateTimerScaling

getTimerScaling

setAccelInstalled

getAccelInstalled

setAccelSampleRate

getAccelSampleRate

setAccelConfig

getAccelConfig

setAccelChannel

getAccelChannel

setAccelZeroValue

getAccelZeroValue

calibrateAccelZero