board.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017-2020 Bas Stottelaar <basstottelaar@gmail.com>
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 
19 #ifndef BOARD_H
20 #define BOARD_H
21 
22 #include "cpu.h"
23 #include "periph_conf.h"
24 #include "periph/adc.h"
25 #include "periph/gpio.h"
26 #include "periph/spi.h"
27 
28 #include "mtd.h"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
41 #if IS_ACTIVE(CONFIG_EFM32_XTIMER_USE_LETIMER)
42 #define XTIMER_DEV (TIMER_DEV(1))
43 #define XTIMER_HZ (32768UL)
44 #define XTIMER_WIDTH (16)
45 #else
46 #define XTIMER_DEV (TIMER_DEV(0))
47 #define XTIMER_HZ (250000UL)
48 #define XTIMER_WIDTH (16)
49 #endif
50 #define XTIMER_CHAN (0)
51 
57 #define LED0_PIN GPIO_PIN(PA, 1)
58 #define LED1_PIN GPIO_PIN(PB, 13)
59 
65 #define LED0_ON gpio_set(LED0_PIN)
66 #define LED0_OFF gpio_clear(LED0_PIN)
67 #define LED0_TOGGLE gpio_toggle(LED0_PIN)
68 #define LED1_ON gpio_set(LED1_PIN)
69 #define LED1_OFF gpio_clear(LED1_PIN)
70 #define LED1_TOGGLE gpio_toggle(LED1_PIN)
71 
79 #define CORETEMP_ADC ADC_LINE(0)
80 
88 #define IKEA_TRADFRI_NOR_PAGE_SIZE (256)
89 #define IKEA_TRADFRI_NOR_PAGES_PER_SECTOR (16)
90 #define IKEA_TRADFRI_NOR_SECTOR_COUNT (64)
91 #define IKEA_TRADFRI_NOR_FLAGS (SPI_NOR_F_SECT_4K | SPI_NOR_F_SECT_32K)
92 #define IKEA_TRADFRI_NOR_SPI_DEV SPI_DEV(0)
93 #define IKEA_TRADFRI_NOR_SPI_CLK SPI_CLK_1MHZ
94 #define IKEA_TRADFRI_NOR_SPI_CS GPIO_PIN(PB, 11)
95 #define IKEA_TRADFRI_NOR_SPI_MODE SPI_MODE_0
96 #define IKEA_TRADFRI_NOR_EN GPIO_PIN(PF, 3)
103 extern mtd_dev_t *mtd0;
104 #define MTD_0 mtd0
105 
110 void board_init(void);
111 
112 #ifdef __cplusplus
113 }
114 #endif
115 
116 #endif /* BOARD_H */
117 
spi.h
Low-level SPI peripheral driver interface definition.
adc.h
Low-level ADC peripheral driver interface definitions.
periph_conf.h
Configuration of CPU peripherals for the IKEA TRÅDFRI modules.
gpio.h
Low-level GPIO peripheral driver interface definitions.
board_init
void board_init(void)
Board level initialization.