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 BMI160_TO_ANDROID_COORDINATE(x, y, z)   \
42     do {                                        \
43         int32_t xi = x, yi = y, zi = z;         \
44         x = xi; y = yi; z = zi;                 \
45     } while (0)
46 
47 #define BMM150_TO_ANDROID_COORDINATE(x, y, z)   \
48     do {                                        \
49         int32_t xi = x, yi = y, zi = z;         \
50         x = xi; y = -yi; z = -zi;               \
51     } while (0)
52 
53 #define HALL_PIN        GPIO_PB(5)
54 #define HALL_IRQ        EXTI9_5_IRQn
55 
56 #define VSYNC_PIN       GPIO_PB(1)
57 #define VSYNC_IRQ       EXTI1_IRQn
58 
59 #define PROX_INT_PIN    GPIO_PB(10)
60 #define PROX_IRQ        EXTI15_10_IRQn
61 
62 //define tap sensor threshold
63 #define TAP_THRESHOLD   0x01
64 
65 //define Accelerometer fast compensation config
66 #define ACC_FOC_CONFIG  0x3d
67 
68 #ifdef __cplusplus
69 }
70 #endif
71 
72 #endif
73