Skip to content

Radio Frontend Control

Structs

mira_net_frontend_config_t

Type Name Description
int16_t gain_cb_bypass_tx gain in bypass TX [cB].
int16_t gain_cb_bypass_rx gain in bypass RX [cB].
int16_t gain_cb_active_tx gain in PA active TX [cB].
int16_t gain_cb_active_rx gain in PA active RX [cB].
mira_gpio_pin_t[3] gpio_mode_control Set unused GPIO pins to MIRA_GPIO_PIN_UNDEFINED GPIO for PA mode control.
mira_gpio_pin_t gpio_antsel GPIO for antenna selection.
uint8_t pin_values_bypass_tx GPIO levels to select bypass TX mode.
uint8_t pin_values_bypass_rx GPIO levels to select bypass RX mode.
uint8_t pin_values_active_tx GPIO levels to select PA active TX mode.
uint8_t pin_values_active_rx GPIO levels to select PA active RX mode.
uint8_t pin_values_idle GPIO levels to set the PA in idle mode.
uint8_t[2] pin_values_antsel GPIO levels required for gpio_antsel to select antenna. Only bit 0 is used.
uint8_t pin_values_antsel_idle GPIO levels required for gpio_antsel to enter idle mode.

Control structure for PA/front-end.

Front-end configuration:

Functions

mira_net_set_low_power

mira_status_t mira_net_set_low_power(
    void);

Set low power mode.

Disable the radio front-end if present, lowering output power and power consumption.

Return

See enum definition.

Value Description
MIRA_SUCCESS Low power mode set successfully.
MIRA_ERROR_UNKNOWN An unknown error occurred.
MIRA_RADIO_ERROR Radio driver reported an error.
MIRA_ERROR_INVALID_VALUE Value invalid.
MIRA_ERROR_NOT_SUPPORTED Function not supported.

mira_net_set_high_power

mira_status_t mira_net_set_high_power(
    void);

Set high power mode.

Enable the radio front-end if present, increasing output power and power consumption.

Return

See enum definition.

Value Description
MIRA_SUCCESS High power mode set successfully.
MIRA_ERROR_UNKNOWN An unknown error occurred.
MIRA_RADIO_ERROR Radio driver reported an error.
MIRA_ERROR_INVALID_VALUE Value invalid.
MIRA_ERROR_NOT_SUPPORTED Function not supported.

mira_net_set_txpower

mira_status_t mira_net_set_txpower(
    int16_t       power_cbm);

Set radio output power.

Set the output power of the chip, without accounting for antenna gain. If in high power mode, and the TX power passed as parameter requires it, dynamically enable the radio front-end if any.

Power levels are quantized and therefore rounded down to the nearest available power level. The available power level that was set can be obtained through mira_net_get_actual_txpower().

All power values are in cBm, or centi-bel-mW, which is tenth of dBm. For example, 100 mW is 20.0 dBm, which is 200 cBm. The proper value to pass to the function is therefore 200.

Note: Also applies for BLE beacons, which are limited to 100 cBm by the BLE 4 standard. If a value above 100 cBm is requested, that value will be valid for Mira network messages, while BLE beacons will be sent at 100 cBm. If a value below 100 cBm is set, that value will be valid for both Mira network messages and BLE beacons.

Parameters

Parameter Description
power_cbm Desired output power in cBm.

Return

MIRA_SUCCESS if successful.

See enum definition.

Value Description
MIRA_SUCCESS Output power set successfully.
MIRA_ERROR_UNKNOWN An unknown error occurred.
MIRA_RADIO_ERROR Radio driver reported an error.
MIRA_ERROR_INVALID_VALUE Invalid output power.
MIRA_ERROR_NOT_SUPPORTED Function not supported.

mira_net_get_actual_txpower

mira_status_t mira_net_get_actual_txpower(
    int16_t*      power_cbm);

Get actual radio output power.

Get the output power for the current configuration.

Since output power may be quantized, and front-end might be active or inactive, the actual output power may differ from the requested.

Parameters

Parameter Description
power_cbm pointer to an int16_t of where to store the output power value.

Return

See enum definition.

Value Description
MIRA_SUCCESS Output power gotten successfully.
MIRA_ERROR_UNKNOWN An unknown error occurred.
MIRA_RADIO_ERROR Radio driver reported an error.
MIRA_ERROR_INVALID_VALUE Invalid output power.
MIRA_ERROR_NOT_SUPPORTED Function not supported.

mira_net_set_antenna

mira_status_t mira_net_set_antenna(
    mira_net_antenna_t  antenna);

Set active antenna.

The antenna defaults to the onboard antenna. If setting an antenna the hardware doesn't support, it will default back to the onboard antenna.

Parameters

Parameter Description
antenna Index of preferred antenna. Controls the pin defined in the front-end control structure. mira_net_frontend_config_t::gpio_antsel.

Return

See enum definition.

Value Description
MIRA_SUCCESS Antenna selected successfully.
MIRA_ERROR_UNKNOWN An unknown error occurred.
MIRA_RADIO_ERROR Radio driver reported an error.
MIRA_ERROR_INVALID_VALUE Invalid antenna.
MIRA_ERROR_NOT_SUPPORTED Function not supported.