This section introduces the Infrared Receiver(IRRX) APIs including terms and acronyms, supported features, software architecture, details on how to use this driver, IRRX function groups, enums, structures and functions.
More...
This section introduces the Infrared Receiver(IRRX) APIs including terms and acronyms, supported features, software architecture, details on how to use this driver, IRRX function groups, enums, structures and functions.
Terms and acronyms
Supported features
- Support RC5 and PWD modes.
Supports two hardware decoding methods:
- PWD mode: PWD is pulse-width-detection in short. In this mode, the hardware detects the wavelengths, any type of code transmitted by infrared radiation can be received.The received content could be determined by using the wavelength.
- RC5 mode: The Philips RC5 IR transmission protocol uses Manchester encoding of the message bits. In this mode, the RC5 code can be received and decoded directly.
How to use this driver
- Use IRRX in the RC5 mode.
- Use IRRX in the PWD mode.
- Step1: Call hal_gpio_init() to init the pins, if EPT tool hasn't been used to configure the related pinmux.
- Step2: Set GPIO34 to RX function to enable the IRRX mode.
- Step3: Call hal_irrx_init() to initialize the IRRX.
- Step4: Set the PWD parameters: inverse and terminate_threshold.
- Step5: Call hal_irrx_receive_pwd_start() to start the hardware.
- Step6: Call hal_irrx_receive_pwd() to receive the PWD code.
- Step7: Call hal_irrx_receive_pwd_start() once again to restart the PWD mode.
- Step8: Call hal_irrx_deinit() to deinitialize the IRRX.
- sample code:
uint32_t us = 0;
user_callback,
NULL,
&us)) {
dbg_error("hal_irrx_receive_pwd_start fail!");
}
data,
sizeof(data))) {
dbg_error("hal_irrx_receive_pwd fail!");
}
void user_callback (void *user_data)
{
}
- Use IRRX driver to trigger IRRX RC5/PWD manually.
This function gets the current state of the IRRX.
- Parameters
-
| [out] | running_status | is the current running status. HAL_IRRX_BUSY means the IRRX is in busy status. HAL_IRRX_IDLE means the IRRX is in idle status, user can use it to transfer data now. |
- Returns
- Indicates whether this function call is successful or not. If the return value is HAL_IRRX_STATUS_OK, the operation completed successfully.
- Example
- Sample code, please refer to How to use this driver.
- See also
- hal_irrx_receive_pwd()
| hal_irrx_status_t hal_irrx_receive_pwd |
( |
uint8_t * |
received_length, |
|
|
uint8_t * |
buffer, |
|
|
uint8_t |
buffer_length |
|
) |
| |
This function receives the infrared radiation PWD code.
- Parameters
-
| [in] | received_length | the actual received length of code in the buffer. |
| [in] | buffer | the buffer to be used to stored received code. |
| [in] | buffer_length | the length of buffer that can be used to store received code. The maximum is 68 bytes and it is suggested to prepare 68 bytes of space for buffer and specify 68 as buffer_length. |
- Returns
- Indicates whether this function call is successful or not. If the return value is HAL_IRRX_STATUS_OK, the operation completed successfully. If the return value is HAL_IRRX_STATUS_INVALID_PARAM, it means a wrong parameter is given. The parameter needs to be verified.
- Example
- Sample code, please refer to How to use this driver.
- See also
- hal_irrx_receive_pwd()
This function starts to receive the infrared radiation PWD code.
- Parameters
-
| [in] | config | it's used when the receive operation starts. |
| [in] | callback | the callback function to be called when the receive operation starts. |
| [out] | precision_us | the PWD dectection precise time. |
- Returns
- Indicates whether this function call is successful or not. If the return value is HAL_IRRX_STATUS_OK, the operation completed successfully. If the return value is HAL_IRRX_STATUS_INVALID_PARAM, it means a wrong parameter is given. The parameter needs to be verified.
- Example
- Sample code, please refer to How to use this driver.
- See also
- hal_irrx_receive_pwd()