1 /*
2  * Copyright (C) 2017 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_NEONKEY_H_
18 #define _VARIANT_NEONKEY_H_
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 #define VARIANT_VER                 0x00000000
25 
26 //we don't have LSE in neonkey
27 #define RTC_CLK                     RTC_CLK_LSI
28 
29 //spi bus for comms
30 #define PLATFORM_HOST_INTF_SPI_BUS  0
31 
32 #define SH_INT_WAKEUP               GPIO_PB(9)
33 #define SH_EXTI_WAKEUP_IRQ          EXTI9_5_IRQn
34 #define AP_INT_WAKEUP               GPIO_PB(5)
35 #undef AP_INT_NONWAKEUP
36 
37 //enable logging through nanohub driver
38 #define DEBUG_LOG_EVT               0x3B474F4C
39 
40 #define DEBUG_UART_UNITNO           1
41 #define DEBUG_UART_GPIO_TX          GPIO_PA(9)
42 #define DEBUG_UART_GPIO_RX          GPIO_PA(10)
43 
44 #define BMP280_I2C_BUS_ID           1
45 #define PROX_I2C_BUS_ID             1
46 #define LP3943_I2C_BUS_ID           2
47 #define SI7034A10_I2C_BUS_ID        1
48 
49 #define BMI160_I2C_BUS_ID           1
50 #define BMI160_INT1_PIN             GPIO_PA(0)
51 #define BMI160_INT1_IRQ             EXTI0_IRQn
52 #define BMI160_INT2_PIN             GPIO_PA(1)
53 #define BMI160_INT2_IRQ             EXTI1_IRQn
54 
55 #define HALL_PIN                    GPIO_PB(8)
56 #define HALL_IRQ                    EXTI9_5_IRQn
57 
58 #define PROX_INT_PIN                GPIO_PA(15)
59 #define PROX_IRQ                    EXTI15_10_IRQn
60 
61 #define BMI160_TO_ANDROID_COORDINATE(x, y, z)   \
62     do {                                        \
63         float xi = x, yi = y, zi = z;           \
64         x = xi; y = yi; z = zi;                 \
65     } while (0)
66 
67 #define BMM150_TO_ANDROID_COORDINATE(x, y, z)   \
68     do {                                        \
69         float xi = x, yi = y, zi = z;           \
70         x = xi; y = -yi; z = -zi;               \
71     } while (0)
72 
73 //define tap sensor threshold
74 #define TAP_THRESHOLD               0x01
75 
76 //define Accelerometer fast compensation config
77 #define ACC_FOC_CONFIG              0x3d
78 
79 #ifdef __cplusplus
80 }
81 #endif
82 
83 #endif
84