foxBMS-UnitTests
1.0.0
The foxBMS Unit Tests API Documentation
|
Bit extraction function for MXM_17841b. More...
#include "general.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.
BSD 3-Clause License 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 product uses parts of foxBMS®″
″This product includes parts of foxBMS®″
″This product is derived from foxBMS®″
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 119 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 79 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 81 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 75 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 77 of file mxm_bitextract.h.
#define MXM_41B_REG_FALSE ((MXM_41B_REG_BIT_VALUE)0x00u) |
one bit, 0u
Definition at line 71 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 83 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 105 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 85 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 99 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 93 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 87 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 101 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 95 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 89 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 103 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 97 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 91 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 107 of file mxm_bitextract.h.
#define MXM_41B_REG_TRUE ((MXM_41B_REG_BIT_VALUE)0x01u) |
one bit, 1u
Definition at line 73 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 123 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 129 of file mxm_bitextract.h.
#define MXM_41B_RX_ERROR ((MXM_41B_REG_BITS)7u) |
bit for the RX Error
Definition at line 121 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 125 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 127 of file mxm_bitextract.h.
#define MXM_41B_TX_PREAMBLES ((MXM_41B_REG_BITS)5u) |
bit for the feature TX Preambles
Definition at line 117 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 112 of file mxm_bitextract.h.
typedef uint8_t MXM_41B_REG_BIT_VALUE |
Bit-values for registers.
Definition at line 69 of file mxm_bitextract.h.
typedef uint8_t MXM_41B_REG_BITS |
types for bits in the register of MAX17841B
Definition at line 115 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 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.