u32 LP PHY Get Receive Power (s32 *index)
If PHY Revision >= 2
- Set max_index to 36
If *index >= 0
- Get code from the LP PHY Rev 2 Gaincode Table[*index]
- Otherwise
- Set max_index to 33
If *index < 0
- Set *index to 20
- Read LP table with length 1, width 16, ID 0x0C, offset *index, and data pointer to code
- if *index is -1
- Set *index to 0
Loop while index < max_index AND power < 700
Call LP PHY Set RX Gain with argument from the LP PHY Rev 2 GainCode Table indexed by *index
Call LP PHY Measure Digital Power with argument lpphy_noise_samples. Save result as power
- Increment *index
- Decrement *index
- Otherwise
Call LP PHY Set RX Gain with argument code
Call LP PHY Measure Digital Power with argument lpphy_noise_samples. Save result as power
- Return power