A class for arrays of bits.  
 More...
#include <BitArray.hpp>
 | 
| bool  | get (uint8_t bitIndex) | 
|   | Get the value of the given bit.  More...
  | 
|   | 
| void  | set (uint8_t bitIndex) | 
|   | Set the value of the given bit to 1.  More...
  | 
|   | 
| void  | clear (uint8_t bitIndex) | 
|   | Clear the value of the given bit to 0.  More...
  | 
|   | 
| void  | set (uint8_t bitIndex, bool state) | 
|   | Set the value of the given bit to the given state.  More...
  | 
|   | 
| uint8_t  | safeIndex (uint8_t byteIndex) const | 
|   | Check the given byte index, and return it if it is within the bounds of the array, otherwise, throw an error, and return the last valid index.  More...
  | 
|   | 
| uint8_t  | getByte (uint8_t byteIndex) const | 
|   | Get the byte at the given index.  More...
  | 
|   | 
| uint8_t  | getBufferLength () const | 
|   | Get the buffer length in bytes.  More...
  | 
|   | 
 | 
| constexpr static uint8_t  | bufferLength = (uint8_t)((N + 7) / 8) | 
|   | 
template<uint8_t N>
class AH::BitArray< N >
A class for arrays of bits. 
- Template Parameters
 - 
  
  
 
Definition at line 25 of file BitArray.hpp.
 
◆ get()
Get the value of the given bit. 
- Parameters
 - 
  
    | bitIndex | The (zero-based) index of the bit to read.  | 
  
   
Definition at line 33 of file BitArray.hpp.
 
 
◆ set() [1/2]
Set the value of the given bit to 1. 
- Parameters
 - 
  
    | bitIndex | The (zero-based) index of the bit to set.  | 
  
   
Definition at line 43 of file BitArray.hpp.
 
 
◆ clear()
Clear the value of the given bit to 0. 
- Parameters
 - 
  
    | bitIndex | The (zero-based) index of the bit to clear.  | 
  
   
Definition at line 53 of file BitArray.hpp.
 
 
◆ set() [2/2]
template<uint8_t N> 
  
  
      
        
          | void AH::BitArray< N >::set  | 
          ( | 
          uint8_t  | 
          bitIndex,  | 
         
        
           | 
           | 
          bool  | 
          state  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
inline   | 
  
 
Set the value of the given bit to the given state. 
- Parameters
 - 
  
    | bitIndex | The (zero-based) index of the bit to set.  | 
    | state | The value to set the bit to.  | 
  
   
Definition at line 65 of file BitArray.hpp.
 
 
◆ safeIndex()
template<uint8_t N> 
  
  
      
        
          | uint8_t AH::BitArray< N >::safeIndex  | 
          ( | 
          uint8_t  | 
          byteIndex | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Check the given byte index, and return it if it is within the bounds of the array, otherwise, throw an error, and return the last valid index. 
- Parameters
 - 
  
    | byteIndex | The index to check.  | 
  
   
Definition at line 77 of file BitArray.hpp.
 
 
◆ getByte()
template<uint8_t N> 
  
  
      
        
          | uint8_t AH::BitArray< N >::getByte  | 
          ( | 
          uint8_t  | 
          byteIndex | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Get the byte at the given index. 
This function can be used to quickly access all of the bits, to send them out to a shift register, for example.
- Note
 - No bounds checking is performed.
 
- Parameters
 - 
  
    | byteIndex | The index of the byte within the array.  | 
  
   
Definition at line 99 of file BitArray.hpp.
 
 
◆ getBufferLength()
Get the buffer length in bytes. 
Definition at line 107 of file BitArray.hpp.
 
 
◆ getBufferIndex()
template<uint8_t N> 
  
  
      
        
          | uint8_t AH::BitArray< N >::getBufferIndex  | 
          ( | 
          uint8_t  | 
          bitIndex | ) | 
           const | 
         
       
   | 
  
inlineprivate   | 
  
 
 
◆ getBufferBit()
template<uint8_t N> 
  
  
      
        
          | uint8_t AH::BitArray< N >::getBufferBit  | 
          ( | 
          uint8_t  | 
          bitIndex | ) | 
           const | 
         
       
   | 
  
inlineprivate   | 
  
 
 
◆ getBufferMask()
template<uint8_t N> 
  
  
      
        
          | uint8_t AH::BitArray< N >::getBufferMask  | 
          ( | 
          uint8_t  | 
          bitIndex | ) | 
           const | 
         
       
   | 
  
inlineprivate   | 
  
 
 
◆ bufferLength
template<uint8_t N> 
  
  
      
        
          | constexpr static uint8_t AH::BitArray< N >::bufferLength = (uint8_t)((N + 7) / 8) | 
         
       
   | 
  
staticconstexprprivate   | 
  
 
 
◆ buffer
The documentation for this class was generated from the following file: