Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
aee3df570This file is pinned to the selected release. Download the original to open it in your design tool.
#ifndef BIT_UTILS_H
#define BIT_UTILS_H
#include "State.h"
#include <Arduino.h>
class BitUtils {
public:
static bool isBitSet(int page, int row, int col) {
int index = page * rows * cols + row * cols + col;
int byteIndex = index / 8;
int bitIndex = index % 8;
return (seqMatrix[byteIndex] >> bitIndex) & 0x01;
}
static void setBit(int page, int row, int col) {
int index = page * rows * cols + row * cols + col;
int byteIndex = index / 8;
int bitIndex = index % 8;
seqMatrix[byteIndex] |= (1 << bitIndex);
}
static void clearBit(int page, int row, int col) {
int index = page * rows * cols + row * cols + col;
int byteIndex = index / 8;
int bitIndex = index % 8;
seqMatrix[byteIndex] &= ~(1 << bitIndex);
}
};
#endif