foxBMS - Unit Tests
1.5.0
The foxBMS Unit Tests API Documentation
|
Bit extraction function for MXM_17841b. More...
#include <stdint.h>
Go to the source code of this file.
Typedefs | |
typedef uint8_t | MXM_41B_REG_BIT_VALUE |
Bit-values for registers. More... | |
typedef uint8_t | MXM_41B_REG_BITS |
Functions | |
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... | |
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... | |
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.h.
#define MXM_41B_KEEP_ALIVE ((MXM_41B_REG_BITS)0u) |
bit for the feature Keep Alive
Definition at line 123 of file mxm_bitextract.h.
#define MXM_41B_REG_BAUD_RATE_1MBPS ((MXM_41B_REG_BIT_VALUE)0x02u) |
bit sequence for baud rate 1MBps
Definition at line 82 of file mxm_bitextract.h.
#define MXM_41B_REG_BAUD_RATE_2MBPS ((MXM_41B_REG_BIT_VALUE)0x03u) |
bit sequence for baud rate 2MBps
Definition at line 84 of file mxm_bitextract.h.
#define MXM_41B_REG_BAUD_RATE_500KBPS ((MXM_41B_REG_BIT_VALUE)0x00u) |
bit sequence for baud rate 500KBps
Definition at line 78 of file mxm_bitextract.h.
#define MXM_41B_REG_BAUD_RATE_500KBPS_ALT ((MXM_41B_REG_BIT_VALUE)0x01u) |
alternative bit sequence for baud rate 500KBps
Definition at line 80 of file mxm_bitextract.h.
#define MXM_41B_REG_FALSE ((MXM_41B_REG_BIT_VALUE)0x00u) |
one bit, 0u
Definition at line 74 of file mxm_bitextract.h.
#define MXM_41B_REG_KEEP_ALIVE_0US ((MXM_41B_REG_BIT_VALUE)0x00u) |
bit sequence for a keep alive period of 0µs
Definition at line 86 of file mxm_bitextract.h.
#define MXM_41B_REG_KEEP_ALIVE_10240US ((MXM_41B_REG_BIT_VALUE)0x0Bu) |
bit sequence for a keep alive period of 10240µs
Definition at line 108 of file mxm_bitextract.h.
#define MXM_41B_REG_KEEP_ALIVE_10US ((MXM_41B_REG_BIT_VALUE)0x01u) |
bit sequence for a keep alive period of 10µs
Definition at line 88 of file mxm_bitextract.h.
#define MXM_41B_REG_KEEP_ALIVE_1280US ((MXM_41B_REG_BIT_VALUE)0x08u) |
bit sequence for a keep alive period of 1280µs
Definition at line 102 of file mxm_bitextract.h.
#define MXM_41B_REG_KEEP_ALIVE_160US ((MXM_41B_REG_BIT_VALUE)0x05u) |
bit sequence for a keep alive period of 160µs
Definition at line 96 of file mxm_bitextract.h.
#define MXM_41B_REG_KEEP_ALIVE_20US ((MXM_41B_REG_BIT_VALUE)0x02u) |
bit sequence for a keep alive period of 20µs
Definition at line 90 of file mxm_bitextract.h.
#define MXM_41B_REG_KEEP_ALIVE_2560US ((MXM_41B_REG_BIT_VALUE)0x09u) |
bit sequence for a keep alive period of 2560µs
Definition at line 104 of file mxm_bitextract.h.
#define MXM_41B_REG_KEEP_ALIVE_320US ((MXM_41B_REG_BIT_VALUE)0x06u) |
bit sequence for a keep alive period of 320µs
Definition at line 98 of file mxm_bitextract.h.
#define MXM_41B_REG_KEEP_ALIVE_40US ((MXM_41B_REG_BIT_VALUE)0x03u) |
bit sequence for a keep alive period of 40µs
Definition at line 92 of file mxm_bitextract.h.
#define MXM_41B_REG_KEEP_ALIVE_5120US ((MXM_41B_REG_BIT_VALUE)0x0Au) |
bit sequence for a keep alive period of 5120µs
Definition at line 106 of file mxm_bitextract.h.
#define MXM_41B_REG_KEEP_ALIVE_640US ((MXM_41B_REG_BIT_VALUE)0x07u) |
bit sequence for a keep alive period of 640µs
Definition at line 100 of file mxm_bitextract.h.
#define MXM_41B_REG_KEEP_ALIVE_80US ((MXM_41B_REG_BIT_VALUE)0x04u) |
bit sequence for a keep alive period of 80µs
Definition at line 94 of file mxm_bitextract.h.
#define MXM_41B_REG_KEEP_ALIVE_INF_DLY ((MXM_41B_REG_BIT_VALUE)0x0Fu) |
bit sequence for a infinite keep alive period (disabled)
Definition at line 110 of file mxm_bitextract.h.
#define MXM_41B_REG_TRUE ((MXM_41B_REG_BIT_VALUE)0x01u) |
one bit, 1u
Definition at line 76 of file mxm_bitextract.h.
#define MXM_41B_RX_BUSY_STATUS ((MXM_41B_REG_BITS)5u) |
bit for the RX Busy Status
Definition at line 127 of file mxm_bitextract.h.
#define MXM_41B_RX_EMPTY_STATUS ((MXM_41B_REG_BITS)0u) |
bit for the RX Empty Status
Definition at line 135 of file mxm_bitextract.h.
#define MXM_41B_RX_ERROR ((MXM_41B_REG_BITS)7u) |
bit for the RX Error
Definition at line 125 of file mxm_bitextract.h.
#define MXM_41B_RX_OVERFLOW_INT_ENABLE ((MXM_41B_REG_BITS)3u) |
bit for the feature RX Overflow Interrupt
Definition at line 129 of file mxm_bitextract.h.
#define MXM_41B_RX_OVERFLOW_STATUS ((MXM_41B_REG_BITS)3u) |
bit for the RX Overflow Status
Definition at line 131 of file mxm_bitextract.h.
#define MXM_41B_RX_STOP_STATUS ((MXM_41B_REG_BITS)1u) |
bit for the RX Stop Status
Definition at line 133 of file mxm_bitextract.h.
#define MXM_41B_TX_PREAMBLES ((MXM_41B_REG_BITS)5u) |
bit for the feature TX Preambles
Definition at line 121 of file mxm_bitextract.h.
#define MXM_REG_MASK | ( | start, | |
end | |||
) | (((1u << ((end) - (start) + 1u)) - 1u) << (start)) |
define for creating a bitmask
Definition at line 116 of file mxm_bitextract.h.
typedef uint8_t MXM_41B_REG_BIT_VALUE |
Bit-values for registers.
Definition at line 72 of file mxm_bitextract.h.
typedef uint8_t MXM_41B_REG_BITS |
types for bits in the register of MAX17841B
Definition at line 119 of file mxm_bitextract.h.
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 108 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 116 of file mxm_bitextract.c.