xref: /btstack/port/max32630-fthr/board/board.h (revision 24efff18d503b865e0dcd62b825ab5cfef2acc77)
1 /*******************************************************************************
2  * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included
12  * in all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17  * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
18  * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20  * OTHER DEALINGS IN THE SOFTWARE.
21  *
22  * Except as contained in this notice, the name of Maxim Integrated
23  * Products, Inc. shall not be used except as stated in the Maxim Integrated
24  * Products, Inc. Branding Policy.
25  *
26  * The mere transfer of this software does not imply any licenses
27  * of trade secrets, proprietary technology, copyrights, patents,
28  * trademarks, maskwork rights, or any other form of intellectual
29  * property whatsoever. Maxim Integrated Products, Inc. retains all
30  * ownership rights.
31  *
32  * $Date: 2016-03-11 10:46:02 -0700 (Fri, 11 Mar 2016) $
33  * $Revision: 21838 $
34  *
35  ******************************************************************************/
36 
37 /**
38  * @file    board.h
39  * @brief   Board support package API.
40  */
41 
42 #ifndef _BOARD_H
43 #define _BOARD_H
44 
45 #include "gpio.h"
46 #include "spim.h"
47 #include "ioman.h"
48 #include "led.h"
49 #include "pb.h"
50 
51 #ifdef __cplusplus
52 extern "C" {
53 #endif
54 
55 #ifndef CONSOLE_UART
56 #define CONSOLE_UART        1       /// UART instance to use for console
57 #endif
58 
59 #ifndef CONSOLE_BAUD
60 #define CONSOLE_BAUD    115200  /// Console baud rate
61 #endif
62 
63 // Pushbutton Indices
64 #define SW1             0       /// Pushbutton index for SW1
65 
66 #define LED_OFF         1       /// Inactive state of LEDs
67 #define LED_ON          0       /// Active state of LEDs
68 
69 #define LED_RED		(0) /* (&led_pin[0]) */
70 #define LED_GREEN	(1) /* &led_pin[1] */
71 #define LED_BLUE	(2) /* led_pin[2] */
72 
73 // Console UART configuration
74 extern const uart_cfg_t console_uart_cfg;
75 extern const sys_cfg_uart_t console_sys_cfg;
76 
77 // MAX14690 PMIC
78 #define MAX14690_I2CM_INST  0
79 #define MAX14690_I2CM       MXC_I2CM2
80 extern const ioman_cfg_t max14690_io_cfg;
81 extern const gpio_cfg_t max14690_int;
82 extern const gpio_cfg_t max14690_mpc0;
83 
84 /**
85  * \brief   Initialize the BSP and board interfaces.
86  * \returns #E_NO_ERROR if everything is successful
87  */
88 int Board_Init(void);
89 
90 /**
91  * \brief   Initialize or reinitialize the console. This may be necessary if the
92  *          system clock rate is changed.
93  * \returns #E_NO_ERROR if everything is successful
94  */
95 int Console_Init(void);
96 
97 /**
98  * \brief   Attempt to prepare the console for sleep.
99  * \returns #E_NO_ERROR if ready to sleep, #E_BUSY if not ready for sleep.
100  */
101 int Console_PrepForSleep(void);
102 
103 #ifdef __cplusplus
104 }
105 #endif
106 
107 #endif /* _BOARD_H */
108