1 /*
2  * Copyright (C) 2016 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef _VARIANT_NUCLEO_H_
18 #define _VARIANT_NUCLEO_H_
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 #define VARIANT_VER                 0x00000000
25 
26 //we have LSE in nucleo
27 #define RTC_CLK                     RTC_CLK_LSE
28 
29 //spi bus for comms
30 #define PLATFORM_HOST_INTF_SPI_BUS  0
31 
32 #define SH_INT_WAKEUP               GPIO_PA(0)
33 #define SH_EXTI_WAKEUP_IRQ          EXTI0_IRQn
34 #define AP_INT_WAKEUP               GPIO_PA(1)
35 #undef AP_INT_NONWAKEUP
36 
37 #define DEBUG_UART_UNITNO           2
38 #define DEBUG_UART_GPIO_TX          GPIO_PA(2)
39 #define DEBUG_UART_GPIO_RX          GPIO_PA(3)
40 
41 #define BMP280_I2C_BUS_ID           0
42 
43 #define BMI160_TO_ANDROID_COORDINATE(x, y, z)   \
44     do {                                        \
45         int32_t xi = x, yi = y, zi = z;         \
46         x = xi; y = yi; z = zi;                 \
47     } while (0)
48 
49 #define BMM150_TO_ANDROID_COORDINATE(x, y, z)   \
50     do {                                        \
51         int32_t xi = x, yi = y, zi = z;         \
52         x = xi; y = -yi; z = -zi;               \
53     } while (0)
54 
55 #define HALL_PIN        GPIO_PB(5)
56 #define HALL_IRQ        EXTI9_5_IRQn
57 
58 #define VSYNC_PIN       GPIO_PB(1)
59 #define VSYNC_IRQ       EXTI1_IRQn
60 
61 #define PROX_INT_PIN    GPIO_PB(10)
62 #define PROX_IRQ        EXTI15_10_IRQn
63 #define PROX_I2C_BUS_ID 0
64 
65 //define tap sensor threshold
66 #define TAP_THRESHOLD   0x01
67 
68 //define Accelerometer fast compensation config
69 #define ACC_FOC_CONFIG  0x3d
70 
71 #ifdef __cplusplus
72 }
73 #endif
74 
75 #endif
76