Copied from nRF Connect SDK and edited Co-authored-by: Grzegorz Ferenc Signed-off-by: Kristoffer Rist Skøien <kristoffer.skoien@nordicsemi.no>