periph_cpu.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 HAW Hamburg
3  * 2016 Freie Universität Berlin
4  *
5  * This file is subject to the terms and conditions of the GNU Lesser
6  * General Public License v2.1. See the file LICENSE in the top level
7  * directory for more details.
8  */
9 
10 #pragma once
11 
23 #include "periph_cpu_common.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
33 #define PM_NUM_MODES (5)
34 #define AVR8_PM_SLEEP_MODE_0 SLEEP_MODE_PWR_DOWN
35 #define AVR8_PM_SLEEP_MODE_1 SLEEP_MODE_PWR_SAVE
36 #define AVR8_PM_SLEEP_MODE_2 SLEEP_MODE_STANDBY
37 #define AVR8_PM_SLEEP_MODE_3 SLEEP_MODE_ADC
43 #define GPIO_PIN(x, y) ((x << 4) | y)
44 
48 enum {
49  PORT_B = 1,
50  PORT_C = 2,
51  PORT_D = 3
52 };
53 
59 #define CPU_ATMEGA_EXT_INTS { GPIO_PIN(PORT_D, 2), \
60  GPIO_PIN(PORT_D, 3) }
61 
65 static inline uint8_t atmega_pin2exti(uint8_t port_num, uint8_t pin_num)
66 {
67  (void)port_num;
68  return pin_num - 2;
69 }
70 
74 static inline bool atmega_has_pin_exti(uint8_t port_num, uint8_t pin_num)
75 {
76  if (port_num == PORT_D) {
77  return ((pin_num == 2) || (pin_num == 3));
78  }
79 
80  return false;
81 }
82 
87 #define I2C_PORT_REG PORTC
88 #define I2C_PIN_MASK (1 << PORTC4) | (1 << PORTC5)
95 #define EEPROM_SIZE (1024U) /* 1kB */
98 #ifdef __cplusplus
99 }
100 #endif
101 
102 #include "periph_conf.h"
103 #include "default_timer_config.h"
104 
@ PORT_B
port B
Definition: periph_cpu.h:47
@ PORT_C
port C
Definition: periph_cpu.h:48
@ 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:74
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:65
Default timer configuration.