board.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 HAW Hamburg
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 
22 #ifndef BOARD_H
23 #define BOARD_H
24 
25 #include "cpu.h"
26 #include "periph_conf.h"
27 #include "periph_cpu.h"
28 #include "mtd_sdcard.h"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
38 #define LED0_PIN GPIO_PIN(PA, 27)
39 
40 #define LED_PORT PORT->Group[PA]
41 #define LED0_MASK (1 << 27)
42 
43 #define LED0_ON (LED_PORT.OUTSET.reg = LED0_MASK)
44 #define LED0_OFF (LED_PORT.OUTCLR.reg = LED0_MASK)
45 #define LED0_TOGGLE (LED_PORT.OUTTGL.reg = LED0_MASK)
46 
47 #define LED1_PIN GPIO_PIN(PA, 28)
48 #define LED1_MASK (1 << 28)
49 
50 #define LED1_ON (LED_PORT.OUTSET.reg = LED1_MASK)
51 #define LED1_OFF (LED_PORT.OUTCLR.reg = LED1_MASK)
52 #define LED1_TOGGLE (LED_PORT.OUTTGL.reg = LED1_MASK)
53 
59 #define BTN0_PORT PORT->Group[PA]
60 #define BTN0_PIN GPIO_PIN(PA, 20)
61 #define BTN0_MODE GPIO_IN_PU
62 
71 #define XBEE1_EN_PORT PORT->Group[PB]
72 #define XBEE1_EN_MASK (1 << 3)
73 #define XBEE1_EN_MODE GPIO_OUT
74 #define XBEE1_EN_PIN GPIO_PIN(PB, 3)
75 
76 #define XBEE1_ENABLE (XBEE1_EN_PORT.OUTCLR.reg = XBEE1_EN_MASK)
77 #define XBEE1_DISABLE (XBEE1_EN_PORT.OUTSET.reg = XBEE1_EN_MASK)
78 
79 #define XBEE1_CS_PIN GPIO_PIN(PA, 18)
80 
81 #define XBEE1_INT_PIN GPIO_PIN(PA, 21)
82 
91 #define XBEE2_EN_PORT PORT->Group[PB]
92 #define XBEE2_EN_MASK (1 << 10)
93 #define XBEE2_EN_PIN GPIO_PIN(PB, 10)
94 #define XBEE2_EN_MODE GPIO_OUT
95 
96 #define XBEE2_ENABLE (XBEE2_EN_PORT.OUTCLR.reg = XBEE2_EN_MASK)
97 #define XBEE2_DISABLE (XBEE2_EN_PORT.OUTSET.reg = XBEE2_EN_MASK)
98 
99 #define XBEE2_CS_PIN GPIO_PIN(PA, 14)
100 
101 #define XBEE2_INT_PIN GPIO_PIN(PA, 15)
102 
111 #define I2C_EN_PORT PORT->Group[PB]
112 #define I2C_EN_MASK (1 << 11)
113 #define I2C_EN_PIN GPIO_PIN(PB, 11)
114 #define I2C_EN_MODE GPIO_OUT
115 
116 #define I2C_ENABLE (I2C_EN_PORT.OUTSET.reg = I2C_EN_MASK)
117 #define I2C_DISABLE (I2C_EN_PORT.OUTCLR.reg = I2C_EN_MASK)
118 
129 #define SX127X_PARAM_SPI (SPI_DEV(0))
130 
131 #define SX127X_PARAM_SPI_NSS XBEE1_CS_PIN /* D23 */
132 
133 #define SX127X_PARAM_RESET GPIO_UNDEF
134 
135 #define SX127X_PARAM_DIO0 XBEE1_INT_PIN /* D24 */
136 
137 #define SX127X_PARAM_DIO1 GPIO_UNDEF
138 
139 #define SX127X_PARAM_DIO2 GPIO_UNDEF
140 
141 #define SX127X_PARAM_DIO3 GPIO_UNDEF
142 
143 #define SX127X_PARAM_PASELECT (SX127X_PA_BOOST)
144 
149 #define WAIT_FOR_SPI_RESET (3000000UL)
150 
154 #define HDC1000_PARAM_ADDR (0x40)
155 
159 #define TSL2561_PARAM_ADDR TSL2561_ADDR_LOW
160 
164 #define BMX280_PARAM_I2C_ADDR (0x76)
165 
166 #if defined(MODULE_MTD_SDCARD) || defined(DOXYGEN)
167 
171 extern mtd_dev_t *mtd0;
172 #define MTD_0 mtd0
173 
179 #ifndef MTD_SD_CARD_PAGE_SIZE
180 #define MTD_SD_CARD_PAGE_SIZE (512)
181 #endif
182 
183 #ifndef MTD_SD_CARD_PAGES_PER_SECTOR
184 #define MTD_SD_CARD_PAGES_PER_SECTOR (128)
185 #endif
186 
187 #ifndef MTD_SD_CARD_SECTOR_COUNT
188 #define MTD_SD_CARD_SECTOR_COUNT (3921920UL)
189 #endif
190 
191 #endif /* MODULE_MTD_SDCARD || DOXYGEN */
192 
196 void board_init(void);
197 
198 #ifdef __cplusplus
199 }
200 #endif
201 
202 #endif /* BOARD_H */
203 
mtd_dev_t
MTD device descriptor.
Definition: mtd.h:58
periph_conf.h
Configuration of CPU peripherals for SenseBox MCU with SAMD21.
mtd_sdcard.h
Interface definition for mtd_sdcard driver.
mtd0
mtd_dev_t * mtd0
mtd flash emulation device
board_init
void board_init(void)
Board level initialization.