periph_cpu.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2015 HAW Hamburg
3  * SPDX-FileCopyrightText: 2016 Freie Universität Berlin
4  * SPDX-License-Identifier: LGPL-2.1-only
5  */
6 
7 #pragma once
8 
20 #include "periph_cpu_common.h"
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
30 #define PM_NUM_MODES (5)
31 #define AVR8_PM_SLEEP_MODE_0 SLEEP_MODE_PWR_DOWN
32 #define AVR8_PM_SLEEP_MODE_1 SLEEP_MODE_PWR_SAVE
33 #define AVR8_PM_SLEEP_MODE_2 SLEEP_MODE_STANDBY
34 #define AVR8_PM_SLEEP_MODE_3 SLEEP_MODE_ADC
40 enum {
41  PORT_A = 0,
42  PORT_B = 1,
43  PORT_C = 2,
44  PORT_D = 3,
45  PORT_E = 4,
46  PORT_F = 5,
47  PORT_G = 6,
48  PORT_H = 7,
49  PORT_J = 8,
50  PORT_K = 9,
51  PORT_L = 10
52 };
53 
59 #define CPU_ATMEGA_EXT_INTS { GPIO_PIN(PORT_D, 0), \
60  GPIO_PIN(PORT_D, 1), \
61  GPIO_PIN(PORT_D, 2), \
62  GPIO_PIN(PORT_D, 3), \
63  GPIO_PIN(PORT_E, 4), \
64  GPIO_PIN(PORT_E, 5), \
65  GPIO_PIN(PORT_E, 6), \
66  GPIO_PIN(PORT_E, 7) }
67 
71 static inline uint8_t atmega_pin2exti(uint8_t port_num, uint8_t pin_num)
72 {
73  (void)port_num;
74  return pin_num;
75 }
76 
80 static inline bool atmega_has_pin_exti(uint8_t port_num, uint8_t pin_num)
81 {
82  if (pin_num < 4) {
83  return port_num == PORT_D;
84  }
85 
86  return port_num == PORT_E;
87 }
88 
93 #define I2C_PORT_REG PORTD
94 #define I2C_PIN_MASK (1 << PORTD0) | (1 << PORTD1)
101 #define EEPROM_SIZE (4096U) /* 4kB */
104 #ifdef __cplusplus
105 }
106 #endif
107 
108 #include "periph_conf.h"
109 #include "default_timer_config.h"
110 
@ PORT_B
port B
Definition: periph_cpu.h:44
@ PORT_G
port G
Definition: periph_cpu.h:49
@ PORT_C
port C
Definition: periph_cpu.h:45
@ PORT_F
port F
Definition: periph_cpu.h:48
@ PORT_E
port E
Definition: periph_cpu.h:47
@ PORT_A
port A
Definition: periph_cpu.h:43
@ PORT_D
port D
Definition: periph_cpu.h:46
static bool atmega_has_pin_exti(uint8_t port_num, uint8_t pin_num)
Check if the given pin can be used as external interrupt.
Definition: periph_cpu.h:80
@ PORT_K
port K
Definition: periph_cpu.h:50
@ PORT_H
port H
Definition: periph_cpu.h:48
@ PORT_J
port J
Definition: periph_cpu.h:49
@ PORT_L
port L
Definition: periph_cpu.h:51
static uint8_t atmega_pin2exti(uint8_t port_num, uint8_t pin_num)
Get the interrupt vector number of the given GPIO pin.
Definition: periph_cpu.h:71
Default timer configuration.