summaryrefslogtreecommitdiff
path: root/firmware/inc/peripheral/twi.h
blob: 8f08777f8c93941746f6c09e579b0ff7d91cb522 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/**
 * 
 * Author: Dylan Muller
 * Copyright (c) 2025 
 * All rights reserved.
 * 
 * - Commercial/IP use prohibited.
 * - Attribution required.
 * See License.txt
 *
 */

#ifndef TWI_H_
#define TWI_H_

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>

#define TWI_ADDRESS_W(x)    (((x) << 1) & ~0x01)
#define TWI_ADDRESS_R(x)    (((x) << 1) | 0x01)

void twi_init(void);

bool twi_busy(void);

void twi_flush(void);

void twi_start(
    uint8_t address,
    uint8_t *data,
    size_t len
);

#endif