-
Notifications
You must be signed in to change notification settings - Fork 0
/
init_app.c
56 lines (49 loc) · 1.78 KB
/
init_app.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/***************************************************************************//**
* @file
* @brief init_app.c
*******************************************************************************
* # License
* <b>Copyright 2018 Silicon Laboratories Inc. www.silabs.com</b>
*******************************************************************************
*
* The licensor of this software is Silicon Laboratories Inc. Your use of this
* software is governed by the terms of Silicon Labs Master Software License
* Agreement (MSLA) available at
* www.silabs.com/about-us/legal/master-software-license-agreement. This
* software is distributed to you in Source Code format and is governed by the
* sections of the MSLA applicable to Source Code.
*
******************************************************************************/
#if defined(HAL_CONFIG)
#include "bsphalconfig.h"
#include "hal-config.h"
#include "hal-config-board.h"
#else
#include "bspconfig.h"
#endif
#include "bsp.h"
#include "i2cspm.h"
#include "pti.h"
void initApp(void)
{
// Enable PTI
configEnablePti();
#if (HAL_I2CSENSOR_ENABLE)
// Initialize I2C peripheral
I2CSPM_Init_TypeDef i2cInit = I2CSPM_INIT_DEFAULT;
I2CSPM_Init(&i2cInit);
#endif // HAL_I2CSENSOR_ENABLE
#if defined(HAL_VCOM_ENABLE)
// Enable VCOM if requested
GPIO_PinModeSet(BSP_VCOM_ENABLE_PORT, BSP_VCOM_ENABLE_PIN, gpioModePushPull, HAL_VCOM_ENABLE);
#endif // HAL_VCOM_ENABLE
#if defined(HAL_I2CSENSOR_ENABLE) || defined(HAL_SPIDISPLAY_ENABLE)
#if HAL_I2CSENSOR_ENABLE || HAL_SPIDISPLAY_ENABLE
#define DISPLAY_SENSOR_COMMON_ENABLE 1
#else
#define DISPLAY_SENSOR_COMMON_ENABLE 0
#endif
//Enable I2C sensor and display if requested
GPIO_PinModeSet(BSP_I2CSENSOR_ENABLE_PORT, BSP_I2CSENSOR_ENABLE_PIN, gpioModePushPull, DISPLAY_SENSOR_COMMON_ENABLE);
#endif
}