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 VARIANT_VER 0x00000000 25 26 //we have LSE in lunchbox 27 #define RTC_CLK RTC_CLK_LSE 28 // fCAL = fRTCCLK x [1 + (256 - CALM) / (2^20 + CALM - 256)] 29 // 32764.505 * (1 + (256 - 144)/(1048576 + 144 - 256)) = 32768.005 30 #define RTC_PREDIV_A 0UL 31 #define RTC_PREDIV_S 32759UL 32 #define RTC_CALM 144UL 33 #define RTC_CALP 0UL 34 35 //spi bus for comms 36 #define PLATFORM_HOST_INTF_SPI_BUS 0 37 38 #define SH_INT_WAKEUP GPIO_PA(2) 39 #define SH_EXTI_WAKEUP_IRQ EXTI2_IRQn 40 #define AP_INT_WAKEUP GPIO_PA(3) 41 #undef AP_INT_NONWAKEUP 42 43 #define DEBUG_LOG_EVT 0x3B474F4C 44 45 #define BL_FLASH_TABLE \ 46 { \ 47 { (uint8_t *)(&BL), 0x04000, BL_FLASH_BL },\ 48 { (uint8_t *)(__eedata_start), 0x04000, BL_FLASH_EEDATA },\ 49 { (uint8_t *)(__eedata_start + 0x04000), 0x04000, BL_FLASH_EEDATA },\ 50 { (uint8_t *)(__code_start), 0x04000, BL_FLASH_KERNEL },\ 51 { (uint8_t *)(__code_start + 0x04000), 0x10000, BL_FLASH_KERNEL },\ 52 { (uint8_t *)(__code_start + 0x10000), 0x20000, BL_FLASH_KERNEL },\ 53 { (uint8_t *)(__shared_start), 0x20000, BL_FLASH_SHARED },\ 54 { (uint8_t *)(__shared_start + 0x20000), 0x20000, BL_FLASH_SHARED },\ 55 } 56 57 #define BMI160_TO_ANDROID_COORDINATE(x, y, z) \ 58 do { \ 59 int32_t xi = x, yi = y, zi = z; \ 60 x = -yi; y = xi; z = zi; \ 61 } while (0) 62 63 #define BMM150_TO_ANDROID_COORDINATE(x, y, z) \ 64 do { \ 65 int32_t xi = x, yi = y, zi = z; \ 66 x = xi; y = -yi; z = -zi; \ 67 } while (0) 68 69 #define HALL_PIN GPIO_PA(9) 70 #define HALL_IRQ EXTI9_5_IRQn 71 72 #define VSYNC_PIN GPIO_PB(1) 73 #define VSYNC_IRQ EXTI1_IRQn 74 75 #define PROX_INT_PIN GPIO_PB(10) 76 #define PROX_IRQ EXTI15_10_IRQn 77 78 //define tap sensor threshold 79 #define TAP_THRESHOLD 0x01 80 81 //define Accelerometer fast compensation config 82 #define ACC_FOC_CONFIG 0x3d 83 84 #ifdef __cplusplus 85 } 86 #endif 87 88 #endif 89