px-fwlib 0.10.0
Cross-platform embedded library and documentation for 8/16/32-bit microcontrollers generated with Doxygen 1.9.2
px_i2c_cfg_template.h
1#ifndef __PX_I2C_CFG_H__
2#define __PX_I2C_CFG_H__
3/* =============================================================================
4 ____ ___ ____ ___ _ _ ___ __ __ ___ __ __ TM
5 | _ \ |_ _| / ___| / _ \ | \ | | / _ \ | \/ | |_ _| \ \/ /
6 | |_) | | | | | | | | | | \| | | | | | | |\/| | | | \ /
7 | __/ | | | |___ | |_| | | |\ | | |_| | | | | | | | / \
8 |_| |___| \____| \___/ |_| \_| \___/ |_| |_| |___| /_/\_\
9
10 Copyright (c) 2014 Pieter Conradie <https://piconomix.com>
11
12 License: MIT
13 https://github.com/piconomix/px-fwlib/blob/master/LICENSE.md
14
15 Title: px_i2c_cfg.h : I2C Peripheral Driver configuration
16 Author(s): Pieter Conradie
17 Creation Date: 2014-01-16
18
19============================================================================= */
20
21/**
22 * @addtogroup AVR_I2C
23 *
24 * @{
25 */
26
27/* _____STANDARD INCLUDES____________________________________________________ */
28
29/* _____PROJECT INCLUDES_____________________________________________________ */
30#include "px_defs.h"
31#include "px_gpio.h"
32#include "px_board.h"
33
34/* _____DEFINITIONS__________________________________________________________ */
35/// Enable/disable support for I2C0 peripheral
36#define PX_I2C_CFG_I2C0_EN 1
37
38/// I2C Bit rate in Hz
39#define PX_I2C_CFG_BIT_RATE_HZ 100000ul
40
41/// [px_i2c_twi.c] TWI clock prescaler (sized according to desired TWI and microcontroller clock)
42#define PX_I2C_CFG_TWI_PRESCALER_VAL 1
43
44/// @name I2C Clock GPIO pin manipulation macros
45/// @{
46#define PX_I2C_CFG_SCL_SET_HIZ() PX_GPIO_DIR_SET_IN(PX_GPIO_I2C_SCL)
47#define PX_I2C_CFG_SCL_SET_LO() PX_GPIO_DIR_SET_OUT(PX_GPIO_I2C_SCL)
48#define PX_I2C_CFG_SCL_IS_HI() PX_GPIO_IN_IS_HI(PX_GPIO_I2C_SCL)
49#define PX_I2C_CFG_SCL_IS_LO() PX_GPIO_IN_IS_LO(PX_GPIO_I2C_SCL)
50/// @}
51
52/// @name I2C Data GPIO pin manipulation macros
53/// @{
54#define PX_I2C_CFG_SDA_SET_HIZ() PX_GPIO_DIR_SET_IN(PX_GPIO_I2C_SDA)
55#define PX_I2C_CFG_SDA_SET_LO() PX_GPIO_DIR_SET_OUT(PX_GPIO_I2C_SDA)
56#define PX_I2C_CFG_SDA_IS_HI() PX_GPIO_IN_IS_HI(PX_GPIO_I2C_SDA)
57#define PX_I2C_CFG_SDA_IS_LO() PX_GPIO_IN_IS_LO(PX_GPIO_I2C_SDA)
58/// @}
59
60/// @}
61#endif