Skip to main content

ocp_register

Function ocp_register 

Source
pub const fn ocp_register(milliamps: u16) -> u8
Expand description

Returns RegOcp for a current limit, from Table 37.

§Arguments

  • milliamps - the most current the amplifier may draw.

§Returns

The register value with OcpOn set and the trim that gives the limit: 45 + 5 * trim mA up to 120 mA, -30 + 10 * trim mA up to 240 mA, and 240 mA above.

§Examples

use pamoja_radios::sx127x::config::ocp_register;

// 100 mA is the RegOcp reset value.
assert_eq!(ocp_register(100), 0x2B);
assert_eq!(ocp_register(140), 0x31);