periph_cpu.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Thomas Perrot <thomas.perrot@tupi.fr>
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
9 #pragma once
10 
22 #include "periph_cpu_common.h"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
32 #define PM_NUM_MODES (5)
33 #define AVR8_PM_SLEEP_MODE_0 SLEEP_MODE_PWR_DOWN
34 #define AVR8_PM_SLEEP_MODE_1 SLEEP_MODE_PWR_SAVE
35 #define AVR8_PM_SLEEP_MODE_2 SLEEP_MODE_STANDBY
36 #define AVR8_PM_SLEEP_MODE_3 SLEEP_MODE_ADC
42 enum {
43  PORT_B = 1,
44  PORT_C = 2,
45  PORT_D = 3,
46  PORT_E = 4,
47  PORT_F = 5
48 };
49 
55 #define CPU_ATMEGA_EXT_INTS { GPIO_PIN(PORT_D, 0), \
56  GPIO_PIN(PORT_D, 1), \
57  GPIO_PIN(PORT_D, 2), \
58  GPIO_PIN(PORT_D, 3) }
59 
63 static inline uint8_t atmega_pin2exti(uint8_t port_num, uint8_t pin_num)
64 {
65  (void)port_num;
66  return pin_num;
67 }
68 
72 static inline bool atmega_has_pin_exti(uint8_t port_num, uint8_t pin_num)
73 {
74  return ((pin_num < 4) && (port_num == PORT_D));
75 }
76 
81 #define I2C_PORT_REG PORTD
82 #define I2C_PIN_MASK (1 << PORTD0) | (1 << PORTD1)
89 #define EEPROM_SIZE (1024U) /* 1kB */
92 #ifdef __cplusplus
93 }
94 #endif
95 
96 #include "periph_conf.h"
97 #include "default_timer_config.h"
98 
@ PORT_B
port B
Definition: periph_cpu.h:47
@ PORT_C
port C
Definition: periph_cpu.h:48
@ PORT_F
port F
Definition: periph_cpu.h:51
@ PORT_E
port E
Definition: periph_cpu.h:50
@ PORT_D
port D
Definition: periph_cpu.h:49
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:72
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:63
Default timer configuration.