/** * * Author: Dylan Muller * Copyright (c) 2025 * All rights reserved. * * - Commercial/IP use prohibited. * - Attribution required. * See License.txt * */ #include "setup.h" #include "peripheral/twi.h" #include #include #include #include #define TWBR_VALUE ((F_CPU/TWI_FREQUENCY - 16) / (2 * TWI_PRESCALER)) static uint8_t twi_address; static uint8_t* twi_data; static size_t twi_index; static size_t twi_len; void twi_init(void) { TWBR = TWBR_VALUE; TWSR = (TWPS1_VALUE << TWPS1) | (TWPS0_VALUE << TWPS0); TWCR = (1 << TWINT) | (1 << TWEN); } bool twi_busy(void) { return TWCR & (1<