Jump to main content

# 1.2.5.3 bootloader_GetVersion Function

## C

    uint16_t bootloader_GetVersion( void );

## Summary

Returns the current bootloader version.

## Description

This function can be used to read the current version of bootloader.

The bootloader version is of 2 Bytes. MAJOR version is sent first followed by MINOR version.

This function is defined as __WEAK in bootloader core and defines the bootloader version to current release version of bootloader repo.

It can be overridden with custom implementation by user based on his requirement.

User can make use of bootloader read version command to read the current version from the respective host.

## Precondition

None.

## Parameters

None.

## Returns

- bootloader version: 2 Bytes (MAJOR version is sent first followed by MINOR version)

## Example

    // Bootloader Major and Minor version sent for a Read Version command (MAJOR.MINOR)
    #define BTL_MAJOR_VERSION       3
    #define BTL_MINOR_VERSION       6

    uint16_t bootloader_GetVersion( void )
    {
        uint16_t btlVersion = (((BTL_MAJOR_VERSION & 0xFF) << 8) | (BTL_MINOR_VERSION & 0xFF));

        return btlVersion;
    }

Rev: G