/* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, 2011,2012 Giovanni Di Sirio. This file is part of ChibiOS/RT. ChibiOS/RT is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. ChibiOS/RT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /** * @file STM32/can_lld.h * @brief STM32 CAN subsystem low level driver header. * * @addtogroup CAN * @{ */ #ifndef _CAN_LLD_H_ #define _CAN_LLD_H_ #if HAL_USE_CAN || defined(__DOXYGEN__) /*===========================================================================*/ /* Driver constants. */ /*===========================================================================*/ /* * The following macros from the ST header file are replaced with better * equivalents. */ #undef CAN_BTR_BRP #undef CAN_BTR_TS1 #undef CAN_BTR_TS2 #undef CAN_BTR_SJW /** * @brief This switch defines whether the driver implementation supports * a low power switch mode with automatic an wakeup feature. */ #define CAN_SUPPORTS_SLEEP TRUE /** * @name CAN registers helper macros * @{ */ #define CAN_BTR_BRP(n) (n) /**< @brief BRP field macro.*/ #define CAN_BTR_TS1(n) ((n) << 16) /**< @brief TS1 field macro.*/ #define CAN_BTR_TS2(n) ((n) << 20) /**< @brief TS2 field macro.*/ #define CAN_BTR_SJW(n) ((n) << 24) /**< @brief SJW field macro.*/ #define CAN_IDE_STD 0 /**< @brief Standard id. */ #define CAN_IDE_EXT 1 /**< @brief Extended id. */ #define CAN_RTR_DATA 0 /**< @brief Data frame. */ #define CAN_RTR_REMOTE 1 /**< @brief Remote frame. */ /** @} */ /*===========================================================================*/ /* Driver pre-compile time settings. */ /*===========================================================================*/ /** * @name Configuration options * @{ */ /** * @brief CAN1 driver enable switch. * @details If set to @p TRUE the support for ADC1 is included. * @note The default is @p TRUE. */ #if !defined(STM32_CAN_USE_CAN1) || defined(__DOXYGEN__) #define STM32_CAN_USE_CAN1 FALSE #endif /** * @brief CAN1 interrupt priority level setting. */ #if !defined(STM32_CAN_CAN1_IRQ_PRIORITY) || defined(__DOXYGEN__) #define STM32_CAN_CAN1_IRQ_PRIORITY 11 #endif /** @} */ /*===========================================================================*/ /* Derived constants and error checks. */ /*===========================================================================*/ #if STM32_CAN_USE_CAN1 && !STM32_HAS_CAN1 #error "CAN1 not present in the selected device" #endif #if !STM32_CAN_USE_CAN1 #error "CAN driver activated but no CAN peripheral assigned" #endif #if CAN_USE_SLEEP_MODE && !CAN_SUPPORTS_SLEEP #error "CAN sleep mode not supported in this architecture" #endif /*===========================================================================*/ /* Driver data structures and types. */ /*===========================================================================*/ /** * @brief CAN transmission frame. * @note Accessing the frame data as word16 or word32 is not portable because * machine data endianness, it can be still useful for a quick filling. */ typedef struct { struct { uint8_t DLC:4; /**< @brief Data length. */ uint8_t RTR:1; /**< @brief Frame type. */ uint8_t IDE:1; /**< @brief Identifier type. */ }; union { struct { uint32_t SID:11; /**< @brief Standard identifier.*/ }; struct { uint32_t EID:29; /**< @brief Extended identifier.*/ }; }; union { uint8_t data8[8]; /**< @brief Frame data. */ uint16_t data16[4]; /**< @brief Frame data. */ uint32_t data32[2]; /**< @brief Frame data. */ }; } CANTxFrame; /** * @brief CAN received frame. * @note Accessing the frame data as word16 or word32 is not portable because * machine data endianness, it can be still useful for a quick filling. */ typedef struct { struct { uint8_t FMI; /**< @brief Filter id. */ uint16_t TIME; /**< @brief Time stamp. */ }; struct { uint8_t DLC:4; /**< @brief Data length. */ uint8_t RTR:1; /**< @brief Frame type. */ uint8_t IDE:1; /**< @brief Identifier type. */ }; union { struct { uint32_t SID:11; /**< @brief Standard identifier.*/ }; struct { uint32_t EID:29; /**< @brief Extended identifier.*/ }; }; union { uint8_t data8[8]; /**< @brief Frame data. */ uint16_t data16[4]; /**< @brief Frame data. */ uint32_t data32[2]; /**< @brief Frame data. */ }; } CANRxFrame; /** * @brief CAN filter. * @note Refer to the STM32 reference manual for info about filters. */ typedef struct { /** * @brief Filter mode. * @note This bit represent the CAN_FM1R register bit associated to this * filter (0=mask mode, 1=list mode). */ uint32_t mode:1; /** * @brief Filter scale. * @note This bit represent the CAN_FS1R register bit associated to this * filter (0=16 bits mode, 1=32 bits mode). */ uint32_t scale:1; /** * @brief Filt
/*
             LUFA Library
     Copyright (C) Dean Camera, 2017.

  dean [at] fourwalledcubicle [dot] com
           www.lufa-lib.org
*/

/*
  Copyright 2017  Dean Camera (dean [at] fourwalledcubicle [dot] com)

  Permission to use, copy, modify, distribute, and sell this
  software and its documentation for any purpose is hereby granted
  without fee, provided that the above copyright notice appear in
  all copies and that both that the copyright notice and this
  permission notice and warranty disclaimer appear in supporting
  documentation, and that the name of the author not be used in
  advertising or publicity pertaining to distribution of the
  software without specific, written prior permission.

  The author disclaims all warranties with regard to this
  software, including all implied warranties of merchantability
  and fitness.  In no event shall the author be liable for any
  special, indirect or consequential damages or any damages
  whatsoever resulting from loss of use, data or profits, whether
  in an action of contract, negligence or other tortious action,
  arising out of or in connection with the use or performance of
  this software.
*/

/** \file
 *  \brief LUFA Library Configuration Header File
 *
 *  This header file is used to configure LUFA's compile time options,
 *  as an alternative to the compile time constants supplied through
 *  a makefile.
 *
 *  For information on what each token does, refer to the LUFA
 *  manual section "Summary of Compile Tokens".
 */

#ifndef _LUFA_CONFIG_H_
#define _LUFA_CONFIG_H_

	#if (ARCH == ARCH_AVR8)

		/* Non-USB Related Configuration Tokens: */
//		#define DISABLE_TERMINAL_CODES

		/* USB Class Driver Related Tokens: */
//		#define HID_HOST_BOOT_PROTOCOL_ONLY
//		#define HID_STATETABLE_STACK_DEPTH       {Insert Value Here}
//		#define HID_USAGE_STACK_DEPTH            {Insert Value Here}
//		#define HID_MAX_COLLECTIONS              {Insert Value Here}
//		#define HID_MAX_REPORTITEMS              {Insert Value Here}
//		#define HID_MAX_REPORT_IDS               {Insert Value Here}
//		#define NO_CLASS_DRIVER_AUTOFLUSH

		/* General USB Driver Related Tokens: */
		#define ORDERED_EP_CONFIG
		#define USE_STATIC_OPTIONS               (USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)
		#define USB_DEVICE_ONLY
//		#define USB_HOST_ONLY
//		#define USB_STREAM_TIMEOUT_MS            {Insert Value Here}
//		#define NO_LIMITED_CONTROLLER_CONNECT
//		#define NO_SOF_EVENTS

		/* USB Device Mode Driver Related Tokens: */
//		#define USE_RAM_DESCRIPTORS
		#define USE_FLASH_DESCRIPTORS
//		#define USE_EEPROM_DESCRIPTORS
//		#define NO_INTERNAL_SERIAL
		#define FIXED_CONTROL_ENDPOINT_SIZE      8
		#define DEVICE_STATE_AS_GPIOR            0
		#define FIXED_NUM_CONFIGURATIONS         1
//		#define CONTROL_ONLY_DEVICE
		#define INTERRUPT_CONTROL_ENDPOINT
//		#define NO_DEVICE_REMOTE_WAKEUP
//		#define NO_DEVICE_SELF_POWER

		/* USB Host Mode Driver Related Tokens: */
//		#define HOST_STATE_AS_GPIOR              {Insert Value Here}
//		#define USB_HOST_TIMEOUT_MS              {Insert Value Here}
//		#define HOST_DEVICE_SETTLE_DELAY_MS	     {Insert Value Here}
//		#define NO_AUTO_VBUS_MANAGEMENT
//		#define INVERTED_VBUS_ENABLE_LINE

	#else

		#error Unsupported architecture for this LUFA configuration file.

	#endif
#endif