parent
							
								
									db61810f98
								
							
						
					
					
						commit
						ecc565aa3f
					
				
				 46 changed files with 7467 additions and 428 deletions
			
			
		@ -0,0 +1,6 @@ | 
				
			|||||||
 | 
					.PHONY: all | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# TODO: Add a global build system to openpilot
 | 
				
			||||||
 | 
					all: | 
				
			||||||
 | 
						cd /data/openpilot/selfdrive && PYTHONPATH=/data/openpilot PREPAREONLY=1 /data/openpilot/selfdrive/manager.py
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -0,0 +1,148 @@ | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					  ****************************************************************************** | 
				
			||||||
 | 
					  * @file    stm32f2xx_hal_def.h | 
				
			||||||
 | 
					  * @author  MCD Application Team | 
				
			||||||
 | 
					  * @version V1.0.1 | 
				
			||||||
 | 
					  * @date    25-March-2014 | 
				
			||||||
 | 
					  * @brief   This file contains HAL common defines, enumeration, macros and 
 | 
				
			||||||
 | 
					  *          structures definitions. 
 | 
				
			||||||
 | 
					  ****************************************************************************** | 
				
			||||||
 | 
					  * @attention | 
				
			||||||
 | 
					  * | 
				
			||||||
 | 
					  * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> | 
				
			||||||
 | 
					  * | 
				
			||||||
 | 
					  * Redistribution and use in source and binary forms, with or without modification, | 
				
			||||||
 | 
					  * are permitted provided that the following conditions are met: | 
				
			||||||
 | 
					  *   1. Redistributions of source code must retain the above copyright notice, | 
				
			||||||
 | 
					  *      this list of conditions and the following disclaimer. | 
				
			||||||
 | 
					  *   2. Redistributions in binary form must reproduce the above copyright notice, | 
				
			||||||
 | 
					  *      this list of conditions and the following disclaimer in the documentation | 
				
			||||||
 | 
					  *      and/or other materials provided with the distribution. | 
				
			||||||
 | 
					  *   3. Neither the name of STMicroelectronics nor the names of its contributors | 
				
			||||||
 | 
					  *      may be used to endorse or promote products derived from this software | 
				
			||||||
 | 
					  *      without specific prior written permission. | 
				
			||||||
 | 
					  * | 
				
			||||||
 | 
					  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | 
				
			||||||
 | 
					  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 
				
			||||||
 | 
					  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 
				
			||||||
 | 
					  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | 
				
			||||||
 | 
					  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 
				
			||||||
 | 
					  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | 
				
			||||||
 | 
					  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | 
				
			||||||
 | 
					  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | 
				
			||||||
 | 
					  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 
				
			||||||
 | 
					  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 
				
			||||||
 | 
					  * | 
				
			||||||
 | 
					  ****************************************************************************** | 
				
			||||||
 | 
					  */ | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Define to prevent recursive inclusion -------------------------------------*/ | 
				
			||||||
 | 
					#ifndef __STM32F2xx_HAL_DEF | 
				
			||||||
 | 
					#define __STM32F2xx_HAL_DEF | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef __cplusplus | 
				
			||||||
 | 
					 extern "C" { | 
				
			||||||
 | 
					#endif | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Includes ------------------------------------------------------------------*/ | 
				
			||||||
 | 
					#include "stm32f2xx.h" | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Exported types ------------------------------------------------------------*/ | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** 
 | 
				
			||||||
 | 
					  * @brief  HAL Status structures definition  
 | 
				
			||||||
 | 
					  */  
 | 
				
			||||||
 | 
					typedef enum 
 | 
				
			||||||
 | 
					{ | 
				
			||||||
 | 
					  HAL_OK       = 0x00, | 
				
			||||||
 | 
					  HAL_ERROR    = 0x01, | 
				
			||||||
 | 
					  HAL_BUSY     = 0x02, | 
				
			||||||
 | 
					  HAL_TIMEOUT  = 0x03 | 
				
			||||||
 | 
					} HAL_StatusTypeDef; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** 
 | 
				
			||||||
 | 
					  * @brief  HAL Lock structures definition  
 | 
				
			||||||
 | 
					  */ | 
				
			||||||
 | 
					typedef enum 
 | 
				
			||||||
 | 
					{ | 
				
			||||||
 | 
					  HAL_UNLOCKED = 0x00, | 
				
			||||||
 | 
					  HAL_LOCKED   = 0x01  
 | 
				
			||||||
 | 
					} HAL_LockTypeDef; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Exported macro ------------------------------------------------------------*/ | 
				
			||||||
 | 
					#ifndef NULL | 
				
			||||||
 | 
					  #define NULL      (void *) 0 | 
				
			||||||
 | 
					#endif | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define HAL_MAX_DELAY      0xFFFFFFFF | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define HAL_IS_BIT_SET(REG, BIT)         (((REG) & (BIT)) != RESET) | 
				
			||||||
 | 
					#define HAL_IS_BIT_CLR(REG, BIT)         (((REG) & (BIT)) == RESET) | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD_, __DMA_HANDLE_)               \ | 
				
			||||||
 | 
					                        do{                                                      \
 | 
				
			||||||
 | 
					                              (__HANDLE__)->__PPP_DMA_FIELD_ = &(__DMA_HANDLE_); \
 | 
				
			||||||
 | 
					                              (__DMA_HANDLE_).Parent = (__HANDLE__);             \
 | 
				
			||||||
 | 
					                          } while(0) | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if (USE_RTOS == 1) | 
				
			||||||
 | 
					  /* Reserved for future use */ | 
				
			||||||
 | 
					#else | 
				
			||||||
 | 
					  #define __HAL_LOCK(__HANDLE__)                                           \ | 
				
			||||||
 | 
					                                do{                                        \
 | 
				
			||||||
 | 
					                                    if((__HANDLE__)->Lock == HAL_LOCKED)   \
 | 
				
			||||||
 | 
					                                    {                                      \
 | 
				
			||||||
 | 
					                                       return HAL_BUSY;                    \
 | 
				
			||||||
 | 
					                                    }                                      \
 | 
				
			||||||
 | 
					                                    else                                   \
 | 
				
			||||||
 | 
					                                    {                                      \
 | 
				
			||||||
 | 
					                                       (__HANDLE__)->Lock = HAL_LOCKED;    \
 | 
				
			||||||
 | 
					                                    }                                      \
 | 
				
			||||||
 | 
					                                  }while (0) | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  #define __HAL_UNLOCK(__HANDLE__)                                          \ | 
				
			||||||
 | 
					                                  do{                                       \
 | 
				
			||||||
 | 
					                                      (__HANDLE__)->Lock = HAL_UNLOCKED;    \
 | 
				
			||||||
 | 
					                                    }while (0) | 
				
			||||||
 | 
					#endif /* USE_RTOS */ | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if  defined ( __GNUC__ ) | 
				
			||||||
 | 
					  #ifndef __weak | 
				
			||||||
 | 
					    #define __weak   __attribute__((weak)) | 
				
			||||||
 | 
					  #endif /* __weak */ | 
				
			||||||
 | 
					  #ifndef __packed | 
				
			||||||
 | 
					    #define __packed __attribute__((__packed__)) | 
				
			||||||
 | 
					  #endif /* __packed */ | 
				
			||||||
 | 
					#endif /* __GNUC__ */ | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					/* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" must be used instead */ | 
				
			||||||
 | 
					#if defined   (__GNUC__)        /* GNU Compiler */ | 
				
			||||||
 | 
					  #ifndef __ALIGN_END | 
				
			||||||
 | 
					    #define __ALIGN_END    __attribute__ ((aligned (4))) | 
				
			||||||
 | 
					  #endif /* __ALIGN_END */ | 
				
			||||||
 | 
					  #ifndef __ALIGN_BEGIN   | 
				
			||||||
 | 
					    #define __ALIGN_BEGIN | 
				
			||||||
 | 
					  #endif /* __ALIGN_BEGIN */ | 
				
			||||||
 | 
					#else | 
				
			||||||
 | 
					  #ifndef __ALIGN_END | 
				
			||||||
 | 
					    #define __ALIGN_END | 
				
			||||||
 | 
					  #endif /* __ALIGN_END */ | 
				
			||||||
 | 
					  #ifndef __ALIGN_BEGIN       | 
				
			||||||
 | 
					    #if defined   (__CC_ARM)      /* ARM Compiler */ | 
				
			||||||
 | 
					      #define __ALIGN_BEGIN    __align(4)   | 
				
			||||||
 | 
					    #elif defined (__ICCARM__)    /* IAR Compiler */ | 
				
			||||||
 | 
					      #define __ALIGN_BEGIN  | 
				
			||||||
 | 
					    #elif defined  (__TASKING__)  /* TASKING Compiler */ | 
				
			||||||
 | 
					      #define __ALIGN_BEGIN    __align(4)  | 
				
			||||||
 | 
					    #endif /* __CC_ARM */ | 
				
			||||||
 | 
					  #endif /* __ALIGN_BEGIN */ | 
				
			||||||
 | 
					#endif /* __GNUC__ */ | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef __cplusplus | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					#endif | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif /* ___STM32F2xx_HAL_DEF */ | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | 
				
			||||||
@ -0,0 +1,236 @@ | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					  ****************************************************************************** | 
				
			||||||
 | 
					  * @file    stm32f2xx_hal_gpio_ex.h | 
				
			||||||
 | 
					  * @author  MCD Application Team | 
				
			||||||
 | 
					  * @version V1.0.1 | 
				
			||||||
 | 
					  * @date    25-March-2014 | 
				
			||||||
 | 
					  * @brief   Header file of GPIO HAL Extension module. | 
				
			||||||
 | 
					  ****************************************************************************** | 
				
			||||||
 | 
					  * @attention 
 | 
				
			||||||
 | 
					  * | 
				
			||||||
 | 
					  * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> | 
				
			||||||
 | 
					  * | 
				
			||||||
 | 
					  * Redistribution and use in source and binary forms, with or without modification, | 
				
			||||||
 | 
					  * are permitted provided that the following conditions are met: | 
				
			||||||
 | 
					  *   1. Redistributions of source code must retain the above copyright notice, | 
				
			||||||
 | 
					  *      this list of conditions and the following disclaimer. | 
				
			||||||
 | 
					  *   2. Redistributions in binary form must reproduce the above copyright notice, | 
				
			||||||
 | 
					  *      this list of conditions and the following disclaimer in the documentation | 
				
			||||||
 | 
					  *      and/or other materials provided with the distribution. | 
				
			||||||
 | 
					  *   3. Neither the name of STMicroelectronics nor the names of its contributors | 
				
			||||||
 | 
					  *      may be used to endorse or promote products derived from this software | 
				
			||||||
 | 
					  *      without specific prior written permission. | 
				
			||||||
 | 
					  * | 
				
			||||||
 | 
					  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | 
				
			||||||
 | 
					  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 
				
			||||||
 | 
					  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 
				
			||||||
 | 
					  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | 
				
			||||||
 | 
					  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 
				
			||||||
 | 
					  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | 
				
			||||||
 | 
					  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | 
				
			||||||
 | 
					  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | 
				
			||||||
 | 
					  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 
				
			||||||
 | 
					  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 
				
			||||||
 | 
					  * | 
				
			||||||
 | 
					  ****************************************************************************** | 
				
			||||||
 | 
					  */ 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Define to prevent recursive inclusion -------------------------------------*/ | 
				
			||||||
 | 
					#ifndef __STM32F2xx_HAL_GPIO_EX_H | 
				
			||||||
 | 
					#define __STM32F2xx_HAL_GPIO_EX_H | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef __cplusplus | 
				
			||||||
 | 
					 extern "C" { | 
				
			||||||
 | 
					#endif | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Includes ------------------------------------------------------------------*/ | 
				
			||||||
 | 
					#include "stm32f2xx_hal_def.h" | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** @addtogroup STM32F2xx_HAL_Driver
 | 
				
			||||||
 | 
					  * @{ | 
				
			||||||
 | 
					  */ | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** @addtogroup GPIO
 | 
				
			||||||
 | 
					  * @{ | 
				
			||||||
 | 
					  */ 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Exported types ------------------------------------------------------------*/ | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Exported constants --------------------------------------------------------*/ | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** @defgroup GPIO_Exported_Constants
 | 
				
			||||||
 | 
					  * @{ | 
				
			||||||
 | 
					  */ 
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					/** @defgroup GPIO_Alternat_function_selection 
 | 
				
			||||||
 | 
					  * @{ | 
				
			||||||
 | 
					  */ | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** 
 | 
				
			||||||
 | 
					  * @brief   AF 0 selection  
 | 
				
			||||||
 | 
					  */ 
 | 
				
			||||||
 | 
					#define GPIO_AF0_RTC_50Hz      ((uint8_t)0x00)  /* RTC_50Hz Alternate Function mapping                       */ | 
				
			||||||
 | 
					#define GPIO_AF0_MCO           ((uint8_t)0x00)  /* MCO (MCO1 and MCO2) Alternate Function mapping            */ | 
				
			||||||
 | 
					#define GPIO_AF0_TAMPER        ((uint8_t)0x00)  /* TAMPER (TAMPER_1 and TAMPER_2) Alternate Function mapping */ | 
				
			||||||
 | 
					#define GPIO_AF0_SWJ           ((uint8_t)0x00)  /* SWJ (SWD and JTAG) Alternate Function mapping             */ | 
				
			||||||
 | 
					#define GPIO_AF0_TRACE         ((uint8_t)0x00)  /* TRACE Alternate Function mapping                          */ | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** 
 | 
				
			||||||
 | 
					  * @brief   AF 1 selection  
 | 
				
			||||||
 | 
					  */ 
 | 
				
			||||||
 | 
					#define GPIO_AF1_TIM1          ((uint8_t)0x01)  /* TIM1 Alternate Function mapping */ | 
				
			||||||
 | 
					#define GPIO_AF1_TIM2          ((uint8_t)0x01)  /* TIM2 Alternate Function mapping */ | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** 
 | 
				
			||||||
 | 
					  * @brief   AF 2 selection  
 | 
				
			||||||
 | 
					  */ 
 | 
				
			||||||
 | 
					#define GPIO_AF2_TIM3          ((uint8_t)0x02)  /* TIM3 Alternate Function mapping */ | 
				
			||||||
 | 
					#define GPIO_AF2_TIM4          ((uint8_t)0x02)  /* TIM4 Alternate Function mapping */ | 
				
			||||||
 | 
					#define GPIO_AF2_TIM5          ((uint8_t)0x02)  /* TIM5 Alternate Function mapping */ | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** 
 | 
				
			||||||
 | 
					  * @brief   AF 3 selection  
 | 
				
			||||||
 | 
					  */ 
 | 
				
			||||||
 | 
					#define GPIO_AF3_TIM8          ((uint8_t)0x03)  /* TIM8 Alternate Function mapping  */ | 
				
			||||||
 | 
					#define GPIO_AF3_TIM9          ((uint8_t)0x03)  /* TIM9 Alternate Function mapping  */ | 
				
			||||||
 | 
					#define GPIO_AF3_TIM10         ((uint8_t)0x03)  /* TIM10 Alternate Function mapping */ | 
				
			||||||
 | 
					#define GPIO_AF3_TIM11         ((uint8_t)0x03)  /* TIM11 Alternate Function mapping */ | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** 
 | 
				
			||||||
 | 
					  * @brief   AF 4 selection  
 | 
				
			||||||
 | 
					  */ 
 | 
				
			||||||
 | 
					#define GPIO_AF4_I2C1          ((uint8_t)0x04)  /* I2C1 Alternate Function mapping */ | 
				
			||||||
 | 
					#define GPIO_AF4_I2C2          ((uint8_t)0x04)  /* I2C2 Alternate Function mapping */ | 
				
			||||||
 | 
					#define GPIO_AF4_I2C3          ((uint8_t)0x04)  /* I2C3 Alternate Function mapping */ | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** 
 | 
				
			||||||
 | 
					  * @brief   AF 5 selection  
 | 
				
			||||||
 | 
					  */ 
 | 
				
			||||||
 | 
					#define GPIO_AF5_SPI1          ((uint8_t)0x05)  /* SPI1 Alternate Function mapping        */ | 
				
			||||||
 | 
					#define GPIO_AF5_SPI2          ((uint8_t)0x05)  /* SPI2/I2S2 Alternate Function mapping   */ | 
				
			||||||
 | 
					/** 
 | 
				
			||||||
 | 
					  * @brief   AF 6 selection  
 | 
				
			||||||
 | 
					  */ 
 | 
				
			||||||
 | 
					#define GPIO_AF6_SPI3          ((uint8_t)0x06)  /* SPI3/I2S3 Alternate Function mapping  */ | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** 
 | 
				
			||||||
 | 
					  * @brief   AF 7 selection  
 | 
				
			||||||
 | 
					  */ 
 | 
				
			||||||
 | 
					#define GPIO_AF7_USART1        ((uint8_t)0x07)  /* USART1 Alternate Function mapping     */ | 
				
			||||||
 | 
					#define GPIO_AF7_USART2        ((uint8_t)0x07)  /* USART2 Alternate Function mapping     */ | 
				
			||||||
 | 
					#define GPIO_AF7_USART3        ((uint8_t)0x07)  /* USART3 Alternate Function mapping     */ | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** 
 | 
				
			||||||
 | 
					  * @brief   AF 8 selection  
 | 
				
			||||||
 | 
					  */ 
 | 
				
			||||||
 | 
					#define GPIO_AF8_UART4         ((uint8_t)0x08)  /* UART4 Alternate Function mapping  */ | 
				
			||||||
 | 
					#define GPIO_AF8_UART5         ((uint8_t)0x08)  /* UART5 Alternate Function mapping  */ | 
				
			||||||
 | 
					#define GPIO_AF8_USART6        ((uint8_t)0x08)  /* USART6 Alternate Function mapping */ | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** 
 | 
				
			||||||
 | 
					  * @brief   AF 9 selection 
 | 
				
			||||||
 | 
					  */ 
 | 
				
			||||||
 | 
					#define GPIO_AF9_CAN1          ((uint8_t)0x09)  /* CAN1 Alternate Function mapping  */ | 
				
			||||||
 | 
					#define GPIO_AF9_CAN2          ((uint8_t)0x09)  /* CAN2 Alternate Function mapping  */ | 
				
			||||||
 | 
					#define GPIO_AF9_TIM12         ((uint8_t)0x09)  /* TIM12 Alternate Function mapping */ | 
				
			||||||
 | 
					#define GPIO_AF9_TIM13         ((uint8_t)0x09)  /* TIM13 Alternate Function mapping */ | 
				
			||||||
 | 
					#define GPIO_AF9_TIM14         ((uint8_t)0x09)  /* TIM14 Alternate Function mapping */ | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** 
 | 
				
			||||||
 | 
					  * @brief   AF 10 selection  
 | 
				
			||||||
 | 
					  */ 
 | 
				
			||||||
 | 
					#define GPIO_AF10_OTG_FS        ((uint8_t)0xA)  /* OTG_FS Alternate Function mapping */ | 
				
			||||||
 | 
					#define GPIO_AF10_OTG_HS        ((uint8_t)0xA)  /* OTG_HS Alternate Function mapping */ | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** 
 | 
				
			||||||
 | 
					  * @brief   AF 11 selection  
 | 
				
			||||||
 | 
					  */ 
 | 
				
			||||||
 | 
					#if defined(STM32F207xx) || defined(STM32F217xx) | 
				
			||||||
 | 
					#define GPIO_AF11_ETH             ((uint8_t)0x0B)  /* ETHERNET Alternate Function mapping */ | 
				
			||||||
 | 
					#endif /* STM32F207xx || STM32F217xx */ | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** 
 | 
				
			||||||
 | 
					  * @brief   AF 12 selection  
 | 
				
			||||||
 | 
					  */ 
 | 
				
			||||||
 | 
					#define GPIO_AF12_FSMC          ((uint8_t)0xC)  /* FSMC Alternate Function mapping                     */ | 
				
			||||||
 | 
					#define GPIO_AF12_OTG_HS_FS     ((uint8_t)0xC)  /* OTG HS configured in FS, Alternate Function mapping */ | 
				
			||||||
 | 
					#define GPIO_AF12_SDIO          ((uint8_t)0xC)  /* SDIO Alternate Function mapping                     */ | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** 
 | 
				
			||||||
 | 
					  * @brief   AF 13 selection  
 | 
				
			||||||
 | 
					  */ 
 | 
				
			||||||
 | 
					#if defined(STM32F207xx) || defined(STM32F217xx) | 
				
			||||||
 | 
					#define GPIO_AF13_DCMI          ((uint8_t)0x0D)  /* DCMI Alternate Function mapping */ | 
				
			||||||
 | 
					#endif /* STM32F207xx || STM32F217xx */ | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/** 
 | 
				
			||||||
 | 
					  * @brief   AF 15 selection  
 | 
				
			||||||
 | 
					  */ 
 | 
				
			||||||
 | 
					#define GPIO_AF15_EVENTOUT      ((uint8_t)0x0F)  /* EVENTOUT Alternate Function mapping */ | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if defined(STM32F207xx) || defined(STM32F217xx) | 
				
			||||||
 | 
					#define IS_GPIO_AF(AF)   (((AF) == GPIO_AF0_RTC_50Hz)   || ((AF) == GPIO_AF9_TIM14)      || \ | 
				
			||||||
 | 
					                          ((AF) == GPIO_AF0_MCO)        || ((AF) == GPIO_AF0_TAMPER)     || \
 | 
				
			||||||
 | 
					                          ((AF) == GPIO_AF0_SWJ)        || ((AF) == GPIO_AF0_TRACE)      || \
 | 
				
			||||||
 | 
					                          ((AF) == GPIO_AF1_TIM1)       || ((AF) == GPIO_AF1_TIM2)       || \
 | 
				
			||||||
 | 
					                          ((AF) == GPIO_AF2_TIM3)       || ((AF) == GPIO_AF2_TIM4)       || \
 | 
				
			||||||
 | 
					                          ((AF) == GPIO_AF2_TIM5)       || ((AF) == GPIO_AF3_TIM8)       || \
 | 
				
			||||||
 | 
					                          ((AF) == GPIO_AF4_I2C1)       || ((AF) == GPIO_AF4_I2C2)       || \
 | 
				
			||||||
 | 
					                          ((AF) == GPIO_AF4_I2C3)       || ((AF) == GPIO_AF5_SPI1)       || \
 | 
				
			||||||
 | 
					                          ((AF) == GPIO_AF5_SPI2)       || ((AF) == GPIO_AF9_TIM13)      || \
 | 
				
			||||||
 | 
					                          ((AF) == GPIO_AF6_SPI3)       || ((AF) == GPIO_AF9_TIM12)      || \
 | 
				
			||||||
 | 
					                          ((AF) == GPIO_AF7_USART1)     || ((AF) == GPIO_AF7_USART2)     || \
 | 
				
			||||||
 | 
					                          ((AF) == GPIO_AF7_USART3)     || ((AF) == GPIO_AF8_UART4)      || \
 | 
				
			||||||
 | 
					                          ((AF) == GPIO_AF8_UART5)      || ((AF) == GPIO_AF8_USART6)     || \
 | 
				
			||||||
 | 
					                          ((AF) == GPIO_AF9_CAN1)       || ((AF) == GPIO_AF9_CAN2)       || \
 | 
				
			||||||
 | 
					                          ((AF) == GPIO_AF10_OTG_FS)    || ((AF) == GPIO_AF10_OTG_HS)    || \
 | 
				
			||||||
 | 
					                          ((AF) == GPIO_AF11_ETH)       || ((AF) == GPIO_AF12_OTG_HS_FS) || \
 | 
				
			||||||
 | 
					                          ((AF) == GPIO_AF12_SDIO)      || ((AF) == GPIO_AF13_DCMI)      || \
 | 
				
			||||||
 | 
					                          ((AF) == GPIO_AF12_FSMC)      || ((AF) == GPIO_AF15_EVENTOUT)) | 
				
			||||||
 | 
					#else /* STM32F207xx || STM32F217xx */ | 
				
			||||||
 | 
					#define IS_GPIO_AF(AF)   (((AF) == GPIO_AF0_RTC_50Hz)   || ((AF) == GPIO_AF9_TIM14)      || \ | 
				
			||||||
 | 
					                          ((AF) == GPIO_AF0_MCO)        || ((AF) == GPIO_AF0_TAMPER)     || \
 | 
				
			||||||
 | 
					                          ((AF) == GPIO_AF0_SWJ)        || ((AF) == GPIO_AF0_TRACE)      || \
 | 
				
			||||||
 | 
					                          ((AF) == GPIO_AF1_TIM1)       || ((AF) == GPIO_AF1_TIM2)       || \
 | 
				
			||||||
 | 
					                          ((AF) == GPIO_AF2_TIM3)       || ((AF) == GPIO_AF2_TIM4)       || \
 | 
				
			||||||
 | 
					                          ((AF) == GPIO_AF2_TIM5)       || ((AF) == GPIO_AF3_TIM8)       || \
 | 
				
			||||||
 | 
					                          ((AF) == GPIO_AF4_I2C1)       || ((AF) == GPIO_AF4_I2C2)       || \
 | 
				
			||||||
 | 
					                          ((AF) == GPIO_AF4_I2C3)       || ((AF) == GPIO_AF5_SPI1)       || \
 | 
				
			||||||
 | 
					                          ((AF) == GPIO_AF5_SPI2)       || ((AF) == GPIO_AF9_TIM13)      || \
 | 
				
			||||||
 | 
					                          ((AF) == GPIO_AF6_SPI3)       || ((AF) == GPIO_AF9_TIM12)      || \
 | 
				
			||||||
 | 
					                          ((AF) == GPIO_AF7_USART1)     || ((AF) == GPIO_AF7_USART2)     || \
 | 
				
			||||||
 | 
					                          ((AF) == GPIO_AF7_USART3)     || ((AF) == GPIO_AF8_UART4)      || \
 | 
				
			||||||
 | 
					                          ((AF) == GPIO_AF8_UART5)      || ((AF) == GPIO_AF8_USART6)     || \
 | 
				
			||||||
 | 
					                          ((AF) == GPIO_AF9_CAN1)       || ((AF) == GPIO_AF9_CAN2)       || \
 | 
				
			||||||
 | 
					                          ((AF) == GPIO_AF10_OTG_FS)    || ((AF) == GPIO_AF10_OTG_HS)    || \
 | 
				
			||||||
 | 
					                          ((AF) == GPIO_AF12_OTG_HS_FS) || ((AF) == GPIO_AF12_SDIO)      || \
 | 
				
			||||||
 | 
					                          ((AF) == GPIO_AF12_FSMC)      || ((AF) == GPIO_AF15_EVENTOUT)) | 
				
			||||||
 | 
					#endif /* STM32F207xx || STM32F217xx */ | 
				
			||||||
 | 
					                          
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					  * @} | 
				
			||||||
 | 
					  */ 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					  * @} | 
				
			||||||
 | 
					  */ | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Exported macro ------------------------------------------------------------*/ | 
				
			||||||
 | 
					/* Exported functions --------------------------------------------------------*/ 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					  * @} | 
				
			||||||
 | 
					  */ 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					  * @} | 
				
			||||||
 | 
					  */ 
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					#ifdef __cplusplus | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					#endif | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif /* __STM32F2xx_HAL_GPIO_EX_H */ | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ | 
				
			||||||
@ -0,0 +1,23 @@ | 
				
			|||||||
 | 
					void spi_init() { | 
				
			||||||
 | 
					  puts("SPI init\n"); | 
				
			||||||
 | 
					  SPI1->CR1 = SPI_CR1_SPE; | 
				
			||||||
 | 
					  SPI1->CR2 = SPI_CR2_RXNEIE | SPI_CR2_ERRIE | SPI_CR2_TXEIE; | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void spi_tx_dma(void *addr, int len) { | 
				
			||||||
 | 
					  // disable DMA
 | 
				
			||||||
 | 
					  SPI1->CR2 &= ~SPI_CR2_TXDMAEN; | 
				
			||||||
 | 
					  DMA2_Stream3->CR &= ~DMA_SxCR_EN; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // DMA2, stream 3, channel 3
 | 
				
			||||||
 | 
					  DMA2_Stream3->M0AR = addr; | 
				
			||||||
 | 
					  DMA2_Stream3->NDTR = len; | 
				
			||||||
 | 
					  DMA2_Stream3->PAR = &(SPI1->DR); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // channel3, increment memory, memory -> periph, enable
 | 
				
			||||||
 | 
					  DMA2_Stream3->CR = DMA_SxCR_CHSEL_1 | DMA_SxCR_CHSEL_0 | DMA_SxCR_MINC | DMA_SxCR_DIR_0 | DMA_SxCR_EN; | 
				
			||||||
 | 
					  DMA2_Stream3->CR |= DMA_SxCR_TCIE; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  SPI1->CR2 |= SPI_CR2_TXDMAEN; | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -0,0 +1,337 @@ | 
				
			|||||||
 | 
					#include "car.capnp.h" | 
				
			||||||
 | 
					/* AUTO GENERATED - DO NOT EDIT */ | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					cereal_CarState_ptr cereal_new_CarState(struct capn_segment *s) { | 
				
			||||||
 | 
						cereal_CarState_ptr p; | 
				
			||||||
 | 
						p.p = capn_new_struct(s, 24, 5); | 
				
			||||||
 | 
						return p; | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					cereal_CarState_list cereal_new_CarState_list(struct capn_segment *s, int len) { | 
				
			||||||
 | 
						cereal_CarState_list p; | 
				
			||||||
 | 
						p.p = capn_new_list(s, len, 24, 5); | 
				
			||||||
 | 
						return p; | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					void cereal_read_CarState(struct cereal_CarState *s, cereal_CarState_ptr p) { | 
				
			||||||
 | 
						capn_resolve(&p.p); | 
				
			||||||
 | 
						s->errors.p = capn_getp(p.p, 0, 0); | 
				
			||||||
 | 
						s->vEgo = capn_to_f32(capn_read32(p.p, 0)); | 
				
			||||||
 | 
						s->wheelSpeeds.p = capn_getp(p.p, 1, 0); | 
				
			||||||
 | 
						s->gas = capn_to_f32(capn_read32(p.p, 4)); | 
				
			||||||
 | 
						s->gasPressed = (capn_read8(p.p, 8) & 1) != 0; | 
				
			||||||
 | 
						s->brake = capn_to_f32(capn_read32(p.p, 12)); | 
				
			||||||
 | 
						s->brakePressed = (capn_read8(p.p, 8) & 2) != 0; | 
				
			||||||
 | 
						s->steeringAngle = capn_to_f32(capn_read32(p.p, 16)); | 
				
			||||||
 | 
						s->steeringTorque = capn_to_f32(capn_read32(p.p, 20)); | 
				
			||||||
 | 
						s->steeringPressed = (capn_read8(p.p, 8) & 4) != 0; | 
				
			||||||
 | 
						s->cruiseState.p = capn_getp(p.p, 2, 0); | 
				
			||||||
 | 
						s->buttonEvents.p = capn_getp(p.p, 3, 0); | 
				
			||||||
 | 
						s->canMonoTimes.p = capn_getp(p.p, 4, 0); | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					void cereal_write_CarState(const struct cereal_CarState *s, cereal_CarState_ptr p) { | 
				
			||||||
 | 
						capn_resolve(&p.p); | 
				
			||||||
 | 
						capn_setp(p.p, 0, s->errors.p); | 
				
			||||||
 | 
						capn_write32(p.p, 0, capn_from_f32(s->vEgo)); | 
				
			||||||
 | 
						capn_setp(p.p, 1, s->wheelSpeeds.p); | 
				
			||||||
 | 
						capn_write32(p.p, 4, capn_from_f32(s->gas)); | 
				
			||||||
 | 
						capn_write1(p.p, 64, s->gasPressed != 0); | 
				
			||||||
 | 
						capn_write32(p.p, 12, capn_from_f32(s->brake)); | 
				
			||||||
 | 
						capn_write1(p.p, 65, s->brakePressed != 0); | 
				
			||||||
 | 
						capn_write32(p.p, 16, capn_from_f32(s->steeringAngle)); | 
				
			||||||
 | 
						capn_write32(p.p, 20, capn_from_f32(s->steeringTorque)); | 
				
			||||||
 | 
						capn_write1(p.p, 66, s->steeringPressed != 0); | 
				
			||||||
 | 
						capn_setp(p.p, 2, s->cruiseState.p); | 
				
			||||||
 | 
						capn_setp(p.p, 3, s->buttonEvents.p); | 
				
			||||||
 | 
						capn_setp(p.p, 4, s->canMonoTimes.p); | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					void cereal_get_CarState(struct cereal_CarState *s, cereal_CarState_list l, int i) { | 
				
			||||||
 | 
						cereal_CarState_ptr p; | 
				
			||||||
 | 
						p.p = capn_getp(l.p, i, 0); | 
				
			||||||
 | 
						cereal_read_CarState(s, p); | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					void cereal_set_CarState(const struct cereal_CarState *s, cereal_CarState_list l, int i) { | 
				
			||||||
 | 
						cereal_CarState_ptr p; | 
				
			||||||
 | 
						p.p = capn_getp(l.p, i, 0); | 
				
			||||||
 | 
						cereal_write_CarState(s, p); | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					cereal_CarState_WheelSpeeds_ptr cereal_new_CarState_WheelSpeeds(struct capn_segment *s) { | 
				
			||||||
 | 
						cereal_CarState_WheelSpeeds_ptr p; | 
				
			||||||
 | 
						p.p = capn_new_struct(s, 16, 0); | 
				
			||||||
 | 
						return p; | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					cereal_CarState_WheelSpeeds_list cereal_new_CarState_WheelSpeeds_list(struct capn_segment *s, int len) { | 
				
			||||||
 | 
						cereal_CarState_WheelSpeeds_list p; | 
				
			||||||
 | 
						p.p = capn_new_list(s, len, 16, 0); | 
				
			||||||
 | 
						return p; | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					void cereal_read_CarState_WheelSpeeds(struct cereal_CarState_WheelSpeeds *s, cereal_CarState_WheelSpeeds_ptr p) { | 
				
			||||||
 | 
						capn_resolve(&p.p); | 
				
			||||||
 | 
						s->fl = capn_to_f32(capn_read32(p.p, 0)); | 
				
			||||||
 | 
						s->fr = capn_to_f32(capn_read32(p.p, 4)); | 
				
			||||||
 | 
						s->rl = capn_to_f32(capn_read32(p.p, 8)); | 
				
			||||||
 | 
						s->rr = capn_to_f32(capn_read32(p.p, 12)); | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					void cereal_write_CarState_WheelSpeeds(const struct cereal_CarState_WheelSpeeds *s, cereal_CarState_WheelSpeeds_ptr p) { | 
				
			||||||
 | 
						capn_resolve(&p.p); | 
				
			||||||
 | 
						capn_write32(p.p, 0, capn_from_f32(s->fl)); | 
				
			||||||
 | 
						capn_write32(p.p, 4, capn_from_f32(s->fr)); | 
				
			||||||
 | 
						capn_write32(p.p, 8, capn_from_f32(s->rl)); | 
				
			||||||
 | 
						capn_write32(p.p, 12, capn_from_f32(s->rr)); | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					void cereal_get_CarState_WheelSpeeds(struct cereal_CarState_WheelSpeeds *s, cereal_CarState_WheelSpeeds_list l, int i) { | 
				
			||||||
 | 
						cereal_CarState_WheelSpeeds_ptr p; | 
				
			||||||
 | 
						p.p = capn_getp(l.p, i, 0); | 
				
			||||||
 | 
						cereal_read_CarState_WheelSpeeds(s, p); | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					void cereal_set_CarState_WheelSpeeds(const struct cereal_CarState_WheelSpeeds *s, cereal_CarState_WheelSpeeds_list l, int i) { | 
				
			||||||
 | 
						cereal_CarState_WheelSpeeds_ptr p; | 
				
			||||||
 | 
						p.p = capn_getp(l.p, i, 0); | 
				
			||||||
 | 
						cereal_write_CarState_WheelSpeeds(s, p); | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					cereal_CarState_CruiseState_ptr cereal_new_CarState_CruiseState(struct capn_segment *s) { | 
				
			||||||
 | 
						cereal_CarState_CruiseState_ptr p; | 
				
			||||||
 | 
						p.p = capn_new_struct(s, 8, 0); | 
				
			||||||
 | 
						return p; | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					cereal_CarState_CruiseState_list cereal_new_CarState_CruiseState_list(struct capn_segment *s, int len) { | 
				
			||||||
 | 
						cereal_CarState_CruiseState_list p; | 
				
			||||||
 | 
						p.p = capn_new_list(s, len, 8, 0); | 
				
			||||||
 | 
						return p; | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					void cereal_read_CarState_CruiseState(struct cereal_CarState_CruiseState *s, cereal_CarState_CruiseState_ptr p) { | 
				
			||||||
 | 
						capn_resolve(&p.p); | 
				
			||||||
 | 
						s->enabled = (capn_read8(p.p, 0) & 1) != 0; | 
				
			||||||
 | 
						s->speed = capn_to_f32(capn_read32(p.p, 4)); | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					void cereal_write_CarState_CruiseState(const struct cereal_CarState_CruiseState *s, cereal_CarState_CruiseState_ptr p) { | 
				
			||||||
 | 
						capn_resolve(&p.p); | 
				
			||||||
 | 
						capn_write1(p.p, 0, s->enabled != 0); | 
				
			||||||
 | 
						capn_write32(p.p, 4, capn_from_f32(s->speed)); | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					void cereal_get_CarState_CruiseState(struct cereal_CarState_CruiseState *s, cereal_CarState_CruiseState_list l, int i) { | 
				
			||||||
 | 
						cereal_CarState_CruiseState_ptr p; | 
				
			||||||
 | 
						p.p = capn_getp(l.p, i, 0); | 
				
			||||||
 | 
						cereal_read_CarState_CruiseState(s, p); | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					void cereal_set_CarState_CruiseState(const struct cereal_CarState_CruiseState *s, cereal_CarState_CruiseState_list l, int i) { | 
				
			||||||
 | 
						cereal_CarState_CruiseState_ptr p; | 
				
			||||||
 | 
						p.p = capn_getp(l.p, i, 0); | 
				
			||||||
 | 
						cereal_write_CarState_CruiseState(s, p); | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					cereal_CarState_ButtonEvent_ptr cereal_new_CarState_ButtonEvent(struct capn_segment *s) { | 
				
			||||||
 | 
						cereal_CarState_ButtonEvent_ptr p; | 
				
			||||||
 | 
						p.p = capn_new_struct(s, 8, 0); | 
				
			||||||
 | 
						return p; | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					cereal_CarState_ButtonEvent_list cereal_new_CarState_ButtonEvent_list(struct capn_segment *s, int len) { | 
				
			||||||
 | 
						cereal_CarState_ButtonEvent_list p; | 
				
			||||||
 | 
						p.p = capn_new_list(s, len, 8, 0); | 
				
			||||||
 | 
						return p; | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					void cereal_read_CarState_ButtonEvent(struct cereal_CarState_ButtonEvent *s, cereal_CarState_ButtonEvent_ptr p) { | 
				
			||||||
 | 
						capn_resolve(&p.p); | 
				
			||||||
 | 
						s->pressed = (capn_read8(p.p, 0) & 1) != 0; | 
				
			||||||
 | 
						s->type = (enum cereal_CarState_ButtonEvent_Type)(int) capn_read16(p.p, 2); | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					void cereal_write_CarState_ButtonEvent(const struct cereal_CarState_ButtonEvent *s, cereal_CarState_ButtonEvent_ptr p) { | 
				
			||||||
 | 
						capn_resolve(&p.p); | 
				
			||||||
 | 
						capn_write1(p.p, 0, s->pressed != 0); | 
				
			||||||
 | 
						capn_write16(p.p, 2, (uint16_t) (s->type)); | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					void cereal_get_CarState_ButtonEvent(struct cereal_CarState_ButtonEvent *s, cereal_CarState_ButtonEvent_list l, int i) { | 
				
			||||||
 | 
						cereal_CarState_ButtonEvent_ptr p; | 
				
			||||||
 | 
						p.p = capn_getp(l.p, i, 0); | 
				
			||||||
 | 
						cereal_read_CarState_ButtonEvent(s, p); | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					void cereal_set_CarState_ButtonEvent(const struct cereal_CarState_ButtonEvent *s, cereal_CarState_ButtonEvent_list l, int i) { | 
				
			||||||
 | 
						cereal_CarState_ButtonEvent_ptr p; | 
				
			||||||
 | 
						p.p = capn_getp(l.p, i, 0); | 
				
			||||||
 | 
						cereal_write_CarState_ButtonEvent(s, p); | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					cereal_RadarState_ptr cereal_new_RadarState(struct capn_segment *s) { | 
				
			||||||
 | 
						cereal_RadarState_ptr p; | 
				
			||||||
 | 
						p.p = capn_new_struct(s, 0, 3); | 
				
			||||||
 | 
						return p; | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					cereal_RadarState_list cereal_new_RadarState_list(struct capn_segment *s, int len) { | 
				
			||||||
 | 
						cereal_RadarState_list p; | 
				
			||||||
 | 
						p.p = capn_new_list(s, len, 0, 3); | 
				
			||||||
 | 
						return p; | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					void cereal_read_RadarState(struct cereal_RadarState *s, cereal_RadarState_ptr p) { | 
				
			||||||
 | 
						capn_resolve(&p.p); | 
				
			||||||
 | 
						s->errors.p = capn_getp(p.p, 0, 0); | 
				
			||||||
 | 
						s->points.p = capn_getp(p.p, 1, 0); | 
				
			||||||
 | 
						s->canMonoTimes.p = capn_getp(p.p, 2, 0); | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					void cereal_write_RadarState(const struct cereal_RadarState *s, cereal_RadarState_ptr p) { | 
				
			||||||
 | 
						capn_resolve(&p.p); | 
				
			||||||
 | 
						capn_setp(p.p, 0, s->errors.p); | 
				
			||||||
 | 
						capn_setp(p.p, 1, s->points.p); | 
				
			||||||
 | 
						capn_setp(p.p, 2, s->canMonoTimes.p); | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					void cereal_get_RadarState(struct cereal_RadarState *s, cereal_RadarState_list l, int i) { | 
				
			||||||
 | 
						cereal_RadarState_ptr p; | 
				
			||||||
 | 
						p.p = capn_getp(l.p, i, 0); | 
				
			||||||
 | 
						cereal_read_RadarState(s, p); | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					void cereal_set_RadarState(const struct cereal_RadarState *s, cereal_RadarState_list l, int i) { | 
				
			||||||
 | 
						cereal_RadarState_ptr p; | 
				
			||||||
 | 
						p.p = capn_getp(l.p, i, 0); | 
				
			||||||
 | 
						cereal_write_RadarState(s, p); | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					cereal_RadarState_RadarPoint_ptr cereal_new_RadarState_RadarPoint(struct capn_segment *s) { | 
				
			||||||
 | 
						cereal_RadarState_RadarPoint_ptr p; | 
				
			||||||
 | 
						p.p = capn_new_struct(s, 32, 0); | 
				
			||||||
 | 
						return p; | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					cereal_RadarState_RadarPoint_list cereal_new_RadarState_RadarPoint_list(struct capn_segment *s, int len) { | 
				
			||||||
 | 
						cereal_RadarState_RadarPoint_list p; | 
				
			||||||
 | 
						p.p = capn_new_list(s, len, 32, 0); | 
				
			||||||
 | 
						return p; | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					void cereal_read_RadarState_RadarPoint(struct cereal_RadarState_RadarPoint *s, cereal_RadarState_RadarPoint_ptr p) { | 
				
			||||||
 | 
						capn_resolve(&p.p); | 
				
			||||||
 | 
						s->trackId = capn_read64(p.p, 0); | 
				
			||||||
 | 
						s->dRel = capn_to_f32(capn_read32(p.p, 8)); | 
				
			||||||
 | 
						s->yRel = capn_to_f32(capn_read32(p.p, 12)); | 
				
			||||||
 | 
						s->vRel = capn_to_f32(capn_read32(p.p, 16)); | 
				
			||||||
 | 
						s->aRel = capn_to_f32(capn_read32(p.p, 20)); | 
				
			||||||
 | 
						s->yvRel = capn_to_f32(capn_read32(p.p, 24)); | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					void cereal_write_RadarState_RadarPoint(const struct cereal_RadarState_RadarPoint *s, cereal_RadarState_RadarPoint_ptr p) { | 
				
			||||||
 | 
						capn_resolve(&p.p); | 
				
			||||||
 | 
						capn_write64(p.p, 0, s->trackId); | 
				
			||||||
 | 
						capn_write32(p.p, 8, capn_from_f32(s->dRel)); | 
				
			||||||
 | 
						capn_write32(p.p, 12, capn_from_f32(s->yRel)); | 
				
			||||||
 | 
						capn_write32(p.p, 16, capn_from_f32(s->vRel)); | 
				
			||||||
 | 
						capn_write32(p.p, 20, capn_from_f32(s->aRel)); | 
				
			||||||
 | 
						capn_write32(p.p, 24, capn_from_f32(s->yvRel)); | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					void cereal_get_RadarState_RadarPoint(struct cereal_RadarState_RadarPoint *s, cereal_RadarState_RadarPoint_list l, int i) { | 
				
			||||||
 | 
						cereal_RadarState_RadarPoint_ptr p; | 
				
			||||||
 | 
						p.p = capn_getp(l.p, i, 0); | 
				
			||||||
 | 
						cereal_read_RadarState_RadarPoint(s, p); | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					void cereal_set_RadarState_RadarPoint(const struct cereal_RadarState_RadarPoint *s, cereal_RadarState_RadarPoint_list l, int i) { | 
				
			||||||
 | 
						cereal_RadarState_RadarPoint_ptr p; | 
				
			||||||
 | 
						p.p = capn_getp(l.p, i, 0); | 
				
			||||||
 | 
						cereal_write_RadarState_RadarPoint(s, p); | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					cereal_CarControl_ptr cereal_new_CarControl(struct capn_segment *s) { | 
				
			||||||
 | 
						cereal_CarControl_ptr p; | 
				
			||||||
 | 
						p.p = capn_new_struct(s, 16, 2); | 
				
			||||||
 | 
						return p; | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					cereal_CarControl_list cereal_new_CarControl_list(struct capn_segment *s, int len) { | 
				
			||||||
 | 
						cereal_CarControl_list p; | 
				
			||||||
 | 
						p.p = capn_new_list(s, len, 16, 2); | 
				
			||||||
 | 
						return p; | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					void cereal_read_CarControl(struct cereal_CarControl *s, cereal_CarControl_ptr p) { | 
				
			||||||
 | 
						capn_resolve(&p.p); | 
				
			||||||
 | 
						s->enabled = (capn_read8(p.p, 0) & 1) != 0; | 
				
			||||||
 | 
						s->gas = capn_to_f32(capn_read32(p.p, 4)); | 
				
			||||||
 | 
						s->brake = capn_to_f32(capn_read32(p.p, 8)); | 
				
			||||||
 | 
						s->steeringTorque = capn_to_f32(capn_read32(p.p, 12)); | 
				
			||||||
 | 
						s->cruiseControl.p = capn_getp(p.p, 0, 0); | 
				
			||||||
 | 
						s->hudControl.p = capn_getp(p.p, 1, 0); | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					void cereal_write_CarControl(const struct cereal_CarControl *s, cereal_CarControl_ptr p) { | 
				
			||||||
 | 
						capn_resolve(&p.p); | 
				
			||||||
 | 
						capn_write1(p.p, 0, s->enabled != 0); | 
				
			||||||
 | 
						capn_write32(p.p, 4, capn_from_f32(s->gas)); | 
				
			||||||
 | 
						capn_write32(p.p, 8, capn_from_f32(s->brake)); | 
				
			||||||
 | 
						capn_write32(p.p, 12, capn_from_f32(s->steeringTorque)); | 
				
			||||||
 | 
						capn_setp(p.p, 0, s->cruiseControl.p); | 
				
			||||||
 | 
						capn_setp(p.p, 1, s->hudControl.p); | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					void cereal_get_CarControl(struct cereal_CarControl *s, cereal_CarControl_list l, int i) { | 
				
			||||||
 | 
						cereal_CarControl_ptr p; | 
				
			||||||
 | 
						p.p = capn_getp(l.p, i, 0); | 
				
			||||||
 | 
						cereal_read_CarControl(s, p); | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					void cereal_set_CarControl(const struct cereal_CarControl *s, cereal_CarControl_list l, int i) { | 
				
			||||||
 | 
						cereal_CarControl_ptr p; | 
				
			||||||
 | 
						p.p = capn_getp(l.p, i, 0); | 
				
			||||||
 | 
						cereal_write_CarControl(s, p); | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					cereal_CarControl_CruiseControl_ptr cereal_new_CarControl_CruiseControl(struct capn_segment *s) { | 
				
			||||||
 | 
						cereal_CarControl_CruiseControl_ptr p; | 
				
			||||||
 | 
						p.p = capn_new_struct(s, 16, 0); | 
				
			||||||
 | 
						return p; | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					cereal_CarControl_CruiseControl_list cereal_new_CarControl_CruiseControl_list(struct capn_segment *s, int len) { | 
				
			||||||
 | 
						cereal_CarControl_CruiseControl_list p; | 
				
			||||||
 | 
						p.p = capn_new_list(s, len, 16, 0); | 
				
			||||||
 | 
						return p; | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					void cereal_read_CarControl_CruiseControl(struct cereal_CarControl_CruiseControl *s, cereal_CarControl_CruiseControl_ptr p) { | 
				
			||||||
 | 
						capn_resolve(&p.p); | 
				
			||||||
 | 
						s->cancel = (capn_read8(p.p, 0) & 1) != 0; | 
				
			||||||
 | 
						s->override = (capn_read8(p.p, 0) & 2) != 0; | 
				
			||||||
 | 
						s->speedOverride = capn_to_f32(capn_read32(p.p, 4)); | 
				
			||||||
 | 
						s->accelOverride = capn_to_f32(capn_read32(p.p, 8)); | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					void cereal_write_CarControl_CruiseControl(const struct cereal_CarControl_CruiseControl *s, cereal_CarControl_CruiseControl_ptr p) { | 
				
			||||||
 | 
						capn_resolve(&p.p); | 
				
			||||||
 | 
						capn_write1(p.p, 0, s->cancel != 0); | 
				
			||||||
 | 
						capn_write1(p.p, 1, s->override != 0); | 
				
			||||||
 | 
						capn_write32(p.p, 4, capn_from_f32(s->speedOverride)); | 
				
			||||||
 | 
						capn_write32(p.p, 8, capn_from_f32(s->accelOverride)); | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					void cereal_get_CarControl_CruiseControl(struct cereal_CarControl_CruiseControl *s, cereal_CarControl_CruiseControl_list l, int i) { | 
				
			||||||
 | 
						cereal_CarControl_CruiseControl_ptr p; | 
				
			||||||
 | 
						p.p = capn_getp(l.p, i, 0); | 
				
			||||||
 | 
						cereal_read_CarControl_CruiseControl(s, p); | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					void cereal_set_CarControl_CruiseControl(const struct cereal_CarControl_CruiseControl *s, cereal_CarControl_CruiseControl_list l, int i) { | 
				
			||||||
 | 
						cereal_CarControl_CruiseControl_ptr p; | 
				
			||||||
 | 
						p.p = capn_getp(l.p, i, 0); | 
				
			||||||
 | 
						cereal_write_CarControl_CruiseControl(s, p); | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					cereal_CarControl_HUDControl_ptr cereal_new_CarControl_HUDControl(struct capn_segment *s) { | 
				
			||||||
 | 
						cereal_CarControl_HUDControl_ptr p; | 
				
			||||||
 | 
						p.p = capn_new_struct(s, 16, 0); | 
				
			||||||
 | 
						return p; | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					cereal_CarControl_HUDControl_list cereal_new_CarControl_HUDControl_list(struct capn_segment *s, int len) { | 
				
			||||||
 | 
						cereal_CarControl_HUDControl_list p; | 
				
			||||||
 | 
						p.p = capn_new_list(s, len, 16, 0); | 
				
			||||||
 | 
						return p; | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					void cereal_read_CarControl_HUDControl(struct cereal_CarControl_HUDControl *s, cereal_CarControl_HUDControl_ptr p) { | 
				
			||||||
 | 
						capn_resolve(&p.p); | 
				
			||||||
 | 
						s->speedVisible = (capn_read8(p.p, 0) & 1) != 0; | 
				
			||||||
 | 
						s->setSpeed = capn_to_f32(capn_read32(p.p, 4)); | 
				
			||||||
 | 
						s->lanesVisible = (capn_read8(p.p, 0) & 2) != 0; | 
				
			||||||
 | 
						s->leadVisible = (capn_read8(p.p, 0) & 4) != 0; | 
				
			||||||
 | 
						s->visualAlert = (enum cereal_CarControl_HUDControl_VisualAlert)(int) capn_read16(p.p, 2); | 
				
			||||||
 | 
						s->audibleAlert = (enum cereal_CarControl_HUDControl_AudibleAlert)(int) capn_read16(p.p, 8); | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					void cereal_write_CarControl_HUDControl(const struct cereal_CarControl_HUDControl *s, cereal_CarControl_HUDControl_ptr p) { | 
				
			||||||
 | 
						capn_resolve(&p.p); | 
				
			||||||
 | 
						capn_write1(p.p, 0, s->speedVisible != 0); | 
				
			||||||
 | 
						capn_write32(p.p, 4, capn_from_f32(s->setSpeed)); | 
				
			||||||
 | 
						capn_write1(p.p, 1, s->lanesVisible != 0); | 
				
			||||||
 | 
						capn_write1(p.p, 2, s->leadVisible != 0); | 
				
			||||||
 | 
						capn_write16(p.p, 2, (uint16_t) (s->visualAlert)); | 
				
			||||||
 | 
						capn_write16(p.p, 8, (uint16_t) (s->audibleAlert)); | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					void cereal_get_CarControl_HUDControl(struct cereal_CarControl_HUDControl *s, cereal_CarControl_HUDControl_list l, int i) { | 
				
			||||||
 | 
						cereal_CarControl_HUDControl_ptr p; | 
				
			||||||
 | 
						p.p = capn_getp(l.p, i, 0); | 
				
			||||||
 | 
						cereal_read_CarControl_HUDControl(s, p); | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					void cereal_set_CarControl_HUDControl(const struct cereal_CarControl_HUDControl *s, cereal_CarControl_HUDControl_list l, int i) { | 
				
			||||||
 | 
						cereal_CarControl_HUDControl_ptr p; | 
				
			||||||
 | 
						p.p = capn_getp(l.p, i, 0); | 
				
			||||||
 | 
						cereal_write_CarControl_HUDControl(s, p); | 
				
			||||||
 | 
					} | 
				
			||||||
@ -0,0 +1,287 @@ | 
				
			|||||||
 | 
					#ifndef CAPN_8E2AF1E78AF8B8D | 
				
			||||||
 | 
					#define CAPN_8E2AF1E78AF8B8D | 
				
			||||||
 | 
					/* AUTO GENERATED - DO NOT EDIT */ | 
				
			||||||
 | 
					#include <capnp_c.h> | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if CAPN_VERSION != 1 | 
				
			||||||
 | 
					#error "version mismatch between capnp_c.h and generated code" | 
				
			||||||
 | 
					#endif | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "c++.capnp.h" | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef __cplusplus | 
				
			||||||
 | 
					extern "C" { | 
				
			||||||
 | 
					#endif | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct cereal_CarState; | 
				
			||||||
 | 
					struct cereal_CarState_WheelSpeeds; | 
				
			||||||
 | 
					struct cereal_CarState_CruiseState; | 
				
			||||||
 | 
					struct cereal_CarState_ButtonEvent; | 
				
			||||||
 | 
					struct cereal_RadarState; | 
				
			||||||
 | 
					struct cereal_RadarState_RadarPoint; | 
				
			||||||
 | 
					struct cereal_CarControl; | 
				
			||||||
 | 
					struct cereal_CarControl_CruiseControl; | 
				
			||||||
 | 
					struct cereal_CarControl_HUDControl; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					typedef struct {capn_ptr p;} cereal_CarState_ptr; | 
				
			||||||
 | 
					typedef struct {capn_ptr p;} cereal_CarState_WheelSpeeds_ptr; | 
				
			||||||
 | 
					typedef struct {capn_ptr p;} cereal_CarState_CruiseState_ptr; | 
				
			||||||
 | 
					typedef struct {capn_ptr p;} cereal_CarState_ButtonEvent_ptr; | 
				
			||||||
 | 
					typedef struct {capn_ptr p;} cereal_RadarState_ptr; | 
				
			||||||
 | 
					typedef struct {capn_ptr p;} cereal_RadarState_RadarPoint_ptr; | 
				
			||||||
 | 
					typedef struct {capn_ptr p;} cereal_CarControl_ptr; | 
				
			||||||
 | 
					typedef struct {capn_ptr p;} cereal_CarControl_CruiseControl_ptr; | 
				
			||||||
 | 
					typedef struct {capn_ptr p;} cereal_CarControl_HUDControl_ptr; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					typedef struct {capn_ptr p;} cereal_CarState_list; | 
				
			||||||
 | 
					typedef struct {capn_ptr p;} cereal_CarState_WheelSpeeds_list; | 
				
			||||||
 | 
					typedef struct {capn_ptr p;} cereal_CarState_CruiseState_list; | 
				
			||||||
 | 
					typedef struct {capn_ptr p;} cereal_CarState_ButtonEvent_list; | 
				
			||||||
 | 
					typedef struct {capn_ptr p;} cereal_RadarState_list; | 
				
			||||||
 | 
					typedef struct {capn_ptr p;} cereal_RadarState_RadarPoint_list; | 
				
			||||||
 | 
					typedef struct {capn_ptr p;} cereal_CarControl_list; | 
				
			||||||
 | 
					typedef struct {capn_ptr p;} cereal_CarControl_CruiseControl_list; | 
				
			||||||
 | 
					typedef struct {capn_ptr p;} cereal_CarControl_HUDControl_list; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					enum cereal_CarState_Error { | 
				
			||||||
 | 
						cereal_CarState_Error_commIssue = 0, | 
				
			||||||
 | 
						cereal_CarState_Error_steerUnavailable = 1, | 
				
			||||||
 | 
						cereal_CarState_Error_brakeUnavailable = 2, | 
				
			||||||
 | 
						cereal_CarState_Error_gasUnavailable = 3, | 
				
			||||||
 | 
						cereal_CarState_Error_wrongGear = 4, | 
				
			||||||
 | 
						cereal_CarState_Error_doorOpen = 5, | 
				
			||||||
 | 
						cereal_CarState_Error_seatbeltNotLatched = 6, | 
				
			||||||
 | 
						cereal_CarState_Error_espDisabled = 7, | 
				
			||||||
 | 
						cereal_CarState_Error_wrongCarMode = 8, | 
				
			||||||
 | 
						cereal_CarState_Error_steerTemporarilyUnavailable = 9, | 
				
			||||||
 | 
						cereal_CarState_Error_reverseGear = 10 | 
				
			||||||
 | 
					}; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					enum cereal_CarState_ButtonEvent_Type { | 
				
			||||||
 | 
						cereal_CarState_ButtonEvent_Type_unknown = 0, | 
				
			||||||
 | 
						cereal_CarState_ButtonEvent_Type_leftBlinker = 1, | 
				
			||||||
 | 
						cereal_CarState_ButtonEvent_Type_rightBlinker = 2, | 
				
			||||||
 | 
						cereal_CarState_ButtonEvent_Type_accelCruise = 3, | 
				
			||||||
 | 
						cereal_CarState_ButtonEvent_Type_decelCruise = 4, | 
				
			||||||
 | 
						cereal_CarState_ButtonEvent_Type_cancel = 5, | 
				
			||||||
 | 
						cereal_CarState_ButtonEvent_Type_altButton1 = 6, | 
				
			||||||
 | 
						cereal_CarState_ButtonEvent_Type_altButton2 = 7, | 
				
			||||||
 | 
						cereal_CarState_ButtonEvent_Type_altButton3 = 8 | 
				
			||||||
 | 
					}; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					enum cereal_RadarState_Error { | 
				
			||||||
 | 
						cereal_RadarState_Error_notValid = 0 | 
				
			||||||
 | 
					}; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					enum cereal_CarControl_HUDControl_VisualAlert { | 
				
			||||||
 | 
						cereal_CarControl_HUDControl_VisualAlert_none = 0, | 
				
			||||||
 | 
						cereal_CarControl_HUDControl_VisualAlert_fcw = 1, | 
				
			||||||
 | 
						cereal_CarControl_HUDControl_VisualAlert_steerRequired = 2, | 
				
			||||||
 | 
						cereal_CarControl_HUDControl_VisualAlert_brakePressed = 3, | 
				
			||||||
 | 
						cereal_CarControl_HUDControl_VisualAlert_wrongGear = 4, | 
				
			||||||
 | 
						cereal_CarControl_HUDControl_VisualAlert_seatbeltUnbuckled = 5, | 
				
			||||||
 | 
						cereal_CarControl_HUDControl_VisualAlert_speedTooHigh = 6 | 
				
			||||||
 | 
					}; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					enum cereal_CarControl_HUDControl_AudibleAlert { | 
				
			||||||
 | 
						cereal_CarControl_HUDControl_AudibleAlert_none = 0, | 
				
			||||||
 | 
						cereal_CarControl_HUDControl_AudibleAlert_beepSingle = 1, | 
				
			||||||
 | 
						cereal_CarControl_HUDControl_AudibleAlert_beepTriple = 2, | 
				
			||||||
 | 
						cereal_CarControl_HUDControl_AudibleAlert_beepRepeated = 3, | 
				
			||||||
 | 
						cereal_CarControl_HUDControl_AudibleAlert_chimeSingle = 4, | 
				
			||||||
 | 
						cereal_CarControl_HUDControl_AudibleAlert_chimeDouble = 5, | 
				
			||||||
 | 
						cereal_CarControl_HUDControl_AudibleAlert_chimeRepeated = 6, | 
				
			||||||
 | 
						cereal_CarControl_HUDControl_AudibleAlert_chimeContinuous = 7 | 
				
			||||||
 | 
					}; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct cereal_CarState { | 
				
			||||||
 | 
						capn_list16 errors; | 
				
			||||||
 | 
						float vEgo; | 
				
			||||||
 | 
						cereal_CarState_WheelSpeeds_ptr wheelSpeeds; | 
				
			||||||
 | 
						float gas; | 
				
			||||||
 | 
						unsigned gasPressed : 1; | 
				
			||||||
 | 
						float brake; | 
				
			||||||
 | 
						unsigned brakePressed : 1; | 
				
			||||||
 | 
						float steeringAngle; | 
				
			||||||
 | 
						float steeringTorque; | 
				
			||||||
 | 
						unsigned steeringPressed : 1; | 
				
			||||||
 | 
						cereal_CarState_CruiseState_ptr cruiseState; | 
				
			||||||
 | 
						cereal_CarState_ButtonEvent_list buttonEvents; | 
				
			||||||
 | 
						capn_list64 canMonoTimes; | 
				
			||||||
 | 
					}; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static const size_t cereal_CarState_word_count = 3; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static const size_t cereal_CarState_pointer_count = 5; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static const size_t cereal_CarState_struct_bytes_count = 64; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct cereal_CarState_WheelSpeeds { | 
				
			||||||
 | 
						float fl; | 
				
			||||||
 | 
						float fr; | 
				
			||||||
 | 
						float rl; | 
				
			||||||
 | 
						float rr; | 
				
			||||||
 | 
					}; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static const size_t cereal_CarState_WheelSpeeds_word_count = 2; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static const size_t cereal_CarState_WheelSpeeds_pointer_count = 0; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static const size_t cereal_CarState_WheelSpeeds_struct_bytes_count = 16; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct cereal_CarState_CruiseState { | 
				
			||||||
 | 
						unsigned enabled : 1; | 
				
			||||||
 | 
						float speed; | 
				
			||||||
 | 
					}; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static const size_t cereal_CarState_CruiseState_word_count = 1; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static const size_t cereal_CarState_CruiseState_pointer_count = 0; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static const size_t cereal_CarState_CruiseState_struct_bytes_count = 8; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct cereal_CarState_ButtonEvent { | 
				
			||||||
 | 
						unsigned pressed : 1; | 
				
			||||||
 | 
						enum cereal_CarState_ButtonEvent_Type type; | 
				
			||||||
 | 
					}; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static const size_t cereal_CarState_ButtonEvent_word_count = 1; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static const size_t cereal_CarState_ButtonEvent_pointer_count = 0; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static const size_t cereal_CarState_ButtonEvent_struct_bytes_count = 8; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct cereal_RadarState { | 
				
			||||||
 | 
						capn_list16 errors; | 
				
			||||||
 | 
						cereal_RadarState_RadarPoint_list points; | 
				
			||||||
 | 
						capn_list64 canMonoTimes; | 
				
			||||||
 | 
					}; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static const size_t cereal_RadarState_word_count = 0; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static const size_t cereal_RadarState_pointer_count = 3; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static const size_t cereal_RadarState_struct_bytes_count = 24; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct cereal_RadarState_RadarPoint { | 
				
			||||||
 | 
						uint64_t trackId; | 
				
			||||||
 | 
						float dRel; | 
				
			||||||
 | 
						float yRel; | 
				
			||||||
 | 
						float vRel; | 
				
			||||||
 | 
						float aRel; | 
				
			||||||
 | 
						float yvRel; | 
				
			||||||
 | 
					}; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static const size_t cereal_RadarState_RadarPoint_word_count = 4; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static const size_t cereal_RadarState_RadarPoint_pointer_count = 0; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static const size_t cereal_RadarState_RadarPoint_struct_bytes_count = 32; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct cereal_CarControl { | 
				
			||||||
 | 
						unsigned enabled : 1; | 
				
			||||||
 | 
						float gas; | 
				
			||||||
 | 
						float brake; | 
				
			||||||
 | 
						float steeringTorque; | 
				
			||||||
 | 
						cereal_CarControl_CruiseControl_ptr cruiseControl; | 
				
			||||||
 | 
						cereal_CarControl_HUDControl_ptr hudControl; | 
				
			||||||
 | 
					}; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static const size_t cereal_CarControl_word_count = 2; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static const size_t cereal_CarControl_pointer_count = 2; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static const size_t cereal_CarControl_struct_bytes_count = 32; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct cereal_CarControl_CruiseControl { | 
				
			||||||
 | 
						unsigned cancel : 1; | 
				
			||||||
 | 
						unsigned override : 1; | 
				
			||||||
 | 
						float speedOverride; | 
				
			||||||
 | 
						float accelOverride; | 
				
			||||||
 | 
					}; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static const size_t cereal_CarControl_CruiseControl_word_count = 2; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static const size_t cereal_CarControl_CruiseControl_pointer_count = 0; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static const size_t cereal_CarControl_CruiseControl_struct_bytes_count = 16; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct cereal_CarControl_HUDControl { | 
				
			||||||
 | 
						unsigned speedVisible : 1; | 
				
			||||||
 | 
						float setSpeed; | 
				
			||||||
 | 
						unsigned lanesVisible : 1; | 
				
			||||||
 | 
						unsigned leadVisible : 1; | 
				
			||||||
 | 
						enum cereal_CarControl_HUDControl_VisualAlert visualAlert; | 
				
			||||||
 | 
						enum cereal_CarControl_HUDControl_AudibleAlert audibleAlert; | 
				
			||||||
 | 
					}; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static const size_t cereal_CarControl_HUDControl_word_count = 2; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static const size_t cereal_CarControl_HUDControl_pointer_count = 0; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static const size_t cereal_CarControl_HUDControl_struct_bytes_count = 16; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					cereal_CarState_ptr cereal_new_CarState(struct capn_segment*); | 
				
			||||||
 | 
					cereal_CarState_WheelSpeeds_ptr cereal_new_CarState_WheelSpeeds(struct capn_segment*); | 
				
			||||||
 | 
					cereal_CarState_CruiseState_ptr cereal_new_CarState_CruiseState(struct capn_segment*); | 
				
			||||||
 | 
					cereal_CarState_ButtonEvent_ptr cereal_new_CarState_ButtonEvent(struct capn_segment*); | 
				
			||||||
 | 
					cereal_RadarState_ptr cereal_new_RadarState(struct capn_segment*); | 
				
			||||||
 | 
					cereal_RadarState_RadarPoint_ptr cereal_new_RadarState_RadarPoint(struct capn_segment*); | 
				
			||||||
 | 
					cereal_CarControl_ptr cereal_new_CarControl(struct capn_segment*); | 
				
			||||||
 | 
					cereal_CarControl_CruiseControl_ptr cereal_new_CarControl_CruiseControl(struct capn_segment*); | 
				
			||||||
 | 
					cereal_CarControl_HUDControl_ptr cereal_new_CarControl_HUDControl(struct capn_segment*); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					cereal_CarState_list cereal_new_CarState_list(struct capn_segment*, int len); | 
				
			||||||
 | 
					cereal_CarState_WheelSpeeds_list cereal_new_CarState_WheelSpeeds_list(struct capn_segment*, int len); | 
				
			||||||
 | 
					cereal_CarState_CruiseState_list cereal_new_CarState_CruiseState_list(struct capn_segment*, int len); | 
				
			||||||
 | 
					cereal_CarState_ButtonEvent_list cereal_new_CarState_ButtonEvent_list(struct capn_segment*, int len); | 
				
			||||||
 | 
					cereal_RadarState_list cereal_new_RadarState_list(struct capn_segment*, int len); | 
				
			||||||
 | 
					cereal_RadarState_RadarPoint_list cereal_new_RadarState_RadarPoint_list(struct capn_segment*, int len); | 
				
			||||||
 | 
					cereal_CarControl_list cereal_new_CarControl_list(struct capn_segment*, int len); | 
				
			||||||
 | 
					cereal_CarControl_CruiseControl_list cereal_new_CarControl_CruiseControl_list(struct capn_segment*, int len); | 
				
			||||||
 | 
					cereal_CarControl_HUDControl_list cereal_new_CarControl_HUDControl_list(struct capn_segment*, int len); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void cereal_read_CarState(struct cereal_CarState*, cereal_CarState_ptr); | 
				
			||||||
 | 
					void cereal_read_CarState_WheelSpeeds(struct cereal_CarState_WheelSpeeds*, cereal_CarState_WheelSpeeds_ptr); | 
				
			||||||
 | 
					void cereal_read_CarState_CruiseState(struct cereal_CarState_CruiseState*, cereal_CarState_CruiseState_ptr); | 
				
			||||||
 | 
					void cereal_read_CarState_ButtonEvent(struct cereal_CarState_ButtonEvent*, cereal_CarState_ButtonEvent_ptr); | 
				
			||||||
 | 
					void cereal_read_RadarState(struct cereal_RadarState*, cereal_RadarState_ptr); | 
				
			||||||
 | 
					void cereal_read_RadarState_RadarPoint(struct cereal_RadarState_RadarPoint*, cereal_RadarState_RadarPoint_ptr); | 
				
			||||||
 | 
					void cereal_read_CarControl(struct cereal_CarControl*, cereal_CarControl_ptr); | 
				
			||||||
 | 
					void cereal_read_CarControl_CruiseControl(struct cereal_CarControl_CruiseControl*, cereal_CarControl_CruiseControl_ptr); | 
				
			||||||
 | 
					void cereal_read_CarControl_HUDControl(struct cereal_CarControl_HUDControl*, cereal_CarControl_HUDControl_ptr); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void cereal_write_CarState(const struct cereal_CarState*, cereal_CarState_ptr); | 
				
			||||||
 | 
					void cereal_write_CarState_WheelSpeeds(const struct cereal_CarState_WheelSpeeds*, cereal_CarState_WheelSpeeds_ptr); | 
				
			||||||
 | 
					void cereal_write_CarState_CruiseState(const struct cereal_CarState_CruiseState*, cereal_CarState_CruiseState_ptr); | 
				
			||||||
 | 
					void cereal_write_CarState_ButtonEvent(const struct cereal_CarState_ButtonEvent*, cereal_CarState_ButtonEvent_ptr); | 
				
			||||||
 | 
					void cereal_write_RadarState(const struct cereal_RadarState*, cereal_RadarState_ptr); | 
				
			||||||
 | 
					void cereal_write_RadarState_RadarPoint(const struct cereal_RadarState_RadarPoint*, cereal_RadarState_RadarPoint_ptr); | 
				
			||||||
 | 
					void cereal_write_CarControl(const struct cereal_CarControl*, cereal_CarControl_ptr); | 
				
			||||||
 | 
					void cereal_write_CarControl_CruiseControl(const struct cereal_CarControl_CruiseControl*, cereal_CarControl_CruiseControl_ptr); | 
				
			||||||
 | 
					void cereal_write_CarControl_HUDControl(const struct cereal_CarControl_HUDControl*, cereal_CarControl_HUDControl_ptr); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void cereal_get_CarState(struct cereal_CarState*, cereal_CarState_list, int i); | 
				
			||||||
 | 
					void cereal_get_CarState_WheelSpeeds(struct cereal_CarState_WheelSpeeds*, cereal_CarState_WheelSpeeds_list, int i); | 
				
			||||||
 | 
					void cereal_get_CarState_CruiseState(struct cereal_CarState_CruiseState*, cereal_CarState_CruiseState_list, int i); | 
				
			||||||
 | 
					void cereal_get_CarState_ButtonEvent(struct cereal_CarState_ButtonEvent*, cereal_CarState_ButtonEvent_list, int i); | 
				
			||||||
 | 
					void cereal_get_RadarState(struct cereal_RadarState*, cereal_RadarState_list, int i); | 
				
			||||||
 | 
					void cereal_get_RadarState_RadarPoint(struct cereal_RadarState_RadarPoint*, cereal_RadarState_RadarPoint_list, int i); | 
				
			||||||
 | 
					void cereal_get_CarControl(struct cereal_CarControl*, cereal_CarControl_list, int i); | 
				
			||||||
 | 
					void cereal_get_CarControl_CruiseControl(struct cereal_CarControl_CruiseControl*, cereal_CarControl_CruiseControl_list, int i); | 
				
			||||||
 | 
					void cereal_get_CarControl_HUDControl(struct cereal_CarControl_HUDControl*, cereal_CarControl_HUDControl_list, int i); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void cereal_set_CarState(const struct cereal_CarState*, cereal_CarState_list, int i); | 
				
			||||||
 | 
					void cereal_set_CarState_WheelSpeeds(const struct cereal_CarState_WheelSpeeds*, cereal_CarState_WheelSpeeds_list, int i); | 
				
			||||||
 | 
					void cereal_set_CarState_CruiseState(const struct cereal_CarState_CruiseState*, cereal_CarState_CruiseState_list, int i); | 
				
			||||||
 | 
					void cereal_set_CarState_ButtonEvent(const struct cereal_CarState_ButtonEvent*, cereal_CarState_ButtonEvent_list, int i); | 
				
			||||||
 | 
					void cereal_set_RadarState(const struct cereal_RadarState*, cereal_RadarState_list, int i); | 
				
			||||||
 | 
					void cereal_set_RadarState_RadarPoint(const struct cereal_RadarState_RadarPoint*, cereal_RadarState_RadarPoint_list, int i); | 
				
			||||||
 | 
					void cereal_set_CarControl(const struct cereal_CarControl*, cereal_CarControl_list, int i); | 
				
			||||||
 | 
					void cereal_set_CarControl_CruiseControl(const struct cereal_CarControl_CruiseControl*, cereal_CarControl_CruiseControl_list, int i); | 
				
			||||||
 | 
					void cereal_set_CarControl_HUDControl(const struct cereal_CarControl_HUDControl*, cereal_CarControl_HUDControl_list, int i); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef __cplusplus | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					#endif | 
				
			||||||
 | 
					#endif | 
				
			||||||
									
										
											File diff suppressed because it is too large
											Load Diff
										
									
								
							
						
									
										
											File diff suppressed because it is too large
											Load Diff
										
									
								
							
						@ -1,26 +0,0 @@ | 
				
			|||||||
#!/usr/bin/bash | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# enable wifi access point for debugging only! | 
					 | 
				
			||||||
#service call wifi 37 i32 0 i32 1 # WifiService.setWifiApEnabled(null, true) | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# check out the openpilot repo | 
					 | 
				
			||||||
if [ ! -d /data/openpilot ]; then | 
					 | 
				
			||||||
  cd /tmp | 
					 | 
				
			||||||
  git clone https://github.com/commaai/openpilot.git -b release | 
					 | 
				
			||||||
  mv /tmp/openpilot /data/openpilot | 
					 | 
				
			||||||
fi | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# enter openpilot directory | 
					 | 
				
			||||||
cd /data/openpilot | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# automatic update | 
					 | 
				
			||||||
git pull | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# start manager | 
					 | 
				
			||||||
cd selfdrive | 
					 | 
				
			||||||
mkdir -p /sdcard/realdata | 
					 | 
				
			||||||
PYTHONPATH=/data/openpilot ./manager.py | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# if broken, keep on screen error | 
					 | 
				
			||||||
while true; do sleep 1; done | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@ -1,7 +0,0 @@ | 
				
			|||||||
#!/bin/bash | 
					 | 
				
			||||||
set -e | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# moving continue into place runs the continue script | 
					 | 
				
			||||||
adb push files/continue.sh /tmp/continue.sh | 
					 | 
				
			||||||
adb shell mv /tmp/continue.sh /data/data/com.termux/files/ | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
									
										
											File diff suppressed because it is too large
											Load Diff
										
									
								
							
						@ -0,0 +1,117 @@ | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
					  Copyright (C) 2011 Joseph A. Adams (joeyadams3.14159@gmail.com) | 
				
			||||||
 | 
					  All rights reserved. | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Permission is hereby granted, free of charge, to any person obtaining a copy | 
				
			||||||
 | 
					  of this software and associated documentation files (the "Software"), to deal | 
				
			||||||
 | 
					  in the Software without restriction, including without limitation the rights | 
				
			||||||
 | 
					  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | 
				
			||||||
 | 
					  copies of the Software, and to permit persons to whom the Software is | 
				
			||||||
 | 
					  furnished to do so, subject to the following conditions: | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  The above copyright notice and this permission notice shall be included in | 
				
			||||||
 | 
					  all copies or substantial portions of the Software. | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 
				
			||||||
 | 
					  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 
				
			||||||
 | 
					  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 
				
			||||||
 | 
					  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | 
				
			||||||
 | 
					  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | 
				
			||||||
 | 
					  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | 
				
			||||||
 | 
					  THE SOFTWARE. | 
				
			||||||
 | 
					*/ | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef CCAN_JSON_H | 
				
			||||||
 | 
					#define CCAN_JSON_H | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <stdbool.h> | 
				
			||||||
 | 
					#include <stddef.h> | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					typedef enum { | 
				
			||||||
 | 
						JSON_NULL, | 
				
			||||||
 | 
						JSON_BOOL, | 
				
			||||||
 | 
						JSON_STRING, | 
				
			||||||
 | 
						JSON_NUMBER, | 
				
			||||||
 | 
						JSON_ARRAY, | 
				
			||||||
 | 
						JSON_OBJECT, | 
				
			||||||
 | 
					} JsonTag; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					typedef struct JsonNode JsonNode; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct JsonNode | 
				
			||||||
 | 
					{ | 
				
			||||||
 | 
						/* only if parent is an object or array (NULL otherwise) */ | 
				
			||||||
 | 
						JsonNode *parent; | 
				
			||||||
 | 
						JsonNode *prev, *next; | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						/* only if parent is an object (NULL otherwise) */ | 
				
			||||||
 | 
						char *key; /* Must be valid UTF-8. */ | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						JsonTag tag; | 
				
			||||||
 | 
						union { | 
				
			||||||
 | 
							/* JSON_BOOL */ | 
				
			||||||
 | 
							bool bool_; | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							/* JSON_STRING */ | 
				
			||||||
 | 
							char *string_; /* Must be valid UTF-8. */ | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							/* JSON_NUMBER */ | 
				
			||||||
 | 
							double number_; | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							/* JSON_ARRAY */ | 
				
			||||||
 | 
							/* JSON_OBJECT */ | 
				
			||||||
 | 
							struct { | 
				
			||||||
 | 
								JsonNode *head, *tail; | 
				
			||||||
 | 
							} children; | 
				
			||||||
 | 
						}; | 
				
			||||||
 | 
					}; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*** Encoding, decoding, and validation ***/ | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					JsonNode   *json_decode         (const char *json); | 
				
			||||||
 | 
					char       *json_encode         (const JsonNode *node); | 
				
			||||||
 | 
					char       *json_encode_string  (const char *str); | 
				
			||||||
 | 
					char       *json_stringify      (const JsonNode *node, const char *space); | 
				
			||||||
 | 
					void        json_delete         (JsonNode *node); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bool        json_validate       (const char *json); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*** Lookup and traversal ***/ | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					JsonNode   *json_find_element   (JsonNode *array, int index); | 
				
			||||||
 | 
					JsonNode   *json_find_member    (JsonNode *object, const char *key); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					JsonNode   *json_first_child    (const JsonNode *node); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define json_foreach(i, object_or_array)            \ | 
				
			||||||
 | 
						for ((i) = json_first_child(object_or_array);   \
 | 
				
			||||||
 | 
							 (i) != NULL;                               \
 | 
				
			||||||
 | 
							 (i) = (i)->next) | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*** Construction and manipulation ***/ | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					JsonNode *json_mknull(void); | 
				
			||||||
 | 
					JsonNode *json_mkbool(bool b); | 
				
			||||||
 | 
					JsonNode *json_mkstring(const char *s); | 
				
			||||||
 | 
					JsonNode *json_mknumber(double n); | 
				
			||||||
 | 
					JsonNode *json_mkarray(void); | 
				
			||||||
 | 
					JsonNode *json_mkobject(void); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void json_append_element(JsonNode *array, JsonNode *element); | 
				
			||||||
 | 
					void json_prepend_element(JsonNode *array, JsonNode *element); | 
				
			||||||
 | 
					void json_append_member(JsonNode *object, const char *key, JsonNode *value); | 
				
			||||||
 | 
					void json_prepend_member(JsonNode *object, const char *key, JsonNode *value); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void json_remove_from_parent(JsonNode *node); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*** Debugging ***/ | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * Look for structure and encoding problems in a JsonNode or its descendents. | 
				
			||||||
 | 
					 * | 
				
			||||||
 | 
					 * If a problem is detected, return false, writing a description of the problem | 
				
			||||||
 | 
					 * to errmsg (unless errmsg is NULL). | 
				
			||||||
 | 
					 */ | 
				
			||||||
 | 
					bool json_check(const JsonNode *node, char errmsg[256]); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif | 
				
			||||||
@ -0,0 +1,17 @@ | 
				
			|||||||
 | 
					CEREAL_CFLAGS = -I$(PHONELIBS)/capnp-c/include
 | 
				
			||||||
 | 
					CEREAL_CXXFLAGS = -I$(PHONELIBS)/capnp-cpp/include
 | 
				
			||||||
 | 
					CEREAL_LIBS = -L$(PHONELIBS)/capnp-cpp/aarch64/lib/ \
 | 
				
			||||||
 | 
					              -L$(PHONELIBS)/capnp-c/aarch64/lib/ \
 | 
				
			||||||
 | 
					              -l:libcapn.a -l:libcapnp.a -l:libkj.a
 | 
				
			||||||
 | 
					CEREAL_OBJS = ../../cereal/gen/c/log.capnp.o ../../cereal/gen/c/car.capnp.o
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					log.capnp.o: ../../cereal/gen/cpp/log.capnp.c++ | 
				
			||||||
 | 
						@echo "[ CXX ] $@"
 | 
				
			||||||
 | 
						$(CXX) $(CXXFLAGS) $(CEREAL_CFLAGS) \
 | 
				
			||||||
 | 
					           -c -o '$@' '$<'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					car.capnp.o: ../../cereal/gen/cpp/car.capnp.c++ | 
				
			||||||
 | 
						@echo "[ CXX ] $@"
 | 
				
			||||||
 | 
						$(CXX) $(CXXFLAGS) $(CEREAL_CFLAGS) \
 | 
				
			||||||
 | 
					           -c -o '$@' '$<'
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
@ -0,0 +1,71 @@ | 
				
			|||||||
 | 
					#include <stdlib.h> | 
				
			||||||
 | 
					#include <stdio.h> | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <GLES3/gl3.h> | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "glutil.h" | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					GLuint load_shader(GLenum shaderType, const char *src) { | 
				
			||||||
 | 
					  GLint status = 0, len = 0; | 
				
			||||||
 | 
					  GLuint shader; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (!(shader = glCreateShader(shaderType))) | 
				
			||||||
 | 
					    return 0; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  glShaderSource(shader, 1, &src, NULL); | 
				
			||||||
 | 
					  glCompileShader(shader); | 
				
			||||||
 | 
					  glGetShaderiv(shader, GL_COMPILE_STATUS, &status); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (status) | 
				
			||||||
 | 
					    return shader; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &len); | 
				
			||||||
 | 
					  if (len) { | 
				
			||||||
 | 
					    char *msg = (char*)malloc(len); | 
				
			||||||
 | 
					    if (msg) { | 
				
			||||||
 | 
					      glGetShaderInfoLog(shader, len, NULL, msg); | 
				
			||||||
 | 
					      msg[len-1] = 0; | 
				
			||||||
 | 
					      fprintf(stderr, "error compiling shader:\n%s\n", msg); | 
				
			||||||
 | 
					      free(msg); | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					  } | 
				
			||||||
 | 
					  glDeleteShader(shader); | 
				
			||||||
 | 
					  return 0; | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					GLuint load_program(const char *vert_src, const char *frag_src) { | 
				
			||||||
 | 
					  GLuint vert, frag, prog; | 
				
			||||||
 | 
					  GLint status = 0, len = 0; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (!(vert = load_shader(GL_VERTEX_SHADER, vert_src))) | 
				
			||||||
 | 
					    return 0; | 
				
			||||||
 | 
					  if (!(frag = load_shader(GL_FRAGMENT_SHADER, frag_src))) | 
				
			||||||
 | 
					    goto fail_frag; | 
				
			||||||
 | 
					  if (!(prog = glCreateProgram())) | 
				
			||||||
 | 
					    goto fail_prog; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  glAttachShader(prog, vert); | 
				
			||||||
 | 
					  glAttachShader(prog, frag); | 
				
			||||||
 | 
					  glLinkProgram(prog); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  glGetProgramiv(prog, GL_LINK_STATUS, &status); | 
				
			||||||
 | 
					  if (status) | 
				
			||||||
 | 
					    return prog; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  glGetProgramiv(prog, GL_INFO_LOG_LENGTH, &len); | 
				
			||||||
 | 
					  if (len) { | 
				
			||||||
 | 
					    char *buf = (char*) malloc(len); | 
				
			||||||
 | 
					    if (buf) { | 
				
			||||||
 | 
					      glGetProgramInfoLog(prog, len, NULL, buf); | 
				
			||||||
 | 
					      buf[len-1] = 0; | 
				
			||||||
 | 
					      fprintf(stderr, "error linking program:\n%s\n", buf); | 
				
			||||||
 | 
					      free(buf); | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					  } | 
				
			||||||
 | 
					  glDeleteProgram(prog); | 
				
			||||||
 | 
					fail_prog: | 
				
			||||||
 | 
					  glDeleteShader(frag); | 
				
			||||||
 | 
					fail_frag: | 
				
			||||||
 | 
					  glDeleteShader(vert); | 
				
			||||||
 | 
					  return 0; | 
				
			||||||
 | 
					} | 
				
			||||||
@ -0,0 +1,8 @@ | 
				
			|||||||
 | 
					#ifndef COMMON_GLUTIL_H | 
				
			||||||
 | 
					#define COMMON_GLUTIL_H | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <GLES3/gl3.h> | 
				
			||||||
 | 
					GLuint load_shader(GLenum shaderType, const char *src); | 
				
			||||||
 | 
					GLuint load_program(const char *vert_src, const char *frag_src); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif | 
				
			||||||
@ -1 +1 @@ | 
				
			|||||||
const char *openpilot_version = "0.2.3"; | 
					const char *openpilot_version = "0.2.4"; | 
				
			||||||
 | 
				
			|||||||
									
										Binary file not shown.
									
								
							
						
					Loading…
					
					
				
		Reference in new issue