mulle/include/board.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 Eistec AB
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser General
5  * Public License v2.1. See the file LICENSE in the top level directory for more
6  * details.
7  */
8 
21 #ifndef BOARD_H
22 #define BOARD_H
23 
24 #include "cpu.h"
25 #include "periph_conf.h"
26 #include "mulle-nvram.h"
27 #include "mtd.h"
28 
29 /* Use the on board RTC 32kHz clock for LPTMR clocking. */
30 #undef LPTIMER_CLKSRC
31 
32 #define LPTIMER_CLKSRC LPTIMER_CLKSRC_ERCLK32K
33 
35 #define DISABLE_WDOG 1
36 
40 #define UART_STDIO_DEV UART_DEV(1)
41 
46 #if 0
47 /* LPTMR xtimer configuration */
48 /* WIP, Use PIT for now */
49 #define XTIMER_DEV (TIMER_LPTMR_DEV(0))
50 #define XTIMER_CHAN (0)
51 /* LPTMR is 16 bits wide */
52 #define XTIMER_WIDTH (16)
53 #define XTIMER_BACKOFF (4)
54 #define XTIMER_ISR_BACKOFF (4)
55 #define XTIMER_OVERHEAD (3)
56 #define XTIMER_HZ (32768ul)
57 #define XTIMER_SHIFT (0)
58 #else
59 /* PIT xtimer configuration */
60 #define XTIMER_DEV (TIMER_PIT_DEV(0))
61 #define XTIMER_CHAN (0)
62 #define XTIMER_WIDTH (32)
63 #define XTIMER_BACKOFF (40)
64 #define XTIMER_ISR_BACKOFF (40)
65 #define XTIMER_OVERHEAD (30)
66 #define XTIMER_HZ (1000000ul)
67 #define XTIMER_SHIFT (0)
68 #endif
69 
75 #define LED_PORT PTC
76 #define LED0_BIT (15)
77 #define LED1_BIT (14)
78 #define LED2_BIT (13)
79 
80 #define LED0_PIN GPIO_PIN(PORT_C, LED0_BIT)
81 #define LED1_PIN GPIO_PIN(PORT_C, LED1_BIT)
82 #define LED2_PIN GPIO_PIN(PORT_C, LED2_BIT)
83 
84 #define LED0_ON (LED_PORT->PSOR = (1 << LED0_BIT))
85 #define LED0_OFF (LED_PORT->PCOR = (1 << LED0_BIT))
86 #define LED0_TOGGLE (LED_PORT->PTOR = (1 << LED0_BIT))
87 
88 #define LED1_ON (LED_PORT->PSOR = (1 << LED1_BIT))
89 #define LED1_OFF (LED_PORT->PCOR = (1 << LED1_BIT))
90 #define LED1_TOGGLE (LED_PORT->PTOR = (1 << LED1_BIT))
91 
92 #define LED2_ON (LED_PORT->PSOR = (1 << LED2_BIT))
93 #define LED2_OFF (LED_PORT->PCOR = (1 << LED2_BIT))
94 #define LED2_TOGGLE (LED_PORT->PTOR = (1 << LED2_BIT))
95 
97 #ifdef __cplusplus
98 extern "C" {
99 #endif
100 
104 void board_init(void);
105 
106 #ifdef __cplusplus
107 }
108 #endif
109 
117 #define AT86RF2XX_PARAMS_BOARD {.spi = SPI_DEV(0), \
118  .spi_clk = SPI_CLK_5MHZ, \
119  .cs_pin = SPI_HWCS(1), \
120  .int_pin = GPIO_PIN(PORT_B, 9), \
121  .sleep_pin = GPIO_PIN(PORT_E, 6), \
122  .reset_pin = GPIO_PIN(PORT_C, 12)}
123 
124 
129 #define LIS3DH_INT1 GPIO_PIN(PORT_C, 18)
130 #define LIS3DH_INT2 GPIO_PIN(PORT_C, 17)
131 #define LIS3DH_CS GPIO_PIN(PORT_D, 0)
132 #define LIS3DH_CLK SPI_CLK_5MHZ
133 #define LIS3DH_SPI SPI_DEV(0)
134 
140 #define MULLE_POWER_AVDD GPIO_PIN(PORT_B, 17)
141 #define MULLE_POWER_VPERIPH GPIO_PIN(PORT_D, 7)
142 #define MULLE_POWER_VSEC GPIO_PIN(PORT_B, 16)
149 #define MULLE_NVRAM_SPI_DEV SPI_DEV(0)
150 #define MULLE_NVRAM_SPI_CLK SPI_CLK_5MHZ
151 #define MULLE_NVRAM_SPI_CS SPI_HWCS(3)
152 #define MULLE_NVRAM_CAPACITY 512
153 #define MULLE_NVRAM_SPI_ADDRESS_COUNT 1
160 #define MULLE_NOR_SPI_DEV SPI_DEV(0)
161 #define MULLE_NOR_SPI_CLK SPI_CLK_5MHZ
162 #define MULLE_NOR_SPI_CS SPI_HWCS(2)
168 extern mtd_dev_t *mtd0;
169 #define MTD_0 mtd0
170 
176 #define MULLE_VBAT_ADC_LINE ADC_LINE(6)
177 #define MULLE_VCHR_ADC_LINE ADC_LINE(7)
178 
187 #define CONFIG_CLOCK_K60_SYS_DIV 0x00
188 
192 #define CONFIG_CLOCK_K60_BUS_DIV 0x01
193 
197 #define CONFIG_CLOCK_K60_FB_DIV 0x01
198 
202 #define CONFIG_CLOCK_K60_FLASH_DIV 0x03
203 
206 #endif /* BOARD_H */
207 
NVRAM offsets for the Eistec Mulle IoT board.
void board_init(void)
Initialize board specific hardware, including clock, LEDs and std-IO.