forked from RIOT-OS/RIOT
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathperiph_cpu.h
More file actions
113 lines (97 loc) · 2.76 KB
/
periph_cpu.h
File metadata and controls
113 lines (97 loc) · 2.76 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/*
* Copyright (C) 2015 HAW Hamburg
* 2016 Freie Universität Berlin
* 2016 INRIA
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
#pragma once
/**
* @ingroup cpu_atmega1281
* @{
*
* @file
* @brief CPU specific definitions for internal peripheral handling
*
* @author René Herthel <[email protected]>
* @author Hauke Petersen <[email protected]>
* @author Francisco Acosta <[email protected]>
*/
#ifdef __cplusplus
extern "C" {
#endif
#include "periph_cpu_common.h"
/**
* @name Power management configuration
* @{
*/
#define PM_NUM_MODES (5)
#define AVR8_PM_SLEEP_MODE_0 SLEEP_MODE_PWR_DOWN /**< Power Down */
#define AVR8_PM_SLEEP_MODE_1 SLEEP_MODE_PWR_SAVE /**< Power Save */
#define AVR8_PM_SLEEP_MODE_2 SLEEP_MODE_STANDBY /**< Standby */
#define AVR8_PM_SLEEP_MODE_3 SLEEP_MODE_ADC /**< Sleep ADC low noise */
/** @} */
/**
* @brief Available ports on the ATmega1281 family
*/
enum {
PORT_A = 0, /**< port A */
PORT_B = 1, /**< port B */
PORT_C = 2, /**< port C */
PORT_D = 3, /**< port D */
PORT_E = 4, /**< port E */
PORT_F = 5, /**< port F */
PORT_G = 6, /**< port G */
};
/**
* @brief Available external interrupt pins on the ATmega1281 family
*
* In order of their interrupt number.
*/
#define CPU_ATMEGA_EXT_INTS { GPIO_PIN(PORT_D, 0), \
GPIO_PIN(PORT_D, 1), \
GPIO_PIN(PORT_D, 2), \
GPIO_PIN(PORT_D, 3), \
GPIO_PIN(PORT_E, 4), \
GPIO_PIN(PORT_E, 5), \
GPIO_PIN(PORT_E, 6), \
GPIO_PIN(PORT_E, 7) }
/**
* @brief Get the interrupt vector number of the given GPIO pin
*/
static inline uint8_t atmega_pin2exti(uint8_t port_num, uint8_t pin_num)
{
(void)port_num;
return pin_num;
}
/**
* @brief Check if the given pin can be used as external interrupt
*/
static inline bool atmega_has_pin_exti(uint8_t port_num, uint8_t pin_num)
{
if (pin_num < 4) {
return port_num == PORT_D;
}
return port_num == PORT_E;
}
/**
* @name Defines for the I2C interface
* @{
*/
#define I2C_PORT_REG PORTD
#define I2C_PIN_MASK (1 << PORTD0) | (1 << PORTD1)
/** @} */
/**
* @name EEPROM configuration
* @{
*/
#define EEPROM_SIZE (4096U) /* 4kB */
/** @} */
#ifdef __cplusplus
}
#endif
#include "periph_conf.h"
#include "default_timer_config.h"
/** @} */