Home | History | Annotate | Download | only in variant
      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_LUNCHBOX_H_
     18 #define _VARIANT_LUNCHBOX_H_
     19 
     20 #ifdef __cplusplus
     21 extern "C" {
     22 #endif
     23 
     24 #define PLATFORM_HW_TYPE  0x4C75   // 'Lu' -> lunchbox
     25 //#define DEBUG_UART_PIN    16       // GPIOB0 is debug uart at 2MBps
     26 
     27 #define VARIANT_VER                 0x00000000
     28 
     29 //we have LSE in lunchbox
     30 #define RTC_CLK                     RTC_CLK_LSE
     31 // fCAL = fRTCCLK x [1 + (256 - CALM) / (2^20 + CALM - 256)]
     32 // 32764.505 * (1 + (256 - 144)/(1048576 + 144 - 256)) = 32768.005
     33 #define RTC_PREDIV_A                0UL
     34 #define RTC_PREDIV_S                32759UL
     35 #define RTC_CALM                    144UL
     36 #define RTC_CALP                    0UL
     37 
     38 //spi bus for comms
     39 #define PLATFORM_HOST_INTF_SPI_BUS  0
     40 
     41 #define SH_INT_WAKEUP               GPIO_PA(2)
     42 #define SH_EXTI_WAKEUP_IRQ          EXTI2_IRQn
     43 #define AP_INT_WAKEUP               GPIO_PA(3)
     44 #undef AP_INT_NONWAKEUP
     45 
     46 #define DEBUG_LOG_EVT               0x3B474F4C
     47 
     48 #define BMP280_I2C_BUS_ID           0
     49 
     50 #define BMI160_TO_ANDROID_COORDINATE(x, y, z)   \
     51     do {                                        \
     52         float xi = x, yi = y, zi = z;           \
     53         x = -yi; y = xi; z = zi;                \
     54     } while (0)
     55 
     56 #define BMM150_TO_ANDROID_COORDINATE(x, y, z)   \
     57     do {                                        \
     58         float xi = x, yi = y, zi = z;           \
     59         x = xi; y = -yi; z = -zi;               \
     60     } while (0)
     61 
     62 #define HALL_PIN        GPIO_PA(9)
     63 #define HALL_IRQ        EXTI9_5_IRQn
     64 
     65 #define VSYNC_PIN       GPIO_PB(1)
     66 #define VSYNC_IRQ       EXTI1_IRQn
     67 
     68 #define PROX_INT_PIN    GPIO_PB(10)
     69 #define PROX_IRQ        EXTI15_10_IRQn
     70 #define PROX_I2C_BUS_ID 0
     71 
     72 //define tap sensor threshold
     73 #define TAP_THRESHOLD   0x01
     74 
     75 //define Accelerometer fast compensation config
     76 #define ACC_FOC_CONFIG  0x3d
     77 
     78 #ifdef __cplusplus
     79 }
     80 #endif
     81 
     82 #endif
     83