MSPM0_ValvanoWare  1.0
ECE445L starter code
Files | Macros | Functions
RSLK

RSLK sensors and Actuators. More...

Files

file  BNO085.h
 Interfacing the BNO085 IMU.
 
file  Bump.h
 RSLK Bumper switches.
 
file  Motor.h
 RSLK dual H-bridge driver.
 
file  MotorControl.h
 RSLK PI motor controller.
 
file  Tachometer.h
 RSLK tachometer.
 
file  TFLuna1.h
 Initialize TFLuna1, interrupt synchronization.
 
file  TFLuna2.h
 Initialize TFLuna2, interrupt synchronization.
 
file  TFLuna3.h
 Initialize TFLuna3, interrupt synchronization.
 

Macros

#define MOTOR_PERIOD   10000
 
#define MOTORMIN   2
 
#define MOTORMAX   (MOTOR_PERIOD-2)
 
#define DUMPSIZE   200
 DUMPSIZE is the size of the dump buffer.
 

Functions

void BNO085_Reset (uint32_t time)
 Reset the BNO085. More...
 
void BNO085_Init (void(*function)(int16_t data[6]))
 Initialize 9-DOF BNO085 IMU. More...
 
void Bump_Init (void)
 Initialize bump switches. More...
 
uint32_t Bump_In (void)
 Read bump switches. More...
 
void Motor_Init (void)
 Initialize motors. More...
 
void Motor_Forward (uint32_t dutyLeft, uint32_t dutyRight)
 Go forward. More...
 
void Motor_Backward (uint32_t dutyLeft, uint32_t dutyRight)
 Go backward. More...
 
void Motor_Right (uint32_t dutyLeft, uint32_t dutyRight)
 Turn right. More...
 
void Motor_Left (uint32_t dutyLeft, uint32_t dutyRight)
 Turn left. More...
 
void MC_Init (void)
 Initialize tach input and motor outputs. More...
 
void MC_PIControlLoop (void)
 PI controller. More...
 
void MC_SetDesiredSpeed (uint32_t newSpeed)
 Set desired speed. More...
 
uint32_t MC_GetDesiredSpeed (void)
 Get desired speed. More...
 
void MC_SetKp1 (int32_t kp1)
 Set numerator for proportial control. More...
 
void MC_SetKp2 (int32_t kp2)
 Set denominator for proportial control. More...
 
void MC_SetKi1 (int32_t ki1)
 Set numerator for integral control. More...
 
void MC_SetKi2 (int32_t ki2)
 Set denominator for integral control. More...
 
int32_t MC_GetKp1 (void)
 Get numerator for proportial control. More...
 
int32_t MC_GetKp2 (void)
 Get denominator for proportial control. More...
 
int32_t MC_GetKi1 (void)
 Get numerator for integral control. More...
 
int32_t MC_GetKi2 (void)
 Get denominator for integral control. More...
 
int32_t MC_GetLeftE (void)
 Get controller error on left. More...
 
int32_t MC_GetRightE (void)
 Get controller error on right. More...
 
int32_t MC_GetLeftU (void)
 Get controller actuator output on left. More...
 
int32_t MC_GetRightU (void)
 Get controller actuator output on right. More...
 
uint32_t MC_Time (void)
 Get controller time. More...
 
uint32_t * MC_DumpRight (void)
 Get right speed log. More...
 
uint32_t * MC_DumpLeft (void)
 Get left speed log. More...
 
void Tachometer_CheckForStopped (void)
 Check for stopped motors. More...
 
void Tachometer_Init (void)
 Initialize motors. More...
 
uint32_t Tachometer_GetRightrpm (void)
 Right motor speed. More...
 
uint32_t Tachometer_GetLeftrpm (void)
 Left motor speed. More...
 
void TFLuna1_Init (void(*function)(uint32_t))
 Initialize TFLuna1. More...
 
void TFLuna1_Format_Standard_mm (void)
 mm units More...
 
void TFLuna1_Format_Standard_cm (void)
 cm units More...
 
void TFLuna1_Format_Pixhawk (void)
 Pixhawk. More...
 
void TFLuna1_Frame_Rate (void)
 sampling rate More...
 
void TFLuna1_SaveSettings (void)
 save format and rate More...
 
void TFLuna1_System_Reset (void)
 start measurements More...
 
void TFLuna1_Output_Enable (void)
 enable More...
 
void TFLuna1_Output_Disable (void)
 disable More...
 
void TFLuna1_SendMessage (const uint8_t msg[])
 output message to TFLuna More...
 
uint8_t TFLuna1_InChar (void)
 
uint32_t TFLuna1_InStatus (void)
 
uint32_t TFLuna1_OutStatus (void)
 
void TFLuna1_OutString (uint8_t *pt)
 output string to TFLuna More...
 
void TFLuna1_OutChar (uint8_t data)
 output character to TFLuna More...
 
void TFLuna2_Init (void(*function)(uint32_t))
 Initialize TFLuna2. More...
 
void TFLuna2_Format_Standard_mm (void)
 mm units More...
 
void TFLuna2_Format_Standard_cm (void)
 cm units More...
 
void TFLuna2_Format_Pixhawk (void)
 Pixhawk. More...
 
void TFLuna2_Frame_Rate (void)
 sampling rate More...
 
void TFLuna2_SaveSettings (void)
 save format and rate More...
 
void TFLuna2_System_Reset (void)
 start measurements More...
 
void TFLuna2_Output_Enable (void)
 enable More...
 
void TFLuna2_Output_Disable (void)
 disable More...
 
void TFLuna2_SendMessage (const uint8_t msg[])
 output message to TFLuna2 More...
 
uint8_t TFLuna2_InChar (void)
 
uint32_t TFLuna2_InStatus (void)
 
uint32_t TFLuna2_OutStatus (void)
 
void TFLuna2_OutString (uint8_t *pt)
 output string to TFLuna2 More...
 
void TFLuna2_OutChar (uint8_t data)
 output character to TFLuna2 More...
 
void TFLuna3_Init (void(*function)(uint32_t))
 Initialize TFLuna3. More...
 
void TFLuna3_Format_Standard_mm (void)
 mm units More...
 
void TFLuna3_Format_Standard_cm (void)
 cm units More...
 
void TFLuna3_Format_Pixhawk (void)
 Pixhawk. More...
 
void TFLuna3_Frame_Rate (void)
 sampling rate More...
 
void TFLuna3_SaveSettings (void)
 save format and rate More...
 
void TFLuna3_System_Reset (void)
 start measurements More...
 
void TFLuna3_Output_Enable (void)
 enable More...
 
void TFLuna3_Output_Disable (void)
 disable More...
 
void TFLuna3_SendMessage (const uint8_t msg[])
 output message to TFLuna3 More...
 
uint8_t TFLuna3_InChar (void)
 
uint32_t TFLuna3_InStatus (void)
 
uint32_t TFLuna3_OutStatus (void)
 
void TFLuna3_OutString (uint8_t *pt)
 output string to TFLuna3 More...
 
void TFLuna3_OutChar (uint8_t data)
 output character to TFLuna3 More...
 

Detailed Description

RSLK sensors and Actuators.

BNO085 pins on the MSPM0G3507
BNO085MSPM0
Vcc 3.3V Power
GND GND
SCL left not connected
SDA PB13 RxD: is UART3 Rx (BNO085 to MSPM0) baud=115200 bps
AD0 left not connected
CS left not connected
INT left not connected
RST PB12 GPIO output (drive low to reset)
PS1 left not connected (pulled low)
PS0 3.3V to select UART-RVC mode (there is a solder jumper on back)
RSLK Bumper switches
TM4C MSPM0 Description
PA5 PA27 Left, Bump 0,
PF0 PB15 Center Left, Bump 1,
PB3 PA28 Center Right, Bump 2
PC4 PA31 Right, Bump 3
RSLK RSLK motor pins
TM4C MSPM0 Description
PF2 PB4 Motor_PWML, ML+, IN3, PB.4/TIMA1_C0;
PF3 PB1 Motor_PWMR, MR+, IN1, PB.1/TIMA1_C1;
PA3 PB0 Motor_DIR_L,ML-, IN4, 1 means forward, 0 means backward
PA2 PB16 Motor_DIR_R,MR-, IN2
RSLK RSLK motor pins
TM4C MSPM0 Description
PB7 PB8 ELA TA0_C0
PB2 PB12 ERA TA0_C1
ERB GPIO input (not connected)
ELB GPIO input (not connected)
RSLK motor pins
TM4C MSPM0 Description
PF2 PB4 Motor_PWML, ML+, IN3, PB.4/TIMA1_C0;
PF3 PB1 Motor_PWMR, MR+, IN1, PB.1/TIMA1_C1;
PA3 PB0 Motor_DIR_L,ML-, IN4, 1 means forward, 0 means backward
PA2 PB16 Motor_DIR_R,MR-, IN2
RSLK RSLK motor pins
TM4C MSPM0 Description
PB7 PB8 ELA TA0_C0
PB2 PB12 ERA TA0_C1
ERB GPIO input (not connected)
ELB GPIO input (not connected)
SJ-PM-TF-Luna+A01 interface
TFLuna Pin Description
1 Red 5V
2 Serial TxD: PA8/PA17/PB4/PB6 is UART1 Tx (MSPM0 to TFLuna1)
3 Serial RxD: PA9/PA18/PB5/PB7 is UART1 Rx (TFLuna1 to MSPM0)
4 black ground
SJ-PM-TF-Luna+A01 interface
TFLuna Pin Description
1 Red 5V
2 Serial TxD: PA21/PA23/PB15/PB17 is UART2 Tx (MSPM0 to TFLuna2)
3 Serial RxD: PA22/PA24/PB16/PB18 is UART2 Rx (TFLuna2 to MSPM0)
4 black ground
SJ-PM-TF-Luna+A01 interface
TFLuna Pin Description
1 Red 5V
2 Serial TxD: PA14/PA26/PB2/PB12 is UART3 Tx (MSPM0 to TFLuna3)
3 Serial RxD: PA13/PA25/PB3/PB13 is UART3 Rx (TFLuna3 to MSPM0)
4 black ground

Function Documentation

◆ BNO085_Init()

void BNO085_Init ( void(*)(int16_t data[6])  function)

Initialize 9-DOF BNO085 IMU.

Initialize the UART3 for 115,200 baud rate
8 bit word length, no parity bits, one stop bit, FIFO enabled
Callback function will be called at 100 Hz
data[0] Yaw 0.01 deg
data[1] Pitch 0.01 deg
data[2] Roll 0.01 deg
data[3] X-acceleration 0.001g
data[4] Y-acceleration 0.001g
data[5] Z-acceleration 0.001g

Parameters
functionpointer to callback function to which is passed an 6-element array
Returns
none
Note
Assumes BNO085 is configured for UART-RVC mode

◆ BNO085_Reset()

void BNO085_Reset ( uint32_t  time)

Reset the BNO085.

Reset the 9-DOF BNO085 IMU
RST =0
wait time bus cycles
RST =1

Parameters
timenumber of bus cycles to hold RST low
Returns
none
Note
only 100us (time=8000) was tested

◆ Bump_In()

uint32_t Bump_In ( void  )

Read bump switches.

Input RSLK bump switches
bit 0 is left
bit 1 is left center
bit 2 is right center
bit 3 is right

Parameters
none
Returns
0 to 15 in positive logic

◆ Bump_Init()

void Bump_Init ( void  )

Initialize bump switches.

Initialize RSLK bump switches

Parameters
none
Returns
none

◆ MC_DumpLeft()

uint32_t* MC_DumpLeft ( void  )

Get left speed log.

Get buffer to dumped left speed

Parameters
none
Returns
pointer to left speed log
Note
left and right speeds are dumped after each change in desired speed

◆ MC_DumpRight()

uint32_t* MC_DumpRight ( void  )

Get right speed log.

Get buffer to dumped Right speed

Parameters
none
Returns
pointer to right speed log
Note
left and right speeds are dumped after each change in desired speed

◆ MC_GetDesiredSpeed()

uint32_t MC_GetDesiredSpeed ( void  )

Get desired speed.

Get desired speed in 0.1 rpm.

Parameters
newSpeed
Returns
desiredSpeed

◆ MC_GetKi1()

int32_t MC_GetKi1 ( void  )

Get numerator for integral control.

Get Ki1

Parameters
none
Returns
Ki1

◆ MC_GetKi2()

int32_t MC_GetKi2 ( void  )

Get denominator for integral control.

Get Ki2

Parameters
none
Returns
Ki2

◆ MC_GetKp1()

int32_t MC_GetKp1 ( void  )

Get numerator for proportial control.

Get Kp1

Parameters
none
Returns
Kp1

◆ MC_GetKp2()

int32_t MC_GetKp2 ( void  )

Get denominator for proportial control.

Get Kp2

Parameters
none
Returns
Kp2

◆ MC_GetLeftE()

int32_t MC_GetLeftE ( void  )

Get controller error on left.

Get LeftE

Parameters
none
Returns
LeftE

◆ MC_GetLeftU()

int32_t MC_GetLeftU ( void  )

Get controller actuator output on left.

Get LeftU

Parameters
none
Returns
LeftU

◆ MC_GetRightE()

int32_t MC_GetRightE ( void  )

Get controller error on right.

Get RightE

Parameters
none
Returns
RightE

◆ MC_GetRightU()

int32_t MC_GetRightU ( void  )

Get controller actuator output on right.

Get RightU

Parameters
none
Returns
RightU

◆ MC_Init()

void MC_Init ( void  )

Initialize tach input and motor outputs.

Initialize RSLK Controller

Parameters
none
Returns
none

◆ MC_PIControlLoop()

void MC_PIControlLoop ( void  )

PI controller.

Run RSLK PI Controller

Parameters
none
Returns
none
Note
should run at 100Hz

◆ MC_SetDesiredSpeed()

void MC_SetDesiredSpeed ( uint32_t  newSpeed)

Set desired speed.

Set desired speed in 0.1 rpm. Robot should move in a straight line

Parameters
newSpeed
Returns
none

◆ MC_SetKi1()

void MC_SetKi1 ( int32_t  ki1)

Set numerator for integral control.

Set Ki1

Parameters
ki1
Returns
none

◆ MC_SetKi2()

void MC_SetKi2 ( int32_t  ki2)

Set denominator for integral control.

Set Ki2

Parameters
ki2
Returns
none

◆ MC_SetKp1()

void MC_SetKp1 ( int32_t  kp1)

Set numerator for proportial control.

Set Kp1

Parameters
kp1
Returns
none

◆ MC_SetKp2()

void MC_SetKp2 ( int32_t  kp2)

Set denominator for proportial control.

Set Kp2

Parameters
kp2
Returns
none

◆ MC_Time()

uint32_t MC_Time ( void  )

Get controller time.

Get Time since last change in desired speed, 10 ms

Parameters
none
Returns
Time
Note
Controller runs at 100Hz

◆ Motor_Backward()

void Motor_Backward ( uint32_t  dutyLeft,
uint32_t  dutyRight 
)

Go backward.

Set RSLK motor power backward

Parameters
dutyLeft2 to 99998 us
dutyRight2 to 99998 us
Returns
none
Note
period is 10000 us

◆ Motor_Forward()

void Motor_Forward ( uint32_t  dutyLeft,
uint32_t  dutyRight 
)

Go forward.

Set RSLK motor power forward

Parameters
dutyLeft2 to 99998 us
dutyRight2 to 99998 us
Returns
none
Note
period is 10000 us

◆ Motor_Init()

void Motor_Init ( void  )

Initialize motors.

Initialize RSLK motors

Parameters
none
Returns
none
Note
PWM period is 10000 us

◆ Motor_Left()

void Motor_Left ( uint32_t  dutyLeft,
uint32_t  dutyRight 
)

Turn left.

Set RSLK motor power left turn
Activate right motor forward and left motor backward (pivot)

Parameters
dutyLeft2 to 99998 us
dutyRight2 to 99998 us
Returns
none
Note
period is 10000 us

◆ Motor_Right()

void Motor_Right ( uint32_t  dutyLeft,
uint32_t  dutyRight 
)

Turn right.

Set RSLK motor power right turn
Activate left motor forward and right motor backward (pivot)

Parameters
dutyLeft2 to 99998 us
dutyRight2 to 99998 us
Returns
none
Note
period is 10000 us

◆ Tachometer_CheckForStopped()

void Tachometer_CheckForStopped ( void  )

Check for stopped motors.

Check for stopped motors Higher level software must run this every 10ms

Parameters
none
Returns
none
Note
If the wheel is not spinning there will be no input capture interrupts

◆ Tachometer_GetLeftrpm()

uint32_t Tachometer_GetLeftrpm ( void  )

Left motor speed.

Left motor speed in 0.1 RPM. Does not wait for next measurement, returns with last measurement

Parameters
none
Returns
Leftrpm
Note
Uses input capture on ELA
Since ELB is not connected, RSLK2 cannot measure direction

◆ Tachometer_GetRightrpm()

uint32_t Tachometer_GetRightrpm ( void  )

Right motor speed.

Right motor speed in 0.1 RPM. Does not wait for next measurement, returns with last measurement

Parameters
none
Returns
Rightrpm
Note
Uses input capture on ERA
Since ERB is not connected, RSLK2 cannot measure direction

◆ Tachometer_Init()

void Tachometer_Init ( void  )

Initialize motors.

Initialize RSLK tachometers, 16-bit, 1us resolution

Parameters
none
Returns
none
Note
Uses input capture on ELA and ERA

◆ TFLuna1_Format_Pixhawk()

void TFLuna1_Format_Pixhawk ( void  )

Pixhawk.

Configure TFLuna for Pixhawk

Parameters
none
Returns
none
Warning
see datasheet, never tested

◆ TFLuna1_Format_Standard_cm()

void TFLuna1_Format_Standard_cm ( void  )

cm units

Configure TFLuna for measuring distance in cm

Parameters
none
Returns
none

◆ TFLuna1_Format_Standard_mm()

void TFLuna1_Format_Standard_mm ( void  )

mm units

Configure TFLuna for measuring distance in mm

Parameters
none
Returns
none

◆ TFLuna1_Frame_Rate()

void TFLuna1_Frame_Rate ( void  )

sampling rate

Configure TFLuna sampling rate
rate defined in #define TFLunaRate

Parameters
none
Returns
none
Warning
only 100 Hz was tested

◆ TFLuna1_InChar()

uint8_t TFLuna1_InChar ( void  )

Wait for new serial port input
Uses interrupt synchronization
This function waits if the receive software FIFO is empty

Parameters
Inputnone
Returns
8-bit code from TF Luna

◆ TFLuna1_Init()

void TFLuna1_Init ( void(*)(uint32_t)  function)

Initialize TFLuna1.

initialize UART1 for 115200 bps baud rate.
to use PA9/PA18/PB5/PB7, for PA9 set jumper J14
interrupt synchronization, priority=1

Parameters
functionpointer to a callback function
Returns
none

◆ TFLuna1_InStatus()

uint32_t TFLuna1_InStatus ( void  )

Returns how much data available for reading

Parameters
none
Returns
number of elements in receive software FIFO

◆ TFLuna1_OutChar()

void TFLuna1_OutChar ( uint8_t  data)

output character to TFLuna

Output 8-bit to serial port TFLuna
Uses interrupt synchronization
This function waits if the transmit software FIFO is full

Parameters
datais an 8-bit ASCII character to be transferred
Returns
none

◆ TFLuna1_Output_Disable()

void TFLuna1_Output_Disable ( void  )

disable

Disable TFLuna output

Parameters
none
Returns
none
Warning
I didn't use these because output enabled was default

◆ TFLuna1_Output_Enable()

void TFLuna1_Output_Enable ( void  )

enable

Enable TFLuna output

Parameters
none
Returns
none
Warning
I didn't use these because output enabled was default

◆ TFLuna1_OutStatus()

uint32_t TFLuna1_OutStatus ( void  )

Returns how many bytes are in the transmission software FIFO

Parameters
none
Returns
number of elements in transmission software FIFO

◆ TFLuna1_OutString()

void TFLuna1_OutString ( uint8_t *  pt)

output string to TFLuna

Output string to serial port TFLuna
Uses interrupt synchronization
This function waits if the transmit software FIFO is full

Parameters
ptpointer to a NULL-terminated string to be transferred
Returns
none

◆ TFLuna1_SaveSettings()

void TFLuna1_SaveSettings ( void  )

save format and rate

execute TFLuna_SaveSettings to activate changes to Format and Frame_Rate

Parameters
none
Returns
none

◆ TFLuna1_SendMessage()

void TFLuna1_SendMessage ( const uint8_t  msg[])

output message to TFLuna

Output message to serial port TFLuna
Uses interrupt synchronization
msg[0] is 0x5A for command type
msg[1] is length=n
msg[2] is command
msg[3]-msg[n-2] is optional payload
msg[n-1] is 8-bit checksum
E.g., 0x5A,0x05,0x05,0x06,0x6A sets format to mm
This function waits if the transmit software FIFO is full

Parameters
msgpointer to a message to be transferred
Returns
none

◆ TFLuna1_System_Reset()

void TFLuna1_System_Reset ( void  )

start measurements

execute TFLuna_System_Reset to start measurements

Parameters
none
Returns
none

◆ TFLuna2_Format_Pixhawk()

void TFLuna2_Format_Pixhawk ( void  )

Pixhawk.

Configure TFLuna2 for Pixhawk

Parameters
none
Returns
none
Warning
see datasheet, never tested

◆ TFLuna2_Format_Standard_cm()

void TFLuna2_Format_Standard_cm ( void  )

cm units

Configure TFLuna2 for measuring distance in cm

Parameters
none
Returns
none

◆ TFLuna2_Format_Standard_mm()

void TFLuna2_Format_Standard_mm ( void  )

mm units

Configure TFLuna2 for measuring distance in mm

Parameters
none
Returns
none

◆ TFLuna2_Frame_Rate()

void TFLuna2_Frame_Rate ( void  )

sampling rate

Configure TFLuna2 sampling rate
rate defined in #define TFLunaRate

Parameters
none
Returns
none
Warning
only 100 Hz was tested

◆ TFLuna2_InChar()

uint8_t TFLuna2_InChar ( void  )

Wait for new serial port input
Uses interrupt synchronization
This function waits if the receive software FIFO is empty

Parameters
Inputnone
Returns
8-bit code from TFLuna2

◆ TFLuna2_Init()

void TFLuna2_Init ( void(*)(uint32_t)  function)

Initialize TFLuna2.

initialize UART2 for 115200 bps baud rate.
interrupt synchronization, priority=1

Parameters
functionpointer to a callback function
Returns
none

◆ TFLuna2_InStatus()

uint32_t TFLuna2_InStatus ( void  )

Returns how much data available for reading

Parameters
none
Returns
number of elements in receive software FIFO

◆ TFLuna2_OutChar()

void TFLuna2_OutChar ( uint8_t  data)

output character to TFLuna2

Output 8-bit to serial port TFLuna2
Uses interrupt synchronization
This function waits if the transmit software FIFO is full

Parameters
datais an 8-bit ASCII character to be transferred
Returns
none

◆ TFLuna2_Output_Disable()

void TFLuna2_Output_Disable ( void  )

disable

Disable TFLuna output

Parameters
none
Returns
none
Warning
I didn't use these because output enabled was default

◆ TFLuna2_Output_Enable()

void TFLuna2_Output_Enable ( void  )

enable

Enable TFLuna output

Parameters
none
Returns
none
Warning
I didn't use these because output enabled was default

◆ TFLuna2_OutStatus()

uint32_t TFLuna2_OutStatus ( void  )

Returns how many bytes are in the transmission software FIFO

Parameters
none
Returns
number of elements in transmission software FIFO

◆ TFLuna2_OutString()

void TFLuna2_OutString ( uint8_t *  pt)

output string to TFLuna2

Output string to serial port TFLuna2
Uses interrupt synchronization
This function waits if the transmit software FIFO is full

Parameters
ptpointer to a NULL-terminated string to be transferred
Returns
none

◆ TFLuna2_SaveSettings()

void TFLuna2_SaveSettings ( void  )

save format and rate

execute TFLuna2_SaveSettings to activate changes to Format and Frame_Rate

Parameters
none
Returns
none

◆ TFLuna2_SendMessage()

void TFLuna2_SendMessage ( const uint8_t  msg[])

output message to TFLuna2

Output message to serial port TFLuna2
Uses interrupt synchronization
msg[0] is 0x5A for command type
msg[1] is length=n
msg[2] is command
msg[3]-msg[n-2] is optional payload
msg[n-1] is 8-bit checksum
E.g., 0x5A,0x05,0x05,0x06,0x6A sets format to mm
This function waits if the transmit software FIFO is full

Parameters
msgpointer to a message to be transferred
Returns
none

◆ TFLuna2_System_Reset()

void TFLuna2_System_Reset ( void  )

start measurements

execute TFLuna2_System_Reset to start measurements

Parameters
none
Returns
none

◆ TFLuna3_Format_Pixhawk()

void TFLuna3_Format_Pixhawk ( void  )

Pixhawk.

Configure TFLuna3 for Pixhawk

Parameters
none
Returns
none
Warning
see datasheet, never tested

◆ TFLuna3_Format_Standard_cm()

void TFLuna3_Format_Standard_cm ( void  )

cm units

Configure TFLuna3 for measuring distance in cm

Parameters
none
Returns
none

◆ TFLuna3_Format_Standard_mm()

void TFLuna3_Format_Standard_mm ( void  )

mm units

Configure TFLuna3 for measuring distance in mm

Parameters
none
Returns
none

◆ TFLuna3_Frame_Rate()

void TFLuna3_Frame_Rate ( void  )

sampling rate

Configure TFLuna3 sampling rate
rate defined in #define TFLunaRate

Parameters
none
Returns
none
Warning
only 100 Hz was tested

◆ TFLuna3_InChar()

uint8_t TFLuna3_InChar ( void  )

Wait for new serial port input
Uses interrupt synchronization
This function waits if the receive software FIFO is empty

Parameters
Inputnone
Returns
8-bit code from TFLuna3

◆ TFLuna3_Init()

void TFLuna3_Init ( void(*)(uint32_t)  function)

Initialize TFLuna3.

initialize UART3 for 115200 bps baud rate.
interrupt synchronization, priority=1

Parameters
functionpointer to a callback function
Returns
none

◆ TFLuna3_InStatus()

uint32_t TFLuna3_InStatus ( void  )

Returns how much data available for reading

Parameters
none
Returns
number of elements in receive software FIFO

◆ TFLuna3_OutChar()

void TFLuna3_OutChar ( uint8_t  data)

output character to TFLuna3

Output 8-bit to serial port TFLuna3
Uses interrupt synchronization
This function waits if the transmit software FIFO is full

Parameters
datais an 8-bit ASCII character to be transferred
Returns
none

◆ TFLuna3_Output_Disable()

void TFLuna3_Output_Disable ( void  )

disable

Disable TFLuna3 output

Parameters
none
Returns
none
Warning
I didn't use these because output enabled was default

◆ TFLuna3_Output_Enable()

void TFLuna3_Output_Enable ( void  )

enable

Enable TFLuna3 output

Parameters
none
Returns
none
Warning
I didn't use these because output enabled was default

◆ TFLuna3_OutStatus()

uint32_t TFLuna3_OutStatus ( void  )

Returns how many bytes are in the transmission software FIFO

Parameters
none
Returns
number of elements in transmission software FIFO

◆ TFLuna3_OutString()

void TFLuna3_OutString ( uint8_t *  pt)

output string to TFLuna3

Output string to serial port TFLuna3
Uses interrupt synchronization
This function waits if the transmit software FIFO is full

Parameters
ptpointer to a NULL-terminated string to be transferred
Returns
none

◆ TFLuna3_SaveSettings()

void TFLuna3_SaveSettings ( void  )

save format and rate

execute TFLuna3_SaveSettings to activate changes to Format and Frame_Rate

Parameters
none
Returns
none

◆ TFLuna3_SendMessage()

void TFLuna3_SendMessage ( const uint8_t  msg[])

output message to TFLuna3

Output message to serial port TFLuna
Uses interrupt synchronization
msg[0] is 0x5A for command type
msg[1] is length=n
msg[2] is command
msg[3]-msg[n-2] is optional payload
msg[n-1] is 8-bit checksum
E.g., 0x5A,0x05,0x05,0x06,0x6A sets format to mm
This function waits if the transmit software FIFO is full

Parameters
msgpointer to a message to be transferred
Returns
none

◆ TFLuna3_System_Reset()

void TFLuna3_System_Reset ( void  )

start measurements

execute TFLuna3_System_Reset to start measurements

Parameters
none
Returns
none