YAHAL
Yet Another Hardware Abstraction Library
Loading...
Searching...
No Matches
src
MCU
rp2350
i2c_rp2350.h
1
// ---------------------------------------------
2
// This file is part of
3
// _ _ __ _ _ __ __
4
// ( \/ ) /__\ ( )_( ) /__\ ( )
5
// \ / /(__)\ ) _ ( /(__)\ )(__
6
// (__)(__)(__)(_) (_)(__)(__)(____)
7
//
8
// Yet Another HW Abstraction Library
9
// Copyright (C) Andreas Terstegge
10
// BSD Licensed (see file LICENSE)
11
//
12
// ---------------------------------------------
13
//
14
// I2C driver for RP2040. It support master
15
// and client mode. Interrupts are supported
16
// for client mode (RX interrupts).
17
//
18
#ifndef _I2C_RP2350_H_
19
#define _I2C_RP2350_H_
20
21
#include "i2c_interface.h"
22
#include "gpio_rp2350.h"
23
24
#include "RP2350.h"
25
using namespace
_I2C0_;
26
27
class
i2c_rp2350
:
public
i2c_interface
{
28
29
public
:
30
31
i2c_rp2350
(gpio_pin_t sda_pin,
32
gpio_pin_t scl_pin,
33
uint16_t mode);
34
35
~i2c_rp2350
()
override
;
36
37
int16_t i2cRead (uint16_t addr, uint8_t *rxbuf,
38
uint16_t len,
bool
sendStop)
override
;
39
int16_t i2cWrite(uint16_t addr, uint8_t *txbuf,
40
uint16_t len,
bool
sendStop)
override
;
41
42
void
setSpeed(uint32_t)
override
;
43
44
private
:
45
bool
_initialized;
46
void
initialize();
47
48
int
_index;
49
gpio_rp2350
_sda;
50
gpio_rp2350
_scl;
51
52
// bool _master;
53
uint16_t _mode;
54
bool
_restart_on_next;
55
56
I2C0_t
* _i2c;
57
I2C0_t
* _i2c_set;
58
I2C0_t
* _i2c_clr;
59
};
60
61
#endif
// _I2C_RP2350_H_
gpio_rp2350
Definition
gpio_rp2350.h:36
i2c_interface
Definition
i2c_interface.h:22
i2c_rp2350
Definition
i2c_rp2350.h:27
_I2C0_::I2C0_t
Definition
RP2350_regs.h:13873
Generated by
1.12.0