board.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 Mesotic SAS
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 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
35 #define SX127X_PARAM_SPI (SPI_DEV(0))
36 #define SX127X_PARAM_SPI_NSS GPIO_PIN(1, 31) /* D10 */
37 #define SX127X_PARAM_RESET GPIO_PIN(1, 15) /* A0 */
38 #define SX127X_PARAM_DIO0 GPIO_PIN(1, 16) /* D2 */
39 #define SX127X_PARAM_DIO1 GPIO_PIN(0, 11) /* D3 */
40 #define SX127X_PARAM_DIO2 GPIO_PIN(0, 12) /* D4 */
41 #define SX127X_PARAM_DIO3 GPIO_PIN(1, 17) /* D5 */
42 #define SX127X_PARAM_PASELECT (SX127X_PA_RFO)
43 
49 #define TCXO_PWR_PIN GPIO_PIN(PA, 9)
50 #define TX_OUTPUT_SEL_PIN GPIO_PIN(PA, 13)
51 
57 #define LED_PORT PORT->Group[0]
58 
59 #define LED0_PIN GPIO_PIN(PA, 18)
60 #define LED0_MASK (1 << 18)
61 #define LED0_ON (LED_PORT.OUTCLR.reg = LED0_MASK)
62 #define LED0_OFF (LED_PORT.OUTSET.reg = LED0_MASK)
63 #define LED0_TOGGLE (LED_PORT.OUTTGL.reg = LED0_MASK)
64 
65 #define LED1_PIN GPIO_PIN(PA, 19)
66 #define LED1_MASK (1 << 19)
67 #define LED1_ON (LED_PORT.OUTCLR.reg = LED1_MASK)
68 #define LED1_OFF (LED_PORT.OUTSET.reg = LED1_MASK)
69 #define LED1_TOGGLE (LED_PORT.OUTTGL.reg = LED1_MASK)
70 
76 #define BTN0_PORT PORT->Group[0]
77 #define BTN0_PIN GPIO_PIN(PA, 28)
78 #define BTN0_MODE GPIO_IN_PU
79 
84 void board_init(void);
85 
86 #ifdef __cplusplus
87 }
88 #endif
89 
90 #endif /* BOARD_H */
91 
board_init
void board_init(void)
Board level initialization.