board_common.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 Freie Universität Berlin, Hinnerk van Bruinehsen
3  * 2016 Laurent Navet <laurent.navet@gmail.com>
4  * 2017 Thomas Perrot <thomas.perrot@tupi.fr>
5  *
6  * This file is subject to the terms and conditions of the GNU Lesser
7  * General Public License v2.1. See the file LICENSE in the top level
8  * directory for more details.
9  */
10 
11 #pragma once
12 
27 #include "cpu.h"
28 #include "arduino_pinmap.h"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
41 #define STDIO_UART_BAUDRATE (9600U)
48 #ifdef CPU_ATMEGA328P
49 #define LED0_PIN GPIO_PIN(1, 5)
50 #define LED0_MASK (1 << DDB5)
51 #define LED0_ON (PORTB |= LED0_MASK)
52 #define LED0_OFF (PORTB &= ~LED0_MASK)
53 #define LED0_TOGGLE (PORTB ^= LED0_MASK)
54 #endif
55 
56 #ifdef CPU_ATMEGA32U4
57 #define LED0_PIN GPIO_PIN(2, 7)
58 #define LED0_MASK (1 << DDC7)
59 #define LED1_PIN GPIO_PIN(1, 0)
60 #define LED1_MASK (1 << DDB0)
61 #define LED2_PIN GPIO_PIN(3, 5)
62 #define LED2_MASK (1 << DDD5)
63 #endif
64 
65 #ifdef CPU_ATMEGA2560
66 #define LED0_PIN GPIO_PIN(1, 7)
67 #define LED0_MASK (1 << DDB7)
68 #define LED0_ON (PORTB |= LED0_MASK)
69 #define LED0_OFF (PORTB &= ~LED0_MASK)
70 #define LED0_TOGGLE (PORTB ^= LED0_MASK)
71 #endif
72 
73 #ifdef CPU_ATMEGA32U4
74 #define LED0_ON (PORTC |= LED0_MASK)
75 #define LED0_OFF (PORTC &= ~LED0_MASK)
76 #define LED0_TOGGLE (PORTC ^= LED0_MASK)
77 #define LED1_OFF (PORTB |= LED1_MASK)
78 #define LED1_ON (PORTB &= ~LED1_MASK)
79 #define LED1_TOGGLE (PORTB ^= LED1_MASK)
80 #define LED2_OFF (PORTD |= LED2_MASK)
81 #define LED2_ON (PORTD &= ~LED2_MASK)
82 #define LED2_TOGGLE (PORTD ^= LED2_MASK)
83 #endif
90 #define LED_PANIC LED0_ON
97 #define CPU_ATMEGA_CLK_SCALE_INIT CPU_ATMEGA_CLK_SCALE_DIV1
104 #define XTIMER_WIDTH (16)
105 #define XTIMER_HZ (250000UL)
106 #define XTIMER_BACKOFF (40)
113 #define CONFIG_ZTIMER_USEC_TYPE ZTIMER_TYPE_PERIPH_TIMER
114 #define CONFIG_ZTIMER_USEC_DEV (TIMER_DEV(0))
115 #define CONFIG_ZTIMER_USEC_FREQ (250000LU)
116 #define CONFIG_ZTIMER_USEC_WIDTH (16)
117 #ifndef CONFIG_ZTIMER_USEC_ADJUST_SET
118 #define CONFIG_ZTIMER_USEC_ADJUST_SET (128)
119 #endif
120 #ifndef CONFIG_ZTIMER_USEC_ADJUST_SLEEP
121 #define CONFIG_ZTIMER_USEC_ADJUST_SLEEP (116)
122 #endif
125 #ifdef __cplusplus
126 }
127 #endif
128 
Compatibility wrapper for arduino_iomap.h.