MT7687 API Reference  LinkIt SDK v4
IRTX

This section introduces the Infrared Transmitter(IRTX) APIs including terms and acronyms, supported features, software architecture, details on how to use this driver, IRTX function groups, enums, structures and functions. More...

Overview

This section introduces the Infrared Transmitter(IRTX) APIs including terms and acronyms, supported features, software architecture, details on how to use this driver, IRTX function groups, enums, structures and functions.

Terms and acronyms

The following provides descriptions to the terms commonly used in the IRTX driver and how to use its various functions.

Terms Details
IRTX Infrared Transmitter is the transmitter element to send infrared radiation. For more information, please refer to introduction to IrDA in Wikipedia .

Supported features

How to use this driver

Functions

hal_irtx_status_t hal_irtx_init (void)
 This function initializes the IRTX hardware clock. More...
 
hal_irtx_status_t hal_irtx_deinit (void)
 This function deinitializes the IRTX hardware clock. More...
 
hal_irtx_status_t hal_irtx_send_nec_data (hal_irtx_repeat_code_t repeat_code, const uint8_t data[HAL_IRTX_MAX_DATA_LENGTH], uint32_t bit_length)
 This function sends the data in the NEC encoding format. More...
 
hal_irtx_status_t hal_irtx_send_rc5_data (hal_irtx_repeat_code_t repeat_code, const uint8_t data[HAL_IRTX_MAX_DATA_LENGTH], uint32_t bit_length)
 This function sends the data in the RC5 encoding format. More...
 
hal_irtx_status_t hal_irtx_send_rc6_data (hal_irtx_repeat_code_t repeat_code, const uint8_t data[HAL_IRTX_MAX_DATA_LENGTH], uint32_t bit_length)
 This function sends the data in the RC6 encoding format. More...
 
hal_irtx_status_t hal_irtx_configure_pulse_data_carrier (uint32_t frequency, uint32_t duty_cycle)
 This function configures the pulse data carrier. More...
 
hal_irtx_status_t hal_irtx_register_pulse_data_callback (hal_irtx_pulse_data_callback_t callback, void *user_data)
 This function registers the PWD encoding format data callback. More...
 
hal_irtx_status_t hal_irtx_send_pulse_data (uint32_t base_period, uint8_t *data, uint32_t length)
 This function sends the data in the PWD encoded format. More...
 
hal_irtx_status_t hal_irtx_get_running_status (hal_irtx_running_status_t *running_status)
 This function gets the current state of the IRTX. More...
 

Modules

 Define
 
 Enum
 
 Typedef
 

Function Documentation

hal_irtx_status_t hal_irtx_configure_pulse_data_carrier ( uint32_t  frequency,
uint32_t  duty_cycle 
)

This function configures the pulse data carrier.

Parameters
[in]frequencypulse data carrier frequency.
[in]duty_cyclepulse data carrier duty cycle.
Returns
Indicates whether this function call is successful or not. If the return value is HAL_IRTX_STATUS_OK, the operation completed successfully. If the return value is HAL_IRTX_STATUS_ERROR, the operation failed.
Example
Sample code, please refer to How to use this driver.
hal_irtx_status_t hal_irtx_deinit ( void  )

This function deinitializes the IRTX hardware clock.

Returns
Indicates whether this function call is successful or not. If the return value is HAL_IRTX_STATUS_OK, the operation completed successfully. If the return value is HAL_IRTX_STATUS_ERROR, the operation failed.
Example
Sample code, please refer to How to use this driver.
See also
hal_irtx_init()
hal_irtx_status_t hal_irtx_get_running_status ( hal_irtx_running_status_t running_status)

This function gets the current state of the IRTX.

Parameters
[out]running_statusis the current running status. HAL_IRTX_BUSY means the IRTX is in busy state. HAL_IRTX_IDLE means the IRTX is in idle state, which can be used to transfer data immediately.
Returns
Indicates whether this function call is successful or not. If the return value is HAL_IRTX_STATUS_OK, the operation completed successfully. If the return value is HAL_IRTX_STATUS_ERROR, the operation failed.
Example
Sample code, please refer to How to use this driver.
hal_irtx_status_t hal_irtx_init ( void  )

This function initializes the IRTX hardware clock.

Returns
Indicates whether this function call is successful or not. If the return value is HAL_IRTX_STATUS_OK, the operation completed successfully. If the return value is HAL_IRTX_STATUS_ERROR, the operation failed.
Example
Sample code please refer to How to use this driver.
See also
hal_irtx_deinit()
hal_irtx_status_t hal_irtx_register_pulse_data_callback ( hal_irtx_pulse_data_callback_t  callback,
void *  user_data 
)

This function registers the PWD encoding format data callback.

Call it after the transmission is complete.

Parameters
[in]callbackuser defined callback function.
[in]user_dataa user defined extension data.
Returns
Indicates whether this function call is successful or not. If the return value is HAL_IRTX_STATUS_OK, the operation completed successfully. If the return value is HAL_IRTX_STATUS_ERROR, the operation failed.
Example
Sample code, please refer to How to use this driver.
hal_irtx_status_t hal_irtx_send_nec_data ( hal_irtx_repeat_code_t  repeat_code,
const uint8_t  data[HAL_IRTX_MAX_DATA_LENGTH],
uint32_t  bit_length 
)

This function sends the data in the NEC encoding format.

Parameters
[in]repeat_coderepeat code for the NEC IRTX.
[in]datadata to be sent.
[in]bit_lengththe number of bits in the message.
Returns
Indicates whether this function call is successful or not. If the return value is HAL_IRTX_STATUS_OK, the operation completed successfully. If the return value is HAL_IRTX_STATUS_ERROR, the operation failed.
Example
Sample code, please refer to How to use this driver.
hal_irtx_status_t hal_irtx_send_pulse_data ( uint32_t  base_period,
uint8_t *  data,
uint32_t  length 
)

This function sends the data in the PWD encoded format.

Parameters
[in]base_periodthe base period for sending data.
[in]datathe data content to be sent.
[in]lengthdata length in bytes.
Returns
Indicates whether this function call is successful or not. If the return value is HAL_IRTX_STATUS_OK, the operation completed successfully. If the return value is HAL_IRTX_STATUS_ERROR, the operation failed.
Example
Sample code, please refer to How to use this driver.
hal_irtx_status_t hal_irtx_send_rc5_data ( hal_irtx_repeat_code_t  repeat_code,
const uint8_t  data[HAL_IRTX_MAX_DATA_LENGTH],
uint32_t  bit_length 
)

This function sends the data in the RC5 encoding format.

Parameters
[in]repeat_coderepeat code for the RC5 IRTX.
[in]datathe data content to be sent.
[in]bit_lengththe number of bits in the message.
Returns
Indicates whether this function call is successful or not. If the return value is HAL_IRTX_STATUS_OK, the operation completed successfully. If the return value is HAL_IRTX_STATUS_ERROR, the operation failed.
Example
Sample code, please refer to How to use this driver.
hal_irtx_status_t hal_irtx_send_rc6_data ( hal_irtx_repeat_code_t  repeat_code,
const uint8_t  data[HAL_IRTX_MAX_DATA_LENGTH],
uint32_t  bit_length 
)

This function sends the data in the RC6 encoding format.

Parameters
[in]repeat_coderepeat code for the RC6 IRTX.
[in]datathe data content to be sent.
[in]bit_lengththe number of bits in the message.
Returns
Indicates whether this function call is successful or not. If the return value is HAL_IRTX_STATUS_OK, the operation completed successfully. If the return value is HAL_IRTX_STATUS_ERROR, the operation failed.
Example
Sample code, please refer to How to use this driver.