-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathi2c_slave_defs.h
43 lines (37 loc) · 1.37 KB
/
i2c_slave_defs.h
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
36
37
38
39
40
41
42
43
/*
* Copyright Brian Starkey 2014 <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef __I2C_SLAVE_DEFS__
#define __I2C_SLAVE_DEFS__
/* Set these appropriately for your platform */
#define USI_PORT PORTB
#define USI_DDR DDRB
#define I2C_SDA 0
#define I2C_SCL 2
/* Set these appropriately for your application */
#define I2C_N_REG 2
#define I2C_SLAVE_ADDR 0x40
/*
* The library supports a write mask for each individual register (bits set are
* writable) in the i2c_w_mask array. If you don't care about masks for each
* individual register, you can define a global value to be used for all
* registers here, saving flash and RAM
#define I2C_GLOBAL_WRITE_MASK 0xFF
*/
/* Define anything else your application wants to know */
#define REG_FOO i2c_reg[0]
#define REG_BAR i2c_reg[1]
#endif /* __I2C_SLAVE_DEFS__ */