-
Notifications
You must be signed in to change notification settings - Fork 18
/
TwiMap.h
69 lines (58 loc) · 2.7 KB
/
TwiMap.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/* Arduino I2cMaster Library
Copyright (C) 2010 by William Greiman
This file is part of the Arduino I2cMaster Library
This Library is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This Library 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 the Arduino I2cMaster Library. If not, see
<http://www.gnu.org/licenses/>.
*/
/**
\file
\brief I2C pin definitions
*/
#ifndef TwiMap_h
#define TwiMap_h
#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__)
// 168 and 328 Arduinos
uint8_t const TWI_SDA_PIN = 18;
uint8_t const TWI_SCL_PIN = 19;
//------------------------------------------------------------------------------
#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
// Mega 1280 and 2560
uint8_t const TWI_SDA_PIN = 20;
uint8_t const TWI_SCL_PIN = 21;
//------------------------------------------------------------------------------
#elif defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644__)
// Sanguino
uint8_t const TWI_SDA_PIN = 17;
uint8_t const TWI_SCL_PIN = 18;
//------------------------------------------------------------------------------
#elif defined(__AVR_ATmega32U4__)
// Teensy 2.0
uint8_t const TWI_SDA_PIN = 6;
uint8_t const TWI_SCL_PIN = 5;
//------------------------------------------------------------------------------
#elif defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)
// Teensy++ 1.0 & 2.0
uint8_t const TWI_SDA_PIN = 1;
uint8_t const TWI_SCL_PIN = 0;
//------------------------------------------------------------------------------
#elif defined(ARDUINO_ARCH_ESP8266)
// NodeMCU 1.0
uint8_t const TWI_SDA_PIN = SDA; // D3, GPIO0
uint8_t const TWI_SCL_PIN = SCL; // D4, GPIO2
//------------------------------------------------------------------------------
#elif defined(SEEED_XIAO_M0) ||defined(ARDUINO_XIAO_RA4M1) || defined(NRF52840_XXAA) || defined(ARDUINO_ARCH_RP2040) || defined(ARDUINO_ARCH_RP2350) || defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32C6)
uint8_t const TWI_SDA_PIN = D4; // D3, GPIO0
uint8_t const TWI_SCL_PIN = D5; // D4, GPIO2
#else // AVR CPU
// #error unknown CPU
#endif // AVR CPU
#endif // TwiMap_h