foxBMS
1.2.1
The foxBMS Battery Management System API Documentation
|
Bit extraction function for mxm_17841b. More...
#include "mxm_bitextract.h"
Go to the source code of this file.
Functions | |
static MXM_41B_REG_BIT_VALUE | bitValue (MXM_41B_REG_BIT_VALUE value, uint8_t numberOfBits, MXM_41B_REG_BITS position, MXM_41B_REG_BITS shift) |
Extract a bit value function. More... | |
MXM_41B_REG_BIT_VALUE | mxm_41bReadValue (uint8_t reg, uint8_t numberOfBits, MXM_41B_REG_BITS position) |
read a value from a register supplied as variable More... | |
MXM_41B_REG_BIT_VALUE | mxm_41bWriteValue (MXM_41B_REG_BIT_VALUE value, uint8_t numberOfBits, MXM_41B_REG_BITS shift, uint8_t reg) |
write a value to a register supplied as variable More... | |
Bit extraction function for mxm_17841b.
SPDX-License-Identifier: BSD-3-Clause
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
We kindly request you to use one or more of the following phrases to refer to foxBMS in your hardware, software, documentation or advertising materials:
This module supplies a specific bit extraction functionality to read & write into status registers. The different statuses that are read from or write into are indicated in the enum. Battery monitoring driver for MAX1785x battery monitoring ICs.
Definition in file mxm_bitextract.c.
|
static |
Extract a bit value function.
The function is used to extract some number of bits (numOfBits) from a position (pos) to write or read from the configuration and status registers.
[in] | value | value of the bits that shall be written or read |
[in] | numberOfBits | number of bits to be extracted from the value register |
[in] | position | position of bits to be extracted from the value register, start from right to left |
[in] | shift | number of bit-shift to the left for read function the shift value is zero. |
Definition at line 90 of file mxm_bitextract.c.
MXM_41B_REG_BIT_VALUE mxm_41bReadValue | ( | uint8_t | reg, |
uint8_t | numberOfBits, | ||
MXM_41B_REG_BITS | position | ||
) |
read a value from a register supplied as variable
This function takes a register (reg), and extracts the data described by its length in bits (numberOfBits) and position (pos). This value is then returned.
[in] | reg | value of the register to be read |
[in] | numberOfBits | length og the bit sequence in bits |
[in] | position | start position of the bit sequence |
Definition at line 101 of file mxm_bitextract.c.
MXM_41B_REG_BIT_VALUE mxm_41bWriteValue | ( | MXM_41B_REG_BIT_VALUE | value, |
uint8_t | numberOfBits, | ||
MXM_41B_REG_BITS | shift, | ||
uint8_t | reg | ||
) |
write a value to a register supplied as variable
This function takes a register (reg), writes the data described by numberOFBits, shift and value to the register value and returns the updated register.
[in] | value | register value that should be written to the register |
[in] | numberOfBits | length of the entry that should be written in bits |
[in] | shift | start position in the register in bits |
[in] | reg | complete value of the register |
Definition at line 105 of file mxm_bitextract.c.