FastArduino v1.10
C++ library to build fast but small Arduino/AVR projects
Loading...
Searching...
No Matches
i2c_handler.h
Go to the documentation of this file.
1// Copyright 2016-2023 Jean-Francois Poilpret
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
16
22#ifndef I2C_HANDLER_HH
23#define I2C_HANDLER_HH
24
25// Thsi ehader is included only to get all registers (TWCR in particular) defined for the current target
26#include <fastarduino/boards/board.h>
27
28#ifdef TWCR
29#include "i2c_handler_atmega.h"
30#else
31#include "i2c_handler_attiny.h"
32#endif
33
51#define MANAGER_FUTURE(M) typename M::ABSTRACT_FUTURE
52
165namespace i2c
166{
168 // Specific traits for I2C Async Managers (both ATmega and ATtiny)
169 template<I2CMode MODE_>
170 struct I2CManager_trait<I2CSyncManager<MODE_>>
171 : I2CManager_trait_impl<false, false, false, MODE_> {};
172
173 template<I2CMode MODE_, typename STATUS_HOOK_>
174 struct I2CManager_trait<I2CSyncStatusManager<MODE_, STATUS_HOOK_>>
175 : I2CManager_trait_impl<false, true, false, MODE_> {};
176
177 template<I2CMode MODE_, typename DEBUG_HOOK_>
178 struct I2CManager_trait<I2CSyncDebugManager<MODE_, DEBUG_HOOK_>>
179 : I2CManager_trait_impl<false, false, true, MODE_> {};
180
181 template<I2CMode MODE_, typename STATUS_HOOK_, typename DEBUG_HOOK_>
182 struct I2CManager_trait<I2CSyncStatusDebugManager<MODE_, STATUS_HOOK_, DEBUG_HOOK_>>
183 : I2CManager_trait_impl<false, true, true, MODE_> {};
185}
186
187#endif /* I2C_HANDLER_HH */
188
ATmega I2C Manager API.
ATtiny I2C Manager API.
Define API to define and manage I2C devices.
Definition: i2c.h:51