RTOS_MSPM0  1.1
ECE445M starter code
Files | Functions
TFLuna

Asynchronous serial communication to TFLuna1. More...

Files

file  TFLuna1.h
 Initialize TFLuna1, interrupt synchronization.
 
file  TFLuna2.h
 Initialize TFLuna2, interrupt synchronization.
 
file  TFLuna3.h
 Initialize TFLuna3, interrupt synchronization.
 

Functions

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

Asynchronous serial communication to TFLuna1.

Asynchronous serial communication to TFLuna3.

Asynchronous serial communication to TFLuna2.

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

◆ 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, set jumper J14
interrupt synchronization

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.
to use PA9, set jumper J14
interrupt synchronization

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.
to use PA9, set jumper J14
interrupt synchronization

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