Polaris Board¶
This module provides easy access to the Polaris board features and meaningful names for MCU pins and peripherals.
class main¶
class main()
Namespace for the Main connector signals and related peripherals:
PIN_VIN
- analog input for main supply voltagePIN_IGNITION
- digital input for ignition detection (active high)PIN_SOS
- digital input for emergency button (active low)PIN_AIN1
,PIN_RANGE_IN1
- analog input 1 and range selection pinPIN_AIN2
,PIN_RANGE_IN2
- analog input 2 and range selection pinPIN_AIN3
,PIN_RANGE_IN3
- analog input 3 and range selection pinPIN_AIN4
,PIN_RANGE_IN4
- analog input 4 and range selection pinPIN_IOEXP_IN1
- control input 1 for I/O ExpanderPIN_IOEXP_IN2
- control input 2 for I/O ExpanderADC_VIN
- ADC channel (usingPIN_VIN
)ADC_IN1
- ADC channel (usingPIN_AIN1
)ADC_IN2
- ADC channel (usingPIN_AIN2
)ADC_IN3
- ADC channel (usingPIN_AIN3
)ADC_IN4
- ADC channel (usingPIN_AIN4
)PWM_IOEXP_IN1
- PWM control input 1 for I/O ExpanderPWM_IOEXP_IN2
- PWM control input 2 for I/O Expander
class mikrobus¶
class mikrobus()
Namespace for the mikroBUS expansion interface signals and related peripherals:
PIN_MISO
,PIN_MOSI
,PIN_SCK
,PIN_CS
- expansion SPI interfacePIN_SDA
,PIN_SCL
- expansion I2C interfacePIN_TX
,PIN_RX
- expansion UART pinsPIN_RST
,PIN_INT
- general purpose I/O pins (usually reset and interrupt)PIN_PWM
- PWM capable pinPIN_AN
- analog input pinSERIAL
- serial driver (usingPIN_RX
,``PIN_TX``)SPI
- SPI driver (usingPIN_MISO
,PIN_MOSI
,PIN_SCK
)I2C
- I2C driver (usingPIN_SDA
,PIN_SCL
)PWM
- PWM channel (usingPIN_PWM
)ADC
- ADC channel (usingPIN_AN
)
class extbus¶
class extbus()
Namespace for the Ext-A expansion interface signals and related peripherals:
PIN_GPIO1
,PIN_GPIO2
- general purpose I/O pinsPIN_TX
,PIN_RX
- expansion UART pinsPIN_PWM
- PWM capable pinPIN_AN1
- analog input pinPIN_DAC1
,PIN_DAC1
- analog pinsSERIAL
- serial driver (usingPIN_RX
,``PIN_TX``)PWM
- PWM channel (usingPIN_PWM
)ADC
- ADC channel (usingPIN_AN1
)
class internal
Namespace for on-board devices signals and peripherals:
PIN_LED_RED
,PIN_LED_GREEN
- LED control pins (active low)PIN_POWER_DIS
- main power control pin (shutdown)PIN_5V_EN
- control pin for 5V regulatorPIN_BATT_EN
- backup battery status pinPIN_IOEXP_CS
- I/O Expander chip-select pinPIN_CAN_STANDBY
- control pin for CAN transceiver stand-by mode (low for normal operation)PIN_ACCEL_CS
,PIN_ACCEL_INT
- accelerometer chip-select and interrupt pinsPIN_CHARGE_PROG
,PIN_CHARGE_STAT
- backup battery charger control and status pinsPIN_BATT_ADC
- analog input for backup battery voltageSPI
- on-board SPI driver (for accelerometer and I/O Expander)ADC_BATT
- ADC channel (usingPIN_BATT_ADC
)
class gnss¶
class gnss()
Namespace for GNSS module signals and related peripherals:
PIN_STANDBY
,PIN_RESET
- module control pinsPIN_TX
,PIN_RX
- module UART pinsPIN_ANTON
- control pin (used only in the NB-IoT variant with BG96)SERIAL
- serial driver (usingPIN_RX
,``PIN_TX``)
class gsm¶
class gsm()
Namespace for Modem signals and related peripherals:
PIN_TX
,PIN_RX
- modem UART pinsPIN_POWER
,PIN_KILL
,PIN_WAKE
- modem control pinsPIN_STATUS
,PIN_RING
- modem status pinsSERIAL
- serial driver (usingPIN_RX
,``PIN_TX``)
init¶
init()
Performs required initialization of Polaris pins and common functionalities. It should be called at the start of your application.
sBatteryBackup¶
sBatteryBackup()
Returns a boolean value to indicate whether the board is powered from the backup battery source.
setBatteryCharger¶
setBatteryCharger(enable)
Enables or disables the backup battery charger (5V required).
Note: Do not enable the charger when the main power supply is not present.
getChargerStatus¶
getChargerStatus()
Returns the battery charger status (not charging, charging or fully charged).
Returns: One of these values: CHARGE_NONE
= 0, CHARGE_BUSY
= 1, CHARGE_COMPLETE
= 2.
getIgnitionStatus¶
getIgnitionStatus()
Reads the ignition status from digital input pin IGN/DIO5 (active high).
Returns: An integer value to indicate whether the ignition switch is on/off: IGNITION_ON
= 1 or IGNITION_OFF
= 0.
getEmergencyStatus¶
getEmergencyStatus()
Reads the emergency button status from digital input pin SOS/DIO6 (active low).
Returns: An integer value to indicate whether the emergency button is switched on/off: SOS_ON
= 1 or SOS_OFF
= 0.
shutdown¶
shutdown()
Disables the main regulator or backup battery source, effectively power-cycling the board.
readMainVoltage¶
readMainVoltage()
Returns the analog measure of the main supply voltage.
readMainVoltage¶
readMainVoltage()
Returns the analog measure of the backup battery voltage.
readAnalogInputVoltage¶
readAnalogInputVoltage(pin_num,range=HIGH)
Returns the voltage measure of an analog input pin on the Main connector.
Arguments:
- pin_num – Index of the analog pin (0-3 = corresponds to AIO1-4)
- range – Full-scale range: HIGH (0-36V) or LOW (0-5V)
ledRedOff¶
ledRedOff()
Switch the red LED off.
ledRedOn¶
ledRedOn()
Switch the red LED on.
ledGreenOff¶
ledGreenOff()
Switch the green LED off.
ledGreenOn¶
ledGreenOn()
Switch the green LED on.