Skip to content

Instantly share code, notes, and snippets.

@dragonlock2
dragonlock2 / EEPROM.cpp
Created January 8, 2021 01:19
Code to interact with BRCF016GWZ
#include "EEPROM.h"
extern I2C i2c;
namespace EEPROM {
void resetEEPROM() {
char buff[MAX_BLOCK_WRITE];
for (uint16_t i = 0; i < MAX_BLOCK_WRITE; i++) {
buff[i] = 0xFF;
@dragonlock2
dragonlock2 / WLPROM.cpp
Last active January 8, 2021 01:20
Simple EEPROM wear leveling algorithm
#include "WLPROM.h"
namespace WLPROM {
void read(WLData* dat) {
EEPROM::readBites(findData(), (char*) dat, sizeof(WLData));
}
void write(WLData* dat) {
uint16_t next_addr = findData() + sizeof(WLData);
@dragonlock2
dragonlock2 / BSWelder.ino
Created January 16, 2020 22:52
Code for my battery spot welder.
#include <Encoder.h>
#include <EEPROM.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels