X-CUBE-SPN1-20150128 example source code for one motor compiled under mbed. Tested OK on Nucleo F401. l6474.cpp is modified from original with defines in l6474_target_config.h to select the original behaviour (motor de-energised when halted), or new mode to continue powering with a (reduced) current in the coils (braking/position hold capability). On F401 avoid using mbed's InterruptIn on pins 10-15 (any port). Beware of other conflicts! L0 & F0 are included but untested.
ihm01a1.h
00001 00002 /** 00003 ****************************************************************************** 00004 * @file Multi/Examples/MotionControl/IHM01A1_ExampleFor1Motor/Inc/main.h 00005 * @author IPC Rennes 00006 * @version V1.5.0 00007 * @date November 12, 2014 00008 * @brief Header for main.c module 00009 ****************************************************************************** 00010 * @attention 00011 * 00012 * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> 00013 * 00014 * Redistribution and use in source and binary forms, with or without modification, 00015 * are permitted provided that the following conditions are met: 00016 * 1. Redistributions of source code must retain the above copyright notice, 00017 * this list of conditions and the following disclaimer. 00018 * 2. Redistributions in binary form must reproduce the above copyright notice, 00019 * this list of conditions and the following disclaimer in the documentation 00020 * and/or other materials provided with the distribution. 00021 * 3. Neither the name of STMicroelectronics nor the names of its contributors 00022 * may be used to endorse or promote products derived from this software 00023 * without specific prior written permission. 00024 * 00025 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00026 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00027 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00028 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 00029 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00030 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00031 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00032 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00033 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00034 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00035 * 00036 ****************************************************************************** 00037 */ 00038 00039 /* Define to prevent recursive inclusion -------------------------------------*/ 00040 #ifndef __MAIN_H 00041 #define __MAIN_H 00042 00043 /* Includes ------------------------------------------------------------------*/ 00044 #include "motorcontrol.h" 00045 #include "l6474.h" 00046 00047 #if defined TARGET_STM32F4 //TARGET_NUCLEO_F401RE 00048 #include "stm32f4xx_nucleo_ihm01a1.h" 00049 #elif defined TARGET_STM32F0 00050 #warning Untested platform! 00051 #include "stm32f0xx_nucleo_ihm01a1.h" 00052 #elif defined TARGET_STM32L0 00053 #warning Untested platform! 00054 #include "stm32l0xx_nucleo_ihm01a1.h" 00055 #else 00056 #error Unknown Target: only STM32F0xx, F4xx, L0xx are supported. 00057 #endif 00058 00059 /* Exported types ------------------------------------------------------------*/ 00060 /* Exported constants --------------------------------------------------------*/ 00061 /* Exported functions ------------------------------------------------------- */ 00062 void SystemClock_Config(void); 00063 void Error_Handler(uint16_t error); 00064 00065 #endif /* __MAIN_H */ 00066 00067 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Generated on Tue Jul 12 2022 22:53:31 by 1.7.2