├── .gitignore
├── Makefile
├── README.md
├── app
├── inc
│ ├── periphs
│ │ └── uart.h
│ ├── stm32f4xx_conf.h
│ └── stm32f4xx_it.h
├── module.mk
├── src
│ ├── main.c
│ ├── periphs
│ │ └── uart.c
│ ├── stm32f4xx_it.c
│ ├── syscalls.c
│ └── system_stm32f4xx.c
└── startup_stm32f4xx.s
├── lib
├── CANopen
│ ├── .gitignore
│ ├── LICENSE
│ ├── Object_Dictionary_Editor
│ │ ├── about.html
│ │ ├── device.js
│ │ ├── device.xul
│ │ ├── gpl-3.0-standalone.html
│ │ ├── output.js
│ │ ├── panels.js
│ │ ├── panels
│ │ │ ├── _blank.xul
│ │ │ ├── _readme.txt
│ │ │ ├── editor.xul
│ │ │ ├── features.xul
│ │ │ ├── objects.xul
│ │ │ └── other.xul
│ │ ├── pict
│ │ │ ├── disabled.png
│ │ │ └── question.png
│ │ └── util.js
│ ├── README.md
│ ├── doc
│ │ └── CANopen_stack
│ │ │ ├── html
│ │ │ ├── bc_s.png
│ │ │ ├── bdwn.png
│ │ │ ├── closed.png
│ │ │ ├── doxygen.css
│ │ │ ├── doxygen.png
│ │ │ ├── dynsections.js
│ │ │ ├── ftv2blank.png
│ │ │ ├── ftv2cl.png
│ │ │ ├── ftv2doc.png
│ │ │ ├── ftv2folderclosed.png
│ │ │ ├── ftv2folderopen.png
│ │ │ ├── ftv2lastnode.png
│ │ │ ├── ftv2link.png
│ │ │ ├── ftv2mlastnode.png
│ │ │ ├── ftv2mnode.png
│ │ │ ├── ftv2mo.png
│ │ │ ├── ftv2node.png
│ │ │ ├── ftv2ns.png
│ │ │ ├── ftv2plastnode.png
│ │ │ ├── ftv2pnode.png
│ │ │ ├── ftv2splitbar.png
│ │ │ ├── ftv2vertline.png
│ │ │ ├── index.html
│ │ │ ├── jquery.js
│ │ │ ├── nav_f.png
│ │ │ ├── nav_g.png
│ │ │ ├── nav_h.png
│ │ │ ├── navtree.css
│ │ │ ├── navtree.js
│ │ │ ├── navtreeindex0.js
│ │ │ ├── open.png
│ │ │ ├── resize.js
│ │ │ ├── search
│ │ │ │ ├── close.png
│ │ │ │ ├── mag_sel.png
│ │ │ │ ├── nomatches.html
│ │ │ │ ├── search.css
│ │ │ │ ├── search.js
│ │ │ │ ├── search_l.png
│ │ │ │ ├── search_m.png
│ │ │ │ └── search_r.png
│ │ │ ├── sync_off.png
│ │ │ ├── sync_on.png
│ │ │ ├── tab_a.png
│ │ │ ├── tab_b.png
│ │ │ ├── tab_h.png
│ │ │ ├── tab_s.png
│ │ │ └── tabs.css
│ │ │ └── latex
│ │ │ ├── Makefile
│ │ │ ├── doxygen.sty
│ │ │ └── refman.tex
│ ├── inc
│ │ ├── CANopen.h
│ │ ├── CO_Emergency.h
│ │ ├── CO_HBconsumer.h
│ │ ├── CO_NMT_Heartbeat.h
│ │ ├── CO_OD.h
│ │ ├── CO_PDO.h
│ │ ├── CO_SDO.h
│ │ ├── CO_SDOmaster.h
│ │ ├── CO_SYNC.h
│ │ ├── CO_timer.h
│ │ ├── STM32
│ │ │ ├── CO_config.h
│ │ │ ├── CO_driver.h
│ │ │ ├── eeprom.h
│ │ │ └── hwconfig.h
│ │ ├── application.h
│ │ ├── crc16-ccitt.h
│ │ └── trace.h
│ ├── module.mk
│ └── src
│ │ ├── CANopen.c
│ │ ├── COPYING.LESSER.txt
│ │ ├── COPYING.txt
│ │ ├── CO_Emergency.c
│ │ ├── CO_HBconsumer.c
│ │ ├── CO_NMT_Heartbeat.c
│ │ ├── CO_OD.c
│ │ ├── CO_PDO.c
│ │ ├── CO_SDO.c
│ │ ├── CO_SDOmaster.c
│ │ ├── CO_SYNC.c
│ │ ├── CO_timer.c
│ │ ├── Doxyfile
│ │ ├── EM
│ │ ├── Readme.txt
│ │ ├── _project.html
│ │ ├── _project.xml
│ │ ├── crc16-ccitt.c
│ │ └── stm32
│ │ └── CO_driver.c
├── CMSIS
│ ├── Device
│ │ └── ST
│ │ │ └── STM32F4xx
│ │ │ ├── Include
│ │ │ ├── stm32f4xx.h
│ │ │ └── system_stm32f4xx.h
│ │ │ ├── Release_Notes.html
│ │ │ └── Source
│ │ │ └── Templates
│ │ │ ├── TASKING
│ │ │ └── cstart_thumb2.asm
│ │ │ ├── TrueSTUDIO
│ │ │ └── startup_stm32f4xx.s
│ │ │ ├── arm
│ │ │ └── startup_stm32f4xx.s
│ │ │ ├── gcc_ride7
│ │ │ └── startup_stm32f4xx.s
│ │ │ ├── iar
│ │ │ └── startup_stm32f4xx.s
│ │ │ └── system_stm32f4xx.c
│ ├── Include
│ │ ├── arm_common_tables.h
│ │ ├── arm_math.h
│ │ ├── core_cm0.h
│ │ ├── core_cm3.h
│ │ ├── core_cm4.h
│ │ ├── core_cm4_simd.h
│ │ ├── core_cmFunc.h
│ │ └── core_cmInstr.h
│ └── README.txt
├── STM32F4xx_StdPeriph_Driver
│ ├── Release_Notes.html
│ ├── inc
│ │ ├── misc.h
│ │ ├── stm32f4xx_adc.h
│ │ ├── stm32f4xx_can.h
│ │ ├── stm32f4xx_crc.h
│ │ ├── stm32f4xx_cryp.h
│ │ ├── stm32f4xx_dac.h
│ │ ├── stm32f4xx_dbgmcu.h
│ │ ├── stm32f4xx_dcmi.h
│ │ ├── stm32f4xx_dma.h
│ │ ├── stm32f4xx_exti.h
│ │ ├── stm32f4xx_flash.h
│ │ ├── stm32f4xx_fsmc.h
│ │ ├── stm32f4xx_gpio.h
│ │ ├── stm32f4xx_hash.h
│ │ ├── stm32f4xx_i2c.h
│ │ ├── stm32f4xx_iwdg.h
│ │ ├── stm32f4xx_pwr.h
│ │ ├── stm32f4xx_rcc.h
│ │ ├── stm32f4xx_rng.h
│ │ ├── stm32f4xx_rtc.h
│ │ ├── stm32f4xx_sdio.h
│ │ ├── stm32f4xx_spi.h
│ │ ├── stm32f4xx_syscfg.h
│ │ ├── stm32f4xx_tim.h
│ │ ├── stm32f4xx_usart.h
│ │ └── stm32f4xx_wwdg.h
│ ├── module.mk
│ └── src
│ │ ├── misc.c
│ │ ├── stm32f4xx_adc.c
│ │ ├── stm32f4xx_can.c
│ │ ├── stm32f4xx_crc.c
│ │ ├── stm32f4xx_cryp.c
│ │ ├── stm32f4xx_cryp_aes.c
│ │ ├── stm32f4xx_cryp_des.c
│ │ ├── stm32f4xx_cryp_tdes.c
│ │ ├── stm32f4xx_dac.c
│ │ ├── stm32f4xx_dbgmcu.c
│ │ ├── stm32f4xx_dcmi.c
│ │ ├── stm32f4xx_dma.c
│ │ ├── stm32f4xx_exti.c
│ │ ├── stm32f4xx_flash.c
│ │ ├── stm32f4xx_fsmc.c
│ │ ├── stm32f4xx_gpio.c
│ │ ├── stm32f4xx_hash.c
│ │ ├── stm32f4xx_hash_md5.c
│ │ ├── stm32f4xx_hash_sha1.c
│ │ ├── stm32f4xx_i2c.c
│ │ ├── stm32f4xx_iwdg.c
│ │ ├── stm32f4xx_pwr.c
│ │ ├── stm32f4xx_rcc.c
│ │ ├── stm32f4xx_rng.c
│ │ ├── stm32f4xx_rtc.c
│ │ ├── stm32f4xx_sdio.c
│ │ ├── stm32f4xx_spi.c
│ │ ├── stm32f4xx_syscfg.c
│ │ ├── stm32f4xx_tim.c
│ │ ├── stm32f4xx_usart.c
│ │ └── stm32f4xx_wwdg.c
└── od_config
│ ├── inc
│ ├── CO_OD.h
│ └── CO_config.h
│ └── src
│ ├── CO_OD.c
│ └── _project.xml
└── stm32_flash.ld
/.gitignore:
--------------------------------------------------------------------------------
1 | # ignore standard build files
2 |
3 | *.o
4 | *.d
5 | *.a
6 | *.so
7 | *~
8 | *.bin
9 | *.elf
10 | *.hex
11 |
12 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | # Initialize variables for nonrecursive make
2 |
3 | programs :=
4 | sources :=
5 | libraries :=
6 | objects = $(patsubst %.c,%.o,$(sources))
7 | dependencies = $(patsubst %.c,%.d,$(sources))
8 |
9 | # Define header file and library directories
10 |
11 | include_dirs := app/inc
12 | include_dirs += app/inc/periphs
13 | include_dirs += lib/CMSIS/Include
14 | include_dirs += lib/CMSIS/Device/ST/STM32F4xx/Include
15 | include_dirs += lib/STM32F4xx_StdPeriph_Driver/inc
16 | include_dirs += lib/CANopen/inc
17 | include_dirs += lib/CANopen/inc/STM32
18 |
19 | library_dirs := lib
20 |
21 | vpath %.h $(include_dirs)
22 |
23 | # Define toolchains and build options
24 |
25 | AR := ar
26 | SED := sed
27 | CP := cp
28 | MV := mv
29 | RM := rm -f
30 | CC := arm-none-eabi-gcc
31 | LD := arm-none-eabi-gcc
32 | OBJCOPY := arm-none-eabi-objcopy
33 |
34 | CFLAGS := -O0 #-Werror
35 | CFLAGS += -mlittle-endian -mthumb -mcpu=cortex-m4 -fsingle-precision-constant
36 | CFLAGS += -mthumb-interwork -mfloat-abi=hard -mfpu=fpv4-sp-d16
37 | CFLAGS += -DUSE_STDPERIPH_DRIVER -DSTM32F4XX
38 | CFLAGS += -DMANGUSTA_DISCOVERY -DHSE_VALUE=8000000
39 | LDFLAGS := -fno-exceptions -ffunction-sections -fdata-sections
40 | LDFLAGS += -nostartfiles -Wl,--gc-sections -Tstm32_flash.ld
41 | ARFLAGS := rcv
42 | IPATHS = $(addprefix -I,$(include_dirs))
43 | LPATHS = $(addprefix -L,$(library_dirs))
44 |
45 | # Include make modules
46 |
47 | all:
48 | include lib/CANopen/module.mk
49 | include lib/STM32F4xx_StdPeriph_Driver/module.mk
50 | include app/module.mk
51 |
52 | ifneq "$(MAKECMDGOALS)" "clean"
53 | -include $(dependencies)
54 | endif
55 |
56 | # Define additional rules
57 |
58 | all: $(programs)
59 |
60 | #l_ankle l_knee l_hip r_ankle r_knee r_hip teststand: clean
61 | # cd app/inc && \
62 | # rm -f config.h && \
63 | # ln -s ../../target/$@/config.h . && \
64 | # cd ../..
65 | # cd app/src/mechanics && \
66 | # rm -f mechanics.c && \
67 | # ln -s ../../../target/$@/mechanics.c . && \
68 | # cd ../../..
69 |
70 | libraries: $(libraries)
71 |
72 | clean:
73 | $(RM) $(programs) app/src/*.o app/src/*.d app/src/*~ \
74 | ./*~ app/*~
75 |
76 | realclean: clean
77 | $(RM) $(libraries) $(objects) $(dependencies)
78 |
79 | %.o: %.c
80 | $(CC) -c $(CFLAGS) $(IPATHS) $< -o $@
81 |
82 | %.d: %.c
83 | $(CC) $(CFLAGS) $(IPATHS) -M $< | \
84 | $(SED) 's,\($(notdir $*)\.o\) *:,$(dir $@)\1 $@: ,' > $@.tmp
85 | $(MV) $@.tmp $@
86 |
87 | .PHONY: all libraries clean realclean
88 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | stm32f4-CANopen-project
2 | =====================
3 |
4 | An empty project with all the boilerplate to start developing with stm32f4 and canopen-node
5 |
6 | Change the output file name in app/module.mk
7 |
8 | Grab the project with:
9 | git clone file:///path/to/repo/
10 |
11 | Cloning will bring over the remotes specified in that directory. So you'll need to remove the remotes you don't want.
12 |
13 | git remote rm
14 |
15 | And add the ones you do, after you have created your remote repository.
16 |
17 | git remote add origin
18 |
19 | You will also want to --set-upstream-to, or -u to tell git this is the remote repository this branch will update to, presuming you are on the master branch.
20 |
21 | git push -u origin master
22 |
23 | Then you'll need to decide which branches to keep and add to the remote. If you want to push all of them, just do git push --mirror. This will push all your tags and your remotes. But since we edited your remotes in an earlier step, it shouldn't be a problem.
24 |
25 | If you only want to keep a few, you can git push -u origin each one you want.
26 |
27 | Install a few packages to make everything work
28 | ---
29 |
30 | sudo apt-get install flex bison libgmp3-dev libmpfr-dev libncurses5-dev libmpc-dev autoconf texinfo build-essential libftdi-dev libexpat1 libexpat1-dev
31 |
32 |
33 | Install the arm-gcc toolchain
34 | ---
35 |
36 | The toolchain is here:
37 |
38 | https://launchpad.net/gcc-arm-embedded
39 |
40 | Find the link for the PPA and add to your system:
41 |
42 | https://launchpad.net/~terry.guo/+archive/gcc-arm-embedded
43 |
44 | sudo add-apt-repository ppa:terry.guo/gcc-arm-embedded
45 | sudo apt-get update
46 | sudo apt-get install gcc-arm-none-eabi
47 |
48 |
49 | Download stlink to interface with the stlink programmer
50 | ---
51 |
52 | Install stlink
53 |
54 | sudo apt-get install libusb-1.0
55 | git clone https://github.com/texane/stlink
56 | cd stlink
57 | ./autogen.sh
58 | ./configure
59 | make
60 | sudo mkdir /opt/stlink
61 | sudo cp st-util st-flash /opt/stlink
62 | sudo cp 49-stlinkv2.rules /etc/udev/rules.d
63 | sudo /etc/init.d/udev restart
64 |
65 | Add /opt/stlink to your PATH and test out the st-util utility
66 |
67 | st-util -h
68 |
69 | Build the code
70 | ---
71 |
72 | Run
73 |
74 | make
75 |
76 | to build the application code.
77 |
78 | Use "make clean" to remove program build files. Use "make realclean" to remove library build files as well.
79 |
80 | Load and execute an elf file with gdb
81 | ---
82 |
83 | While your laptop is connected to the board via the debugger run
84 |
85 | st-util
86 |
87 | Then reset the processor, open a new terminal and run
88 |
89 | arm-none-eabi-gdb app.elf
90 | target remote localhost:4242
91 | load
92 | continue
93 |
94 | Note that optimization settings can cause issues with breakpoints
95 |
96 | Flashing a bin file to the program memory
97 | ---
98 |
99 | While your laptop is connected to the board via the debugger run
100 |
101 | st-flash write app.bin 0x08000000
102 |
103 |
--------------------------------------------------------------------------------
/app/inc/periphs/uart.h:
--------------------------------------------------------------------------------
1 | #ifndef _UART_H_
2 | #define _UART_H_
3 |
4 |
5 | /*******************************************************************************
6 | ** uart.o : universal asynchronous receiver/transmitter : steve ressler (ressler@vt.edu)
7 | *******************************************************************************/
8 |
9 | /*
10 | Notes:
11 | ------
12 |
13 |
14 | Usage:
15 | ------
16 |
17 |
18 | */
19 |
20 |
21 |
22 | void initialize_uart();
23 |
24 |
25 | #endif
26 |
--------------------------------------------------------------------------------
/app/inc/stm32f4xx_conf.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file IO_Toggle/stm32f4xx_conf.h
4 | * @author MCD Application Team
5 | * @version V1.0.0
6 | * @date 19-September-2011
7 | * @brief Library configuration file.
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
17 | *
18 | * © COPYRIGHT 2011 STMicroelectronics
19 | ******************************************************************************
20 | */
21 |
22 | /* Define to prevent recursive inclusion -------------------------------------*/
23 | #ifndef __STM32F4xx_CONF_H
24 | #define __STM32F4xx_CONF_H
25 |
26 | #if defined (HSE_VALUE)
27 | /* Redefine the HSE value; it's equal to 8 MHz on the STM32F4-DISCOVERY Kit */
28 | #undef HSE_VALUE
29 | #define HSE_VALUE ((uint32_t)8000000)
30 | #endif /* HSE_VALUE */
31 |
32 | /* Includes ------------------------------------------------------------------*/
33 | /* Uncomment the line below to enable peripheral header file inclusion */
34 | #include "stm32f4xx_adc.h"
35 | #include "stm32f4xx_can.h"
36 | #include "stm32f4xx_crc.h"
37 | #include "stm32f4xx_cryp.h"
38 | #include "stm32f4xx_dac.h"
39 | #include "stm32f4xx_dbgmcu.h"
40 | #include "stm32f4xx_dcmi.h"
41 | #include "stm32f4xx_dma.h"
42 | #include "stm32f4xx_exti.h"
43 | #include "stm32f4xx_flash.h"
44 | #include "stm32f4xx_fsmc.h"
45 | #include "stm32f4xx_hash.h"
46 | #include "stm32f4xx_gpio.h"
47 | #include "stm32f4xx_i2c.h"
48 | #include "stm32f4xx_iwdg.h"
49 | #include "stm32f4xx_pwr.h"
50 | #include "stm32f4xx_rcc.h"
51 | #include "stm32f4xx_rng.h"
52 | #include "stm32f4xx_rtc.h"
53 | #include "stm32f4xx_sdio.h"
54 | #include "stm32f4xx_spi.h"
55 | #include "stm32f4xx_syscfg.h"
56 | #include "stm32f4xx_tim.h"
57 | #include "stm32f4xx_usart.h"
58 | #include "stm32f4xx_wwdg.h"
59 | #include "misc.h" /* High level functions for NVIC and SysTick (add-on to CMSIS functions) */
60 |
61 | /* Exported types ------------------------------------------------------------*/
62 | /* Exported constants --------------------------------------------------------*/
63 |
64 | /* If an external clock source is used, then the value of the following define
65 | should be set to the value of the external clock source, else, if no external
66 | clock is used, keep this define commented */
67 | /*#define I2S_EXTERNAL_CLOCK_VAL 12288000 */ /* Value of the external clock in Hz */
68 |
69 |
70 | /* Uncomment the line below to expanse the "assert_param" macro in the
71 | Standard Peripheral Library drivers code */
72 | /* #define USE_FULL_ASSERT 1 */
73 |
74 | /* Exported macro ------------------------------------------------------------*/
75 | #ifdef USE_FULL_ASSERT
76 |
77 | /**
78 | * @brief The assert_param macro is used for function's parameters check.
79 | * @param expr: If expr is false, it calls assert_failed function
80 | * which reports the name of the source file and the source
81 | * line number of the call that failed.
82 | * If expr is true, it returns no value.
83 | * @retval None
84 | */
85 | #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__))
86 | /* Exported functions ------------------------------------------------------- */
87 | void assert_failed(uint8_t* file, uint32_t line);
88 | #else
89 | #define assert_param(expr) ((void)0)
90 | #endif /* USE_FULL_ASSERT */
91 |
92 | #endif /* __STM32F4xx_CONF_H */
93 |
94 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
95 |
--------------------------------------------------------------------------------
/app/inc/stm32f4xx_it.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file GPIO/IOToggle/stm32f4xx_it.h
4 | * @author MCD Application Team
5 | * @version V1.0.0
6 | * @date 19-September-2011
7 | * @brief This file contains the headers of the interrupt handlers.
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
17 | *
18 | * © COPYRIGHT 2011 STMicroelectronics
19 | ******************************************************************************
20 | */
21 |
22 | /* Define to prevent recursive inclusion -------------------------------------*/
23 | #ifndef __STM32F4xx_IT_H
24 | #define __STM32F4xx_IT_H
25 |
26 | #ifdef __cplusplus
27 | extern "C" {
28 | #endif
29 |
30 | /* Includes ------------------------------------------------------------------*/
31 | #include "stm32f4xx.h"
32 |
33 | /* Exported types ------------------------------------------------------------*/
34 | /* Exported constants --------------------------------------------------------*/
35 | /* Exported macro ------------------------------------------------------------*/
36 | /* Exported functions ------------------------------------------------------- */
37 |
38 | void NMI_Handler(void);
39 | void HardFault_Handler(void);
40 | void MemManage_Handler(void);
41 | void BusFault_Handler(void);
42 | void UsageFault_Handler(void);
43 | void SVC_Handler(void);
44 | void DebugMon_Handler(void);
45 | void PendSV_Handler(void);
46 | void SysTick_Handler(void);
47 |
48 | #ifdef __cplusplus
49 | }
50 | #endif
51 |
52 | #endif /* __STM32F4xx_IT_H */
53 |
54 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
55 |
--------------------------------------------------------------------------------
/app/module.mk:
--------------------------------------------------------------------------------
1 | local_dir := app
2 | local_prg := bin/out
3 | local_asm := $(local_dir)/startup_stm32f4xx.s # startup code
4 | local_src := $(shell find $(local_dir)/src -name *.c | tr '\n' ' ')
5 | local_obj := $(patsubst %.c,%.o,$(local_src))
6 | programs += $(addprefix $(local_prg),.elf .hex .bin)
7 | sources += $(local_src)
8 |
9 | $(local_prg).elf: $(local_obj) $(local_asm) $(libraries)
10 | $(CC) $(CFLAGS) $(LDFLAGS) $(IPATHS) $(LPATHS) $^ -lc -lm -o $@
11 |
12 | $(local_prg).hex: $(local_prg).elf
13 | $(OBJCOPY) -O binary $^ $@
14 |
15 | $(local_prg).bin: $(local_prg).elf
16 | $(OBJCOPY) -O ihex $^ $@
17 |
--------------------------------------------------------------------------------
/app/src/main.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include "stm32f4xx.h" // include stm32f4xx drivers
5 |
6 |
7 | /* Global variables */
8 |
9 |
10 |
11 | int main(void)
12 | {
13 | // This enables the floating point unit
14 | SCB->CPACR |= ((3UL << 10*2)|(3UL << 11*2));
15 |
16 | RCC_ClocksTypeDef RCC_Clocks;
17 | RCC_GetClocksFreq(&RCC_Clocks);
18 |
19 | initialize_uart();
20 |
21 | printf("SYS:%lu H:%lu, P1:%lu, P2:%lu\r\n",
22 | RCC_Clocks.SYSCLK_Frequency,
23 | RCC_Clocks.HCLK_Frequency, // AHB
24 | RCC_Clocks.PCLK1_Frequency, // APB1
25 | RCC_Clocks.PCLK2_Frequency); // APB2
26 |
27 |
28 |
29 |
30 | while(1) // Loop for program execution
31 | {
32 |
33 | };
34 |
35 |
36 | /* program exit ***************************************************************/
37 | printf("Program Exit!\n\r");
38 | /* save variables to eeprom */
39 | DISABLE_INTERRUPTS();
40 |
41 |
42 | /* reset - by WD */
43 | return 0;
44 |
45 | }
46 |
47 |
48 | #ifdef USE_FULL_ASSERT
49 |
50 | /**
51 | * @brief Reports the name of the source file and the source line number
52 | * where the assert_param error has occurred.
53 | * @param file: pointer to the source file name
54 | * @param line: assert_param error line source number
55 | * @retval None
56 | */
57 | void assert_failed(uint8_t* file, uint32_t line)
58 | {
59 | /* User can add his own implementation to report the file name and line number,
60 | ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
61 |
62 | /* Infinite loop */
63 | while (1)
64 | {
65 | }
66 | }
67 | #endif
68 |
--------------------------------------------------------------------------------
/app/src/periphs/uart.c:
--------------------------------------------------------------------------------
1 |
2 | #include "stm32f4xx.h"
3 | #include "uart.h"
4 |
5 |
6 | /*******************************************************************************
7 | ** uart.o : universal asynchronous receiver/transmitter : steve ressler (ressler@vt.edu)
8 | *******************************************************************************/
9 |
10 | /*
11 | Notes:
12 | ------
13 |
14 |
15 | Usage:
16 | ------
17 |
18 |
19 | */
20 |
21 |
22 |
23 | void initialize_uart()
24 | {
25 |
26 | GPIO_InitTypeDef GPIO_InitStructure;
27 | USART_InitTypeDef USART_InitStructure;
28 |
29 | /* enable peripheral clock for USART2 */
30 | RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2, ENABLE);
31 |
32 | /* GPIOA clock enable */
33 | RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);
34 |
35 | /* GPIOA Configuration: USART2 TX on PA2 */
36 | GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2;
37 | GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
38 | GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
39 | GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
40 | GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP ;
41 | GPIO_Init(GPIOA, &GPIO_InitStructure);
42 |
43 | /* Connect USART2 pins to AF2 */
44 | // TX = PA2
45 | GPIO_PinAFConfig(GPIOA, GPIO_PinSource2, GPIO_AF_USART2);
46 | USART_InitStructure.USART_BaudRate = 115200;
47 | USART_InitStructure.USART_WordLength = USART_WordLength_8b;
48 | USART_InitStructure.USART_StopBits = USART_StopBits_1;
49 | USART_InitStructure.USART_Parity = USART_Parity_No;
50 | USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
51 | USART_InitStructure.USART_Mode = USART_Mode_Tx;
52 | USART_Init(USART2, &USART_InitStructure);
53 |
54 | USART_Cmd(USART2, ENABLE);
55 |
56 | return;
57 | }
58 |
59 |
--------------------------------------------------------------------------------
/app/src/stm32f4xx_it.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file IO_Toggle/stm32f4xx_it.c
4 | * @author MCD Application Team
5 | * @version V1.0.0
6 | * @date 19-September-2011
7 | * @brief Main Interrupt Service Routines.
8 | * This file provides template for all exceptions handler and
9 | * peripherals interrupt service routine.
10 | ******************************************************************************
11 | * @attention
12 | *
13 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
14 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
15 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
16 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
17 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
18 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
19 | *
20 | * © COPYRIGHT 2011 STMicroelectronics
21 | ******************************************************************************
22 | */
23 |
24 | /* Includes ------------------------------------------------------------------*/
25 | #include
26 |
27 | #include "stm32f4xx_it.h"
28 |
29 |
30 | /** @addtogroup STM32F4_Discovery_Peripheral_Examples
31 | * @{
32 | */
33 |
34 | /** @addtogroup IO_Toggle
35 | * @{
36 | */
37 |
38 | /* Private typedef -----------------------------------------------------------*/
39 | /* Private define ------------------------------------------------------------*/
40 | /* Private macro -------------------------------------------------------------*/
41 | /* Private variables ---------------------------------------------------------*/
42 | /* Private function prototypes -----------------------------------------------*/
43 | /* Private functions ---------------------------------------------------------*/
44 |
45 | /******************************************************************************/
46 | /* Cortex-M4 Processor Exceptions Handlers */
47 | /******************************************************************************/
48 |
49 | /**
50 | * @brief This function handles NMI exception.
51 | * @param None
52 | * @retval None
53 | */
54 | void NMI_Handler(void)
55 | {
56 | }
57 |
58 | /**
59 | * @brief This function handles Hard Fault exception.
60 | * @param None
61 | * @retval None
62 | */
63 | void HardFault_Handler(void)
64 | {
65 | /* Go to infinite loop when Hard Fault exception occurs */
66 | printf("Hard Fault!\r\n");
67 | while (1)
68 | {
69 |
70 | }
71 | }
72 |
73 | /**
74 | * @brief This function handles Memory Manage exception.
75 | * @param None
76 | * @retval None
77 | */
78 | void MemManage_Handler(void)
79 | {
80 | /* Go to infinite loop when Memory Manage exception occurs */
81 |
82 | while (1)
83 | {
84 | printf("Memory Exception!\r\n");
85 | }
86 | }
87 |
88 | /**
89 | * @brief This function handles Bus Fault exception.
90 | * @param None
91 | * @retval None
92 | */
93 | void BusFault_Handler(void)
94 | {
95 | /* Go to infinite loop when Bus Fault exception occurs */
96 | printf("Bus Fault!\r\n");
97 | while (1)
98 | {
99 |
100 | }
101 | }
102 |
103 | /**
104 | * @brief This function handles Usage Fault exception.
105 | * @param None
106 | * @retval None
107 | */
108 | void UsageFault_Handler(void)
109 | {
110 | /* Go to infinite loop when Usage Fault exception occurs */
111 | printf("Usage Fault!\r\n");
112 | while (1)
113 | {
114 |
115 | }
116 | }
117 |
118 | /**
119 | * @brief This function handles SVCall exception.
120 | * @param None
121 | * @retval None
122 | */
123 | void SVC_Handler(void)
124 | {
125 | }
126 |
127 | /**
128 | * @brief This function handles Debug Monitor exception.
129 | * @param None
130 | * @retval None
131 | */
132 | void DebugMon_Handler(void)
133 | {
134 | }
135 |
136 | /**
137 | * @brief This function handles PendSVC exception.
138 | * @param None
139 | * @retval None
140 | */
141 | void PendSV_Handler(void)
142 | {
143 | }
144 |
145 | /**
146 | * @brief This function handles SysTick Handler.
147 | * @param None
148 | * @retval None
149 | */
150 | void SysTick_Handler(void)
151 | {
152 | }
153 |
154 | /******************************************************************************/
155 | /* STM32F4xx Peripherals Interrupt Handlers */
156 | /******************************************************************************/
157 |
158 | /**
159 | * @brief This function handles TIM1 global interrupt request.
160 | * @param None
161 | * @retval None
162 | */
163 | void TIM1_UP_TIM10_IRQHandler(void)
164 | {
165 | }
166 |
167 | void TIM2_IRQHandler(void)
168 | {
169 | }
170 |
171 | /**
172 | * @brief This function handles TIM3 global interrupt request.
173 | * @param None
174 | * @retval None
175 | */
176 | void TIM3_IRQHandler(void)
177 | {
178 | }
179 |
180 | void TIM4_IRQHandler(void)
181 | {
182 | }
183 |
184 | void TIM5_IRQHandler(void)
185 | {
186 | }
187 |
188 | void ADC_IRQHandler(void)
189 | {
190 | }
191 |
192 | /******************************************************************************/
193 | /* STM32F4xx Peripherals Interrupt Handlers */
194 | /* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */
195 | /* available peripheral interrupt handler's name please refer to the startup */
196 | /* file (startup_stm32f4xx.s). */
197 | /******************************************************************************/
198 |
199 | /**
200 | * @brief This function handles PPP interrupt request.
201 | * @param None
202 | * @retval None
203 | */
204 | /*void PPP_IRQHandler(void)
205 | {
206 | }*/
207 |
208 | /**
209 | * @brief This function handles SPI interrupt request.
210 | * @param None
211 | * @retval None
212 | */
213 | void SPIx_IRQHANDLER(void)
214 | {
215 | }
216 |
217 | void CAN1_SCE_IRQHandler(void)
218 | {
219 | printf("SCE Int\n\r");
220 | if (CAN_GetITStatus(CAN1, CAN_IT_EWG) == SET)
221 | {
222 | printf("CAN1 Error Warning!\r\n");
223 | CAN_ClearITPendingBit(CAN1, CAN_IT_EWG);
224 | }
225 | if (CAN_GetITStatus(CAN1, CAN_IT_EPV) == SET)
226 | {
227 | printf("CAN1 Error Passive!\r\n");
228 | }
229 | if (CAN_GetITStatus(CAN1, CAN_IT_BOF) == SET)
230 | {
231 | printf("CAN1 Bus-Off!\r\n");
232 | }
233 | if (CAN_GetITStatus(CAN1, CAN_IT_LEC) == SET)
234 | {
235 | printf("CAN1 Last Error Code: %X\r\n", CAN1->ESR);
236 | CAN_ClearITPendingBit(CAN1, CAN_IT_LEC);
237 | }
238 | if (CAN_GetITStatus(CAN1, CAN_IT_ERR) == SET)
239 | {
240 | printf("CAN1 Error!\r\n");
241 | CAN_ClearITPendingBit(CAN1, CAN_IT_ERR);
242 | }
243 | }
244 |
245 | /**
246 | * @brief This function handles CAN1 RX0 request.
247 | * @param None
248 | * @retval None
249 | */
250 | void CAN1_RX0_IRQHandler(void)
251 | {
252 | }
253 |
254 |
255 | /**
256 | * @brief This function handles CAN1 TX0 request.
257 | * @param None
258 | * @retval None
259 | */
260 | void CAN1_TX_IRQHandler(void)
261 | {
262 | }
263 |
264 |
265 | // Used to handle absolute encoders
266 | void USARTx_IRQHandler(void)
267 | {
268 | }
269 |
270 | /**
271 | * @}
272 | */
273 |
274 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
275 |
--------------------------------------------------------------------------------
/app/src/syscalls.c:
--------------------------------------------------------------------------------
1 |
2 | /*
3 | * newlib_stubs.c
4 | *
5 | * Created on: 2 Nov 2010
6 | * Author: nanoage.co.uk
7 | */
8 | #include
9 | #include
10 | #include
11 | #include
12 | //#include "core_cmFunc.h"
13 | #include "stm32f4xx_usart.h"
14 | //#include "stm32f10x_usart.h"
15 |
16 |
17 | #ifndef STDOUT_USART
18 | #define STDOUT_USART 2
19 | #endif
20 |
21 | #ifndef STDERR_USART
22 | #define STDERR_USART 2
23 | #endif
24 |
25 | #ifndef STDIN_USART
26 | #define STDIN_USART 2
27 | #endif
28 |
29 | #undef errno
30 | extern int errno;
31 |
32 | /*
33 | environ
34 | A pointer to a list of environment variables and their values.
35 | For a minimal environment, this empty list is adequate:
36 | */
37 | char *__env[1] = { 0 };
38 | char **environ = __env;
39 |
40 | int _close(int file) {
41 | return -1;
42 | }
43 |
44 | /*
45 | lseek
46 | Set position in a file. Minimal implementation:
47 | */
48 | int _lseek(int file, int ptr, int dir) {
49 | return 0;
50 | }
51 |
52 | /*
53 | isatty
54 | Query whether output stream is a terminal. For consistency with the other minimal implementations,
55 | */
56 | int _isatty(int file) {
57 | switch (file){
58 | case STDOUT_FILENO:
59 | case STDERR_FILENO:
60 | case STDIN_FILENO:
61 | return 1;
62 | default:
63 | //errno = ENOTTY;
64 | errno = EBADF;
65 | return 0;
66 | }
67 | }
68 |
69 | /*
70 | fstat
71 | Status of an open file. For consistency with other minimal implementations in these examples,
72 | all files are regarded as character special devices.
73 | The `sys/stat.h' header file required is distributed in the `include' subdirectory for this C library.
74 | */
75 | int _fstat(int file, struct stat *st) {
76 | st->st_mode = S_IFCHR;
77 | return 0;
78 | }
79 |
80 | /*
81 | sbrk
82 | Increase program data space.
83 | Malloc and related functions depend on this
84 | */
85 | register char * stack asm ("sp");
86 | caddr_t _sbrk(int incr) {
87 |
88 | extern char _ebss; // Defined by the linker
89 | static char *heap_end;
90 | char *prev_heap_end;
91 |
92 | if (heap_end == 0) {
93 | heap_end = &_ebss;
94 | }
95 | prev_heap_end = heap_end;
96 |
97 | //char * stack = (char*) __get_MSP();
98 | if (heap_end + incr > stack)
99 | {
100 | //_write (STDERR_FILENO, "Heap and stack collision\n", 25);
101 | errno = ENOMEM;
102 | return (caddr_t) -1;
103 | //abort ();
104 | }
105 |
106 | heap_end += incr;
107 | return (caddr_t) prev_heap_end;
108 |
109 | }
110 |
111 | /*
112 | read
113 | Read a character to a file. `libc' subroutines will use this system routine for input from all files, including stdin
114 | Returns -1 on error or blocks until the number of characters have been read.
115 | */
116 | int _read(int file, char *ptr, int len) {
117 | int n;
118 | int num = 0;
119 | switch (file) {
120 | case STDIN_FILENO:
121 | for (n = 0; n < len; n++) {
122 | #if STDIN_USART == 1
123 | while ((USART1->SR & USART_FLAG_RXNE) == (uint16_t)RESET) {}
124 | char c = (char)(USART1->DR & (uint16_t)0x01FF);
125 | #elif STDIN_USART == 2
126 | while ((USART2->SR & USART_FLAG_RXNE) == (uint16_t) RESET) {}
127 | char c = (char) (USART2->DR & (uint16_t) 0x01FF);
128 | #elif STDIN_USART == 3
129 | while ((USART3->SR & USART_FLAG_RXNE) == (uint16_t)RESET) {}
130 | char c = (char)(USART3->DR & (uint16_t)0x01FF);
131 | #endif
132 | *ptr++ = c;
133 | num++;
134 | }
135 | break;
136 | default:
137 | errno = EBADF;
138 | return -1;
139 | }
140 | return num;
141 | }
142 |
143 | int _write(int file, char *ptr, int len)
144 | {
145 | /* Place your implementation of fputc here */
146 | /* e.g. write a character to the USART */
147 | int counter;
148 |
149 | counter = len;
150 | for (; counter > 0; counter--)
151 | {
152 | if (*ptr == 0) break;
153 | while( !(USART2->SR & 0x00000040) );
154 | USART_SendData(USART2, *ptr);
155 |
156 | //USART_SendData(USART2, (uint16_t) (*ptr));
157 | /* Loop until the end of transmission */
158 | //while (USART_GetFlagStatus(USART2, USART_FLAG_TC) == RESET);
159 | ptr++;
160 | }
161 | return len;
162 | }
163 |
164 |
--------------------------------------------------------------------------------
/lib/CANopen/.gitignore:
--------------------------------------------------------------------------------
1 | #ignore build output
2 |
3 | *.o
4 | *.d
5 | *.a
6 | *.so
7 | *~
8 |
9 | #ignore vim temp files
10 | *.swp
11 | *.swo
12 |
--------------------------------------------------------------------------------
/lib/CANopen/LICENSE:
--------------------------------------------------------------------------------
1 | GNU LESSER GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 |
9 | This version of the GNU Lesser General Public License incorporates
10 | the terms and conditions of version 3 of the GNU General Public
11 | License, supplemented by the additional permissions listed below.
12 |
13 | 0. Additional Definitions.
14 |
15 | As used herein, "this License" refers to version 3 of the GNU Lesser
16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU
17 | General Public License.
18 |
19 | "The Library" refers to a covered work governed by this License,
20 | other than an Application or a Combined Work as defined below.
21 |
22 | An "Application" is any work that makes use of an interface provided
23 | by the Library, but which is not otherwise based on the Library.
24 | Defining a subclass of a class defined by the Library is deemed a mode
25 | of using an interface provided by the Library.
26 |
27 | A "Combined Work" is a work produced by combining or linking an
28 | Application with the Library. The particular version of the Library
29 | with which the Combined Work was made is also called the "Linked
30 | Version".
31 |
32 | The "Minimal Corresponding Source" for a Combined Work means the
33 | Corresponding Source for the Combined Work, excluding any source code
34 | for portions of the Combined Work that, considered in isolation, are
35 | based on the Application, and not on the Linked Version.
36 |
37 | The "Corresponding Application Code" for a Combined Work means the
38 | object code and/or source code for the Application, including any data
39 | and utility programs needed for reproducing the Combined Work from the
40 | Application, but excluding the System Libraries of the Combined Work.
41 |
42 | 1. Exception to Section 3 of the GNU GPL.
43 |
44 | You may convey a covered work under sections 3 and 4 of this License
45 | without being bound by section 3 of the GNU GPL.
46 |
47 | 2. Conveying Modified Versions.
48 |
49 | If you modify a copy of the Library, and, in your modifications, a
50 | facility refers to a function or data to be supplied by an Application
51 | that uses the facility (other than as an argument passed when the
52 | facility is invoked), then you may convey a copy of the modified
53 | version:
54 |
55 | a) under this License, provided that you make a good faith effort to
56 | ensure that, in the event an Application does not supply the
57 | function or data, the facility still operates, and performs
58 | whatever part of its purpose remains meaningful, or
59 |
60 | b) under the GNU GPL, with none of the additional permissions of
61 | this License applicable to that copy.
62 |
63 | 3. Object Code Incorporating Material from Library Header Files.
64 |
65 | The object code form of an Application may incorporate material from
66 | a header file that is part of the Library. You may convey such object
67 | code under terms of your choice, provided that, if the incorporated
68 | material is not limited to numerical parameters, data structure
69 | layouts and accessors, or small macros, inline functions and templates
70 | (ten or fewer lines in length), you do both of the following:
71 |
72 | a) Give prominent notice with each copy of the object code that the
73 | Library is used in it and that the Library and its use are
74 | covered by this License.
75 |
76 | b) Accompany the object code with a copy of the GNU GPL and this license
77 | document.
78 |
79 | 4. Combined Works.
80 |
81 | You may convey a Combined Work under terms of your choice that,
82 | taken together, effectively do not restrict modification of the
83 | portions of the Library contained in the Combined Work and reverse
84 | engineering for debugging such modifications, if you also do each of
85 | the following:
86 |
87 | a) Give prominent notice with each copy of the Combined Work that
88 | the Library is used in it and that the Library and its use are
89 | covered by this License.
90 |
91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license
92 | document.
93 |
94 | c) For a Combined Work that displays copyright notices during
95 | execution, include the copyright notice for the Library among
96 | these notices, as well as a reference directing the user to the
97 | copies of the GNU GPL and this license document.
98 |
99 | d) Do one of the following:
100 |
101 | 0) Convey the Minimal Corresponding Source under the terms of this
102 | License, and the Corresponding Application Code in a form
103 | suitable for, and under terms that permit, the user to
104 | recombine or relink the Application with a modified version of
105 | the Linked Version to produce a modified Combined Work, in the
106 | manner specified by section 6 of the GNU GPL for conveying
107 | Corresponding Source.
108 |
109 | 1) Use a suitable shared library mechanism for linking with the
110 | Library. A suitable mechanism is one that (a) uses at run time
111 | a copy of the Library already present on the user's computer
112 | system, and (b) will operate properly with a modified version
113 | of the Library that is interface-compatible with the Linked
114 | Version.
115 |
116 | e) Provide Installation Information, but only if you would otherwise
117 | be required to provide such information under section 6 of the
118 | GNU GPL, and only to the extent that such information is
119 | necessary to install and execute a modified version of the
120 | Combined Work produced by recombining or relinking the
121 | Application with a modified version of the Linked Version. (If
122 | you use option 4d0, the Installation Information must accompany
123 | the Minimal Corresponding Source and Corresponding Application
124 | Code. If you use option 4d1, you must provide the Installation
125 | Information in the manner specified by section 6 of the GNU GPL
126 | for conveying Corresponding Source.)
127 |
128 | 5. Combined Libraries.
129 |
130 | You may place library facilities that are a work based on the
131 | Library side by side in a single library together with other library
132 | facilities that are not Applications and are not covered by this
133 | License, and convey such a combined library under terms of your
134 | choice, if you do both of the following:
135 |
136 | a) Accompany the combined library with a copy of the same work based
137 | on the Library, uncombined with any other library facilities,
138 | conveyed under the terms of this License.
139 |
140 | b) Give prominent notice with the combined library that part of it
141 | is a work based on the Library, and explaining where to find the
142 | accompanying uncombined form of the same work.
143 |
144 | 6. Revised Versions of the GNU Lesser General Public License.
145 |
146 | The Free Software Foundation may publish revised and/or new versions
147 | of the GNU Lesser General Public License from time to time. Such new
148 | versions will be similar in spirit to the present version, but may
149 | differ in detail to address new problems or concerns.
150 |
151 | Each version is given a distinguishing version number. If the
152 | Library as you received it specifies that a certain numbered version
153 | of the GNU Lesser General Public License "or any later version"
154 | applies to it, you have the option of following the terms and
155 | conditions either of that published version or of any later version
156 | published by the Free Software Foundation. If the Library as you
157 | received it does not specify a version number of the GNU Lesser
158 | General Public License, you may choose any version of the GNU Lesser
159 | General Public License ever published by the Free Software Foundation.
160 |
161 | If the Library as you received it specifies that a proxy can decide
162 | whether future versions of the GNU Lesser General Public License shall
163 | apply, that proxy's public statement of acceptance of any version is
164 | permanent authorization for you to choose that version for the
165 | Library.
166 |
--------------------------------------------------------------------------------
/lib/CANopen/Object_Dictionary_Editor/about.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | About - CANopenNode Editor
6 |
7 |
8 | Introduction to Object Dictionary Editor
9 | CANopen Object dictionary is a collection of all the data items inside one device, which are accessible via CANopen network. Data items have specific type, for example UNSIGNED8, INTEGER32, VISIBLE_STRING, RECORD(structure in C), ARRAY, etc. Each data item within the object dictionary is addressed using a 16-bit index and an 8-bit sub-index.
10 | Objec dictionary editor is used for editing and creation of CANopenNode project specific files. Main project file is an XML file - device description file - _project.xml . It contains all CANopen specific information about one device. For example, it contains all the information, which are usually present in Electronic Data Sheel (EDS) file + much more. Other files created from device description file are: CANopen EDS file , HTML file as documentation and two C language files: CO_OD.h and CO_OD.c .
11 | Objec dictionary editor is a web application. Currently it has a little uncommon user interface. After files are created, they must be copy/pasted to regular text editor (notepad) and saved from there. Web application does not allow saving files directly.
12 |
13 | Prerequisites:
14 |
15 | Mozilla Firefox.
16 | If Firefox version is 4 or higher, following add-on must be installed: Remote-xul-manager
17 | After installation and restart, go to Developer submenu, Remote XUL Manager. Click Add, write "<file>" in textbox and click OK.
18 |
19 |
20 |
21 | Usage:
22 |
23 | Open "_project.html" in Firefox.
24 | First textbox is loaded with the contents of "_project.xml" file (device description XML file).
25 | Click "Open Editor".
26 | Use the editor.
27 | Click "Generate all files and return".
28 | After a while (on some computers it may take some more) returns the previous screen with six filled textboxes.
29 | Copy - Paste the text from textboxes into appropriate files. Don't forget copying the first textbox into the "_project.xml" file.
30 |
31 |
32 |
33 | CANopenNode Device description file format is specific for CANopenNode. Its body contain the following nodes:
34 |
35 | Features - Features must be edited, before Objects. For example, if the number of RPDO is changed, corresponding objects (0x1400+ and 0x1600+) are added or removed automatically.
36 | Objects - Objects from Device Object Dictionary. If ' ' is in the front of the index, it means that Object is disabled and won't be included in output files. However, CANopenNode Device description file will contain those objects.
37 | Other - Other information about the device.
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/lib/CANopen/Object_Dictionary_Editor/panels/_blank.xul:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
7 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/lib/CANopen/Object_Dictionary_Editor/panels/_readme.txt:
--------------------------------------------------------------------------------
1 | In this folder are XUL files, contents of which is integrating into device.xul file dinamically.
2 |
3 | Here is the workflow:
4 | - in the device.xul file is element with attribute id="rightBottomWindow". It is the parent window for any of the panels.
5 | - When there is a need for a new panel, function showPanelOrLoadIt(panelName, panelArgument) is called.
6 | - Function loops through all children of element and sets each children's attribute 'hidden' to 'true'.
7 | - if child node has attribute 'frameName' equal to panelName, it's attribute 'hidden' is set to 'false'.
8 | - if there is no such child node, then new child node is appended from xul file with filename qual to panelName. Also scripts from that file are evaluated. It's attribute 'frameName' is set to panelName and it's attribute 'hidden' is set to 'false'. At the function '{panelName}Init(panelArgument)' is called.
9 |
10 | Code from external xul file is now a part of device.xul file and behaves like that.
11 |
12 | For a new panel template '_blank.xul' can be used.
13 |
14 | NOTE: Some XUL elements like listboxes or menulists does not render properly, if they are added dinamically to main XUL file.
15 | For this reason some panels can not be in external file - they must be integrated into main XUL file.
--------------------------------------------------------------------------------
/lib/CANopen/Object_Dictionary_Editor/panels/editor.xul:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
7 |
8 |
9 |
10 |
11 | Introduction to Object Dictionary editor
12 | With this editor you can edit CANopenNode Device description files. Device description file is an XML file, which contains all CANopen specific information about one device. For example, it contains all the information, which are usually present in Electronic Data Sheel (EDS) file + much more.
13 | This is a web application, so it differs a little from classical desktop application. Web applications runs inside web browser and for security reasons it has no direct access to local file system. So user must handle opening and saving files a little different.
14 | If you want to start new project, press 'New Project ...' button, then there are three possibilities:
15 |
16 | Use one of the templates - template located on the web server will load into application.
17 | Paste project file text - First open your XML Device description file in your text editor, then select all (ctrl+a) text and copy (ctrl+c) it to the clipboard. Then paste (ctrl+v) the contents into text field in web application and press 'Import Project' button. This is the only way to use Device description files located on your computer.
18 | Load file from server - If you know for the another Device description file on server, you can type the name.
19 |
20 |
21 | If Device description file is successfully loaded, then tree is generated on the left side. You can choose any object from there. In the right window will appear the user inderface with objects data. For different type of object, different user interface is shown. There you can edit all properties of the object. Button with icon inside means, that you can edit label for that object. Label includes Name, Description and URI for one language. There can be more languages simultaneously.
22 | If you want to save curent (and edited) Device description file into your computer, there is one possibility: Press the 'Show Device description file' button. All the XML code will be shown in text field. then select all (ctrl+a) text and copy (ctrl+c) it to the clipboard. After that open your text editor, begin new file and paste (ctrl+v) the contents. You can then save the file on your computer. A good practice is to save Device description file occasionally.
23 | After all objects are properly configured, Click the button 'Validate and generate all output files'. The following files will be generated in a separate window:
24 |
25 | CANopenNode Device description file - this is the file, you are editing. It must be saved.
26 | CO_OD.h file - Header file for Object Dictionary - for CANopenNode stack.
27 | CO_OD.c file - Definition file for Object Dictionary - for CANopenNode stack.
28 | EDS specification file - Electronic data sheet for CANopen device - according to CiA DS 306 standard.
29 | XDD specification file - CANopen device description in XML format for CANopen device - according to CiA DSP 311 standard.
30 | Documentation source - Complete device description in HTML format - HTML source.
31 | Documentation view - Same documentation displayed in browser window.
32 |
33 | CANopenNode Device description file is the main file, which contains all the information. All other files are extracted from it. (Documentation files also include some external files from the doc folder.)
34 | And remember: don't press the refresh, back or forward buttons! You can lose all your changes.
35 |
36 | CANopenNode Device description file format is specific for CANopenNode. Its body contains following nodes, which you can see in the left window:
37 |
38 | Features - Features must be edited, before Objects. For example, if you change the number of RPDO, corresponding objects (0x1400+ and 0x1600+) will be added or removed automatically.
39 | Objects - Objects from Device Object Dictionary. If ' ' is in the front of the index, it means that Object is disabled and won't be included in output files. However, CANopenNode Device description file will contain those objects too. That makes creation of new objects easier.
40 | Other - Other information about the device.
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/lib/CANopen/Object_Dictionary_Editor/panels/features.xul:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
7 |
8 |
9 |
10 |
11 | Introduction to Features
12 | Features in CANopenNode device configurator are very helpful in both: 'Access Device' mode and Object Dictionary Editor.
13 | They are used for definition of some 'features of the device'. For example: CANopen device usually has specific number of Receive PDOs. With each RPDO are associated two objects in Object Dictionary: Communication parameter (index 1400+) and Mapping parameter (index 1600+) . Each of those parameters contains some variables. If we need to access all variables associated with one RPDO, we can access separate variables from both objects. This is true in mode 'Access Object Dictionary on Device'. In mode 'Access Device' accessing to one RPDO is easier. In the tree is instead of Objects 1400 and 1600 shown only 'PDO1'. After it is selected, special panel is loaded, which shows all the variables for that PDO on one page. This way manipulation with the PDO is easier.
14 | Features are most helpful in Object Dictionary Editor. When value of feature is changed, then number of associated objects in Object Dictionary is changed also. For example, if value for Receive PDO is changed from 4 to 2, then objects 1402, 1403, 1602 and 1603 are disabled. (If value is increased, corresponding objects are enabled, or added if they doesn't exist.)
15 | Features are also necessary for generation of source code for stack. Objects, which are multiplied by feature are joined in array. Also macro is generated, which stores feature value. Some features has no associated objects. They are used only for definition of macro.
16 | New feature can also be added to Features list. Actually there is only need to define name, value and optionally associated objects.
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/lib/CANopen/Object_Dictionary_Editor/panels/objects.xul:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
7 |
8 |
9 |
10 |
11 | Introduction to Objects
12 | Object dictionary in most important in CANopen. It contains many Objects, some of them are responsible for communication, some are specified by manufacturer and some are standardized for use with specific device profile.
13 | More about the objects can be read in other CANopen Literature
14 | In Object Dictionary Editor Objects can be added, removed or configured. Some objects, are managed by features, so they partially depends on them.
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/lib/CANopen/Object_Dictionary_Editor/panels/other.xul:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
7 |
8 |
9 |
10 |
11 | Other CANopen settings
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/lib/CANopen/Object_Dictionary_Editor/pict/disabled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zenglongGH/stm32f4-CANopen-project/3978d32dd86aadb9af3f4b475801d0a1d54c6231/lib/CANopen/Object_Dictionary_Editor/pict/disabled.png
--------------------------------------------------------------------------------
/lib/CANopen/Object_Dictionary_Editor/pict/question.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zenglongGH/stm32f4-CANopen-project/3978d32dd86aadb9af3f4b475801d0a1d54c6231/lib/CANopen/Object_Dictionary_Editor/pict/question.png
--------------------------------------------------------------------------------
/lib/CANopen/Object_Dictionary_Editor/util.js:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 |
3 | device.js - JavaScript code for CANopenNode device configurator - utility functions
4 |
5 | Copyright (C) 2007 Janez Paternoster, Slovenia
6 |
7 | This library is free software; you can redistribute it and/or
8 | modify it under the terms of the GNU Lesser General Public
9 | License as published by the Free Software Foundation; either
10 | version 2.1 of the License, or (at your option) any later version.
11 |
12 | This library is distributed in the hope that it will be useful,
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | Lesser General Public License for more details.
16 |
17 | You should have received a copy of the GNU Lesser General Public
18 | License along with this library; if not, write to the Free Software
19 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 |
21 |
22 | Author: janez.paternoster@siol.net
23 |
24 | *******************************************************************************/
25 |
26 | function g_getURLParameter(name){
27 | name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
28 | var regexS = "[\\?&]"+name+"=([^]*)";
29 | var regex = new RegExp(regexS);
30 | var results = regex.exec(window.location.href);
31 | if(results == null) return "";
32 | else return results[1];
33 | }
34 |
35 | function g_byteToHexString(number){
36 | var str = number.toString(16).toUpperCase();
37 | if(str.length == 1) str = "0" + str;
38 | return str.toUpperCase();
39 | }
40 |
41 | function g_wordToHexString(number){
42 | var str = number.toString(16).toUpperCase();
43 | str = "000" + str;
44 | str = str.slice(str.length-4);
45 | return str.toUpperCase();
46 | }
47 |
48 | function g_toEightCharString(string){
49 | string = string.substring(0, 8).toLowerCase();
50 | string = string.replace(/\W/g, "_"); //replace all non word characters with "_"
51 | return string;
52 | }
53 |
54 | function g_twoDigits(val){
55 | val = "0" + val;
56 | return val.slice(-2);
57 | }
58 |
59 | function g_createListitem(arrayOfColumns){
60 | //function creates new DOM listitem element with multiple columns, which can be appended to listbox
61 | var item = document.createElement("listitem");
62 | for(var i=0; i ../../od_config/src/CO_OD.c
22 | ./_project.xml -> ../../od_config/src/_project.xml
23 | ./inc
24 | ./CO_OD.h -> ../../od_config/inc/CO_OD.h
25 | ./doc
26 | ./Object_Dictionary_Editor
27 | ./od_config
28 | ./src
29 | ./CO_OD.c
30 | ./_project.xml
31 | ./inc
32 | ./CO_OD.h
33 |
--------------------------------------------------------------------------------
/lib/CANopen/doc/CANopen_stack/html/bc_s.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zenglongGH/stm32f4-CANopen-project/3978d32dd86aadb9af3f4b475801d0a1d54c6231/lib/CANopen/doc/CANopen_stack/html/bc_s.png
--------------------------------------------------------------------------------
/lib/CANopen/doc/CANopen_stack/html/bdwn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zenglongGH/stm32f4-CANopen-project/3978d32dd86aadb9af3f4b475801d0a1d54c6231/lib/CANopen/doc/CANopen_stack/html/bdwn.png
--------------------------------------------------------------------------------
/lib/CANopen/doc/CANopen_stack/html/closed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zenglongGH/stm32f4-CANopen-project/3978d32dd86aadb9af3f4b475801d0a1d54c6231/lib/CANopen/doc/CANopen_stack/html/closed.png
--------------------------------------------------------------------------------
/lib/CANopen/doc/CANopen_stack/html/doxygen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zenglongGH/stm32f4-CANopen-project/3978d32dd86aadb9af3f4b475801d0a1d54c6231/lib/CANopen/doc/CANopen_stack/html/doxygen.png
--------------------------------------------------------------------------------
/lib/CANopen/doc/CANopen_stack/html/dynsections.js:
--------------------------------------------------------------------------------
1 | function toggleVisibility(linkObj)
2 | {
3 | var base = $(linkObj).attr('id');
4 | var summary = $('#'+base+'-summary');
5 | var content = $('#'+base+'-content');
6 | var trigger = $('#'+base+'-trigger');
7 | var src=$(trigger).attr('src');
8 | if (content.is(':visible')===true) {
9 | content.hide();
10 | summary.show();
11 | $(linkObj).addClass('closed').removeClass('opened');
12 | $(trigger).attr('src',src.substring(0,src.length-8)+'closed.png');
13 | } else {
14 | content.show();
15 | summary.hide();
16 | $(linkObj).removeClass('closed').addClass('opened');
17 | $(trigger).attr('src',src.substring(0,src.length-10)+'open.png');
18 | }
19 | return false;
20 | }
21 |
22 | function updateStripes()
23 | {
24 | $('table.directory tr').
25 | removeClass('even').filter(':visible:even').addClass('even');
26 | }
27 | function toggleLevel(level)
28 | {
29 | $('table.directory tr').each(function(){
30 | var l = this.id.split('_').length-1;
31 | var i = $('#img'+this.id.substring(3));
32 | var a = $('#arr'+this.id.substring(3));
33 | if (l
2 |
3 |
4 |
5 |
6 | CANopenNode: Main Page
7 |
8 |
9 |
10 |
11 |
12 |
13 |
16 |
17 |
18 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 | CANopenNode
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
42 |
63 |
64 |
74 |
77 |
78 |
79 |
83 |
84 |
85 |
86 |
87 |
90 |
91 |
92 |
96 |
97 |
98 |
99 |
100 |
107 |
108 |
109 |
--------------------------------------------------------------------------------
/lib/CANopen/doc/CANopen_stack/html/nav_f.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zenglongGH/stm32f4-CANopen-project/3978d32dd86aadb9af3f4b475801d0a1d54c6231/lib/CANopen/doc/CANopen_stack/html/nav_f.png
--------------------------------------------------------------------------------
/lib/CANopen/doc/CANopen_stack/html/nav_g.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zenglongGH/stm32f4-CANopen-project/3978d32dd86aadb9af3f4b475801d0a1d54c6231/lib/CANopen/doc/CANopen_stack/html/nav_g.png
--------------------------------------------------------------------------------
/lib/CANopen/doc/CANopen_stack/html/nav_h.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zenglongGH/stm32f4-CANopen-project/3978d32dd86aadb9af3f4b475801d0a1d54c6231/lib/CANopen/doc/CANopen_stack/html/nav_h.png
--------------------------------------------------------------------------------
/lib/CANopen/doc/CANopen_stack/html/navtree.css:
--------------------------------------------------------------------------------
1 | #nav-tree .children_ul {
2 | margin:0;
3 | padding:4px;
4 | }
5 |
6 | #nav-tree ul {
7 | list-style:none outside none;
8 | margin:0px;
9 | padding:0px;
10 | }
11 |
12 | #nav-tree li {
13 | white-space:nowrap;
14 | margin:0px;
15 | padding:0px;
16 | }
17 |
18 | #nav-tree .plus {
19 | margin:0px;
20 | }
21 |
22 | #nav-tree .selected {
23 | background-image: url('tab_a.png');
24 | background-repeat:repeat-x;
25 | color: #fff;
26 | text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0);
27 | }
28 |
29 | #nav-tree img {
30 | margin:0px;
31 | padding:0px;
32 | border:0px;
33 | vertical-align: middle;
34 | }
35 |
36 | #nav-tree a {
37 | text-decoration:none;
38 | padding:0px;
39 | margin:0px;
40 | outline:none;
41 | }
42 |
43 | #nav-tree .label {
44 | margin:0px;
45 | padding:0px;
46 | font: 12px 'Lucida Grande',Geneva,Helvetica,Arial,sans-serif;
47 | }
48 |
49 | #nav-tree .label a {
50 | padding:2px;
51 | }
52 |
53 | #nav-tree .selected a {
54 | text-decoration:none;
55 | color:#fff;
56 | }
57 |
58 | #nav-tree .children_ul {
59 | margin:0px;
60 | padding:0px;
61 | }
62 |
63 | #nav-tree .item {
64 | margin:0px;
65 | padding:0px;
66 | }
67 |
68 | #nav-tree {
69 | padding: 0px 0px;
70 | background-color: #FAFAFF;
71 | font-size:14px;
72 | overflow:auto;
73 | }
74 |
75 | #doc-content {
76 | overflow:auto;
77 | display:block;
78 | padding:0px;
79 | margin:0px;
80 | -webkit-overflow-scrolling : touch; /* iOS 5+ */
81 | }
82 |
83 | #side-nav {
84 | padding:0 6px 0 0;
85 | margin: 0px;
86 | display:block;
87 | position: absolute;
88 | left: 0px;
89 | width: 300px;
90 | }
91 |
92 | .ui-resizable .ui-resizable-handle {
93 | display:block;
94 | }
95 |
96 | .ui-resizable-e {
97 | background:url("ftv2splitbar.png") repeat scroll right center transparent;
98 | cursor:e-resize;
99 | height:100%;
100 | right:0;
101 | top:0;
102 | width:6px;
103 | }
104 |
105 | .ui-resizable-handle {
106 | display:none;
107 | font-size:0.1px;
108 | position:absolute;
109 | z-index:1;
110 | }
111 |
112 | #nav-tree-contents {
113 | margin: 6px 0px 0px 0px;
114 | }
115 |
116 | #nav-tree {
117 | background-image:url('nav_h.png');
118 | background-repeat:repeat-x;
119 | background-color: #F9FAFC;
120 | -webkit-overflow-scrolling : touch; /* iOS 5+ */
121 | }
122 |
123 | #nav-sync {
124 | position:absolute;
125 | top:5px;
126 | right:24px;
127 | z-index:0;
128 | }
129 |
130 | #nav-sync img {
131 | opacity:0.3;
132 | }
133 |
134 | #nav-sync img:hover {
135 | opacity:0.9;
136 | }
137 |
138 | @media print
139 | {
140 | #nav-tree { display: none; }
141 | div.ui-resizable-handle { display: none; position: relative; }
142 | }
143 |
144 |
--------------------------------------------------------------------------------
/lib/CANopen/doc/CANopen_stack/html/navtreeindex0.js:
--------------------------------------------------------------------------------
1 | var NAVTREEINDEX0 =
2 | {
3 | "index.html":[],
4 | "pages.html":[]
5 | };
6 |
--------------------------------------------------------------------------------
/lib/CANopen/doc/CANopen_stack/html/open.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zenglongGH/stm32f4-CANopen-project/3978d32dd86aadb9af3f4b475801d0a1d54c6231/lib/CANopen/doc/CANopen_stack/html/open.png
--------------------------------------------------------------------------------
/lib/CANopen/doc/CANopen_stack/html/resize.js:
--------------------------------------------------------------------------------
1 | var cookie_namespace = 'doxygen';
2 | var sidenav,navtree,content,header;
3 |
4 | function readCookie(cookie)
5 | {
6 | var myCookie = cookie_namespace+"_"+cookie+"=";
7 | if (document.cookie)
8 | {
9 | var index = document.cookie.indexOf(myCookie);
10 | if (index != -1)
11 | {
12 | var valStart = index + myCookie.length;
13 | var valEnd = document.cookie.indexOf(";", valStart);
14 | if (valEnd == -1)
15 | {
16 | valEnd = document.cookie.length;
17 | }
18 | var val = document.cookie.substring(valStart, valEnd);
19 | return val;
20 | }
21 | }
22 | return 0;
23 | }
24 |
25 | function writeCookie(cookie, val, expiration)
26 | {
27 | if (val==undefined) return;
28 | if (expiration == null)
29 | {
30 | var date = new Date();
31 | date.setTime(date.getTime()+(10*365*24*60*60*1000)); // default expiration is one week
32 | expiration = date.toGMTString();
33 | }
34 | document.cookie = cookie_namespace + "_" + cookie + "=" + val + "; expires=" + expiration+"; path=/";
35 | }
36 |
37 | function resizeWidth()
38 | {
39 | var windowWidth = $(window).width() + "px";
40 | var sidenavWidth = $(sidenav).width();
41 | content.css({marginLeft:parseInt(sidenavWidth)+6+"px"}); //account for 6px-wide handle-bar
42 | writeCookie('width',sidenavWidth, null);
43 | }
44 |
45 | function restoreWidth(navWidth)
46 | {
47 | var windowWidth = $(window).width() + "px";
48 | content.css({marginLeft:parseInt(navWidth)+6+"px"});
49 | sidenav.css({width:navWidth + "px"});
50 | }
51 |
52 | function resizeHeight()
53 | {
54 | var headerHeight = header.height();
55 | var footerHeight = footer.height();
56 | var windowHeight = $(window).height() - headerHeight - footerHeight;
57 | content.css({height:windowHeight + "px"});
58 | navtree.css({height:windowHeight + "px"});
59 | sidenav.css({height:windowHeight + "px",top: headerHeight+"px"});
60 | }
61 |
62 | function initResizable()
63 | {
64 | header = $("#top");
65 | sidenav = $("#side-nav");
66 | content = $("#doc-content");
67 | navtree = $("#nav-tree");
68 | footer = $("#nav-path");
69 | $(".side-nav-resizable").resizable({resize: function(e, ui) { resizeWidth(); } });
70 | $(window).resize(function() { resizeHeight(); });
71 | var width = readCookie('width');
72 | if (width) { restoreWidth(width); } else { resizeWidth(); }
73 | resizeHeight();
74 | var url = location.href;
75 | var i=url.indexOf("#");
76 | if (i>=0) window.location.hash=url.substr(i);
77 | var _preventDefault = function(evt) { evt.preventDefault(); };
78 | $("#splitbar").bind("dragstart", _preventDefault).bind("selectstart", _preventDefault);
79 | $(document).bind('touchmove',function(e){
80 | try {
81 | var target = e.target;
82 | while (target) {
83 | if ($(target).css('-webkit-overflow-scrolling')=='touch') return;
84 | target = target.parentNode;
85 | }
86 | e.preventDefault();
87 | } catch(err) {
88 | e.preventDefault();
89 | }
90 | });
91 | }
92 |
93 |
94 |
--------------------------------------------------------------------------------
/lib/CANopen/doc/CANopen_stack/html/search/close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zenglongGH/stm32f4-CANopen-project/3978d32dd86aadb9af3f4b475801d0a1d54c6231/lib/CANopen/doc/CANopen_stack/html/search/close.png
--------------------------------------------------------------------------------
/lib/CANopen/doc/CANopen_stack/html/search/mag_sel.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zenglongGH/stm32f4-CANopen-project/3978d32dd86aadb9af3f4b475801d0a1d54c6231/lib/CANopen/doc/CANopen_stack/html/search/mag_sel.png
--------------------------------------------------------------------------------
/lib/CANopen/doc/CANopen_stack/html/search/nomatches.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/lib/CANopen/doc/CANopen_stack/html/search/search.css:
--------------------------------------------------------------------------------
1 | /*---------------- Search Box */
2 |
3 | #FSearchBox {
4 | float: left;
5 | }
6 |
7 | #MSearchBox {
8 | white-space : nowrap;
9 | position: absolute;
10 | float: none;
11 | display: inline;
12 | margin-top: 8px;
13 | right: 0px;
14 | width: 170px;
15 | z-index: 102;
16 | background-color: white;
17 | }
18 |
19 | #MSearchBox .left
20 | {
21 | display:block;
22 | position:absolute;
23 | left:10px;
24 | width:20px;
25 | height:19px;
26 | background:url('search_l.png') no-repeat;
27 | background-position:right;
28 | }
29 |
30 | #MSearchSelect {
31 | display:block;
32 | position:absolute;
33 | width:20px;
34 | height:19px;
35 | }
36 |
37 | .left #MSearchSelect {
38 | left:4px;
39 | }
40 |
41 | .right #MSearchSelect {
42 | right:5px;
43 | }
44 |
45 | #MSearchField {
46 | display:block;
47 | position:absolute;
48 | height:19px;
49 | background:url('search_m.png') repeat-x;
50 | border:none;
51 | width:116px;
52 | margin-left:20px;
53 | padding-left:4px;
54 | color: #909090;
55 | outline: none;
56 | font: 9pt Arial, Verdana, sans-serif;
57 | }
58 |
59 | #FSearchBox #MSearchField {
60 | margin-left:15px;
61 | }
62 |
63 | #MSearchBox .right {
64 | display:block;
65 | position:absolute;
66 | right:10px;
67 | top:0px;
68 | width:20px;
69 | height:19px;
70 | background:url('search_r.png') no-repeat;
71 | background-position:left;
72 | }
73 |
74 | #MSearchClose {
75 | display: none;
76 | position: absolute;
77 | top: 4px;
78 | background : none;
79 | border: none;
80 | margin: 0px 4px 0px 0px;
81 | padding: 0px 0px;
82 | outline: none;
83 | }
84 |
85 | .left #MSearchClose {
86 | left: 6px;
87 | }
88 |
89 | .right #MSearchClose {
90 | right: 2px;
91 | }
92 |
93 | .MSearchBoxActive #MSearchField {
94 | color: #000000;
95 | }
96 |
97 | /*---------------- Search filter selection */
98 |
99 | #MSearchSelectWindow {
100 | display: none;
101 | position: absolute;
102 | left: 0; top: 0;
103 | border: 1px solid #90A5CE;
104 | background-color: #F9FAFC;
105 | z-index: 1;
106 | padding-top: 4px;
107 | padding-bottom: 4px;
108 | -moz-border-radius: 4px;
109 | -webkit-border-top-left-radius: 4px;
110 | -webkit-border-top-right-radius: 4px;
111 | -webkit-border-bottom-left-radius: 4px;
112 | -webkit-border-bottom-right-radius: 4px;
113 | -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
114 | }
115 |
116 | .SelectItem {
117 | font: 8pt Arial, Verdana, sans-serif;
118 | padding-left: 2px;
119 | padding-right: 12px;
120 | border: 0px;
121 | }
122 |
123 | span.SelectionMark {
124 | margin-right: 4px;
125 | font-family: monospace;
126 | outline-style: none;
127 | text-decoration: none;
128 | }
129 |
130 | a.SelectItem {
131 | display: block;
132 | outline-style: none;
133 | color: #000000;
134 | text-decoration: none;
135 | padding-left: 6px;
136 | padding-right: 12px;
137 | }
138 |
139 | a.SelectItem:focus,
140 | a.SelectItem:active {
141 | color: #000000;
142 | outline-style: none;
143 | text-decoration: none;
144 | }
145 |
146 | a.SelectItem:hover {
147 | color: #FFFFFF;
148 | background-color: #3D578C;
149 | outline-style: none;
150 | text-decoration: none;
151 | cursor: pointer;
152 | display: block;
153 | }
154 |
155 | /*---------------- Search results window */
156 |
157 | iframe#MSearchResults {
158 | width: 60ex;
159 | height: 15em;
160 | }
161 |
162 | #MSearchResultsWindow {
163 | display: none;
164 | position: absolute;
165 | left: 0; top: 0;
166 | border: 1px solid #000;
167 | background-color: #EEF1F7;
168 | }
169 |
170 | /* ----------------------------------- */
171 |
172 |
173 | #SRIndex {
174 | clear:both;
175 | padding-bottom: 15px;
176 | }
177 |
178 | .SREntry {
179 | font-size: 10pt;
180 | padding-left: 1ex;
181 | }
182 |
183 | .SRPage .SREntry {
184 | font-size: 8pt;
185 | padding: 1px 5px;
186 | }
187 |
188 | body.SRPage {
189 | margin: 5px 2px;
190 | }
191 |
192 | .SRChildren {
193 | padding-left: 3ex; padding-bottom: .5em
194 | }
195 |
196 | .SRPage .SRChildren {
197 | display: none;
198 | }
199 |
200 | .SRSymbol {
201 | font-weight: bold;
202 | color: #425E97;
203 | font-family: Arial, Verdana, sans-serif;
204 | text-decoration: none;
205 | outline: none;
206 | }
207 |
208 | a.SRScope {
209 | display: block;
210 | color: #425E97;
211 | font-family: Arial, Verdana, sans-serif;
212 | text-decoration: none;
213 | outline: none;
214 | }
215 |
216 | a.SRSymbol:focus, a.SRSymbol:active,
217 | a.SRScope:focus, a.SRScope:active {
218 | text-decoration: underline;
219 | }
220 |
221 | span.SRScope {
222 | padding-left: 4px;
223 | }
224 |
225 | .SRPage .SRStatus {
226 | padding: 2px 5px;
227 | font-size: 8pt;
228 | font-style: italic;
229 | }
230 |
231 | .SRResult {
232 | display: none;
233 | }
234 |
235 | DIV.searchresults {
236 | margin-left: 10px;
237 | margin-right: 10px;
238 | }
239 |
--------------------------------------------------------------------------------
/lib/CANopen/doc/CANopen_stack/html/search/search_l.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zenglongGH/stm32f4-CANopen-project/3978d32dd86aadb9af3f4b475801d0a1d54c6231/lib/CANopen/doc/CANopen_stack/html/search/search_l.png
--------------------------------------------------------------------------------
/lib/CANopen/doc/CANopen_stack/html/search/search_m.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zenglongGH/stm32f4-CANopen-project/3978d32dd86aadb9af3f4b475801d0a1d54c6231/lib/CANopen/doc/CANopen_stack/html/search/search_m.png
--------------------------------------------------------------------------------
/lib/CANopen/doc/CANopen_stack/html/search/search_r.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zenglongGH/stm32f4-CANopen-project/3978d32dd86aadb9af3f4b475801d0a1d54c6231/lib/CANopen/doc/CANopen_stack/html/search/search_r.png
--------------------------------------------------------------------------------
/lib/CANopen/doc/CANopen_stack/html/sync_off.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zenglongGH/stm32f4-CANopen-project/3978d32dd86aadb9af3f4b475801d0a1d54c6231/lib/CANopen/doc/CANopen_stack/html/sync_off.png
--------------------------------------------------------------------------------
/lib/CANopen/doc/CANopen_stack/html/sync_on.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zenglongGH/stm32f4-CANopen-project/3978d32dd86aadb9af3f4b475801d0a1d54c6231/lib/CANopen/doc/CANopen_stack/html/sync_on.png
--------------------------------------------------------------------------------
/lib/CANopen/doc/CANopen_stack/html/tab_a.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zenglongGH/stm32f4-CANopen-project/3978d32dd86aadb9af3f4b475801d0a1d54c6231/lib/CANopen/doc/CANopen_stack/html/tab_a.png
--------------------------------------------------------------------------------
/lib/CANopen/doc/CANopen_stack/html/tab_b.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zenglongGH/stm32f4-CANopen-project/3978d32dd86aadb9af3f4b475801d0a1d54c6231/lib/CANopen/doc/CANopen_stack/html/tab_b.png
--------------------------------------------------------------------------------
/lib/CANopen/doc/CANopen_stack/html/tab_h.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zenglongGH/stm32f4-CANopen-project/3978d32dd86aadb9af3f4b475801d0a1d54c6231/lib/CANopen/doc/CANopen_stack/html/tab_h.png
--------------------------------------------------------------------------------
/lib/CANopen/doc/CANopen_stack/html/tab_s.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zenglongGH/stm32f4-CANopen-project/3978d32dd86aadb9af3f4b475801d0a1d54c6231/lib/CANopen/doc/CANopen_stack/html/tab_s.png
--------------------------------------------------------------------------------
/lib/CANopen/doc/CANopen_stack/html/tabs.css:
--------------------------------------------------------------------------------
1 | .tabs, .tabs2, .tabs3 {
2 | background-image: url('tab_b.png');
3 | width: 100%;
4 | z-index: 101;
5 | font-size: 13px;
6 | font-family: 'Lucida Grande',Geneva,Helvetica,Arial,sans-serif;
7 | }
8 |
9 | .tabs2 {
10 | font-size: 10px;
11 | }
12 | .tabs3 {
13 | font-size: 9px;
14 | }
15 |
16 | .tablist {
17 | margin: 0;
18 | padding: 0;
19 | display: table;
20 | }
21 |
22 | .tablist li {
23 | float: left;
24 | display: table-cell;
25 | background-image: url('tab_b.png');
26 | line-height: 36px;
27 | list-style: none;
28 | }
29 |
30 | .tablist a {
31 | display: block;
32 | padding: 0 20px;
33 | font-weight: bold;
34 | background-image:url('tab_s.png');
35 | background-repeat:no-repeat;
36 | background-position:right;
37 | color: #283A5D;
38 | text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9);
39 | text-decoration: none;
40 | outline: none;
41 | }
42 |
43 | .tabs3 .tablist a {
44 | padding: 0 10px;
45 | }
46 |
47 | .tablist a:hover {
48 | background-image: url('tab_h.png');
49 | background-repeat:repeat-x;
50 | color: #fff;
51 | text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0);
52 | text-decoration: none;
53 | }
54 |
55 | .tablist li.current a {
56 | background-image: url('tab_a.png');
57 | background-repeat:repeat-x;
58 | color: #fff;
59 | text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0);
60 | }
61 |
--------------------------------------------------------------------------------
/lib/CANopen/doc/CANopen_stack/latex/Makefile:
--------------------------------------------------------------------------------
1 | all: refman.pdf
2 |
3 | pdf: refman.pdf
4 |
5 | refman.pdf: clean refman.tex
6 | pdflatex refman
7 | makeindex refman.idx
8 | pdflatex refman
9 | latex_count=5 ; \
10 | while egrep -s 'Rerun (LaTeX|to get cross-references right)' refman.log && [ $$latex_count -gt 0 ] ;\
11 | do \
12 | echo "Rerunning latex...." ;\
13 | pdflatex refman ;\
14 | latex_count=`expr $$latex_count - 1` ;\
15 | done
16 |
17 |
18 | clean:
19 | rm -f *.ps *.dvi *.aux *.toc *.idx *.ind *.ilg *.log *.out *.brf *.blg *.bbl refman.pdf
20 |
--------------------------------------------------------------------------------
/lib/CANopen/doc/CANopen_stack/latex/refman.tex:
--------------------------------------------------------------------------------
1 | \documentclass{book}
2 | \usepackage[a4paper,top=2.5cm,bottom=2.5cm,left=2.5cm,right=2.5cm]{geometry}
3 | \usepackage{makeidx}
4 | \usepackage{natbib}
5 | \usepackage{graphicx}
6 | \usepackage{multicol}
7 | \usepackage{float}
8 | \usepackage{listings}
9 | \usepackage{color}
10 | \usepackage{ifthen}
11 | \usepackage[table]{xcolor}
12 | \usepackage{textcomp}
13 | \usepackage{alltt}
14 | \usepackage{ifpdf}
15 | \ifpdf
16 | \usepackage[pdftex,
17 | pagebackref=true,
18 | colorlinks=true,
19 | linkcolor=blue,
20 | unicode
21 | ]{hyperref}
22 | \else
23 | \usepackage[ps2pdf,
24 | pagebackref=true,
25 | colorlinks=true,
26 | linkcolor=blue,
27 | unicode
28 | ]{hyperref}
29 | \usepackage{pspicture}
30 | \fi
31 | \usepackage[utf8]{inputenc}
32 | \usepackage{mathptmx}
33 | \usepackage[scaled=.90]{helvet}
34 | \usepackage{courier}
35 | \usepackage{sectsty}
36 | \usepackage{amssymb}
37 | \usepackage[titles]{tocloft}
38 | \usepackage{doxygen}
39 | \lstset{language=C++,inputencoding=utf8,basicstyle=\footnotesize,breaklines=true,breakatwhitespace=true,tabsize=4,numbers=left }
40 | \makeindex
41 | \setcounter{tocdepth}{3}
42 | \renewcommand{\footrulewidth}{0.4pt}
43 | \renewcommand{\familydefault}{\sfdefault}
44 | \hfuzz=15pt
45 | \setlength{\emergencystretch}{15pt}
46 | \hbadness=750
47 | \tolerance=750
48 | \begin{document}
49 | \hypersetup{pageanchor=false,citecolor=blue}
50 | \begin{titlepage}
51 | \vspace*{7cm}
52 | \begin{center}
53 | {\Large C\-A\-Nopen\-Node }\\
54 | \vspace*{1cm}
55 | {\large Generated by Doxygen 1.8.1.2}\\
56 | \vspace*{0.5cm}
57 | {\small Fri Jul 19 2013 14:26:38}\\
58 | \end{center}
59 | \end{titlepage}
60 | \clearemptydoublepage
61 | \pagenumbering{roman}
62 | \tableofcontents
63 | \clearemptydoublepage
64 | \pagenumbering{arabic}
65 | \hypersetup{pageanchor=true,citecolor=blue}
66 | \printindex
67 | \end{document}
68 |
--------------------------------------------------------------------------------
/lib/CANopen/inc/CANopen.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Main CANopen stack file.
3 | *
4 | * It combines Object dictionary (CO_OD) and all other CANopen source files.
5 | * Configuration information are read from CO_OD.h file. This file may be
6 | * customized for different CANopen configuration. (One or multiple CANopen
7 | * device on one or multiple CAN modules.)
8 | *
9 | * @file CANopen.h
10 | * @ingroup CO_CANopen
11 | * @version SVN: \$Id: CANopen.h 32 2013-03-11 08:24:27Z jani22 $
12 | * @author Janez Paternoster
13 | * @copyright 2010 - 2013 Janez Paternoster
14 | *
15 | * This file is part of CANopenNode, an opensource CANopen Stack.
16 | * Project home page is .
17 | * For more information on CANopen see .
18 | *
19 | * CANopenNode is free software: you can redistribute it and/or modify
20 | * it under the terms of the GNU Lesser General Public License as published by
21 | * the Free Software Foundation, either version 3 of the License, or
22 | * (at your option) any later version.
23 | *
24 | * This program is distributed in the hope that it will be useful,
25 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 | * GNU Lesser General Public License for more details.
28 | *
29 | * You should have received a copy of the GNU Lesser General Public License
30 | * along with this program. If not, see .
31 | */
32 |
33 |
34 | #ifndef _CANopen_H
35 | #define _CANopen_H
36 |
37 |
38 | /**
39 | * @defgroup CO_CANopen CANopen stack
40 | * @{
41 | *
42 | *
43 | */
44 |
45 |
46 | #include "CO_driver.h"
47 | #include "CO_OD.h"
48 | #include "CO_SDO.h"
49 | #include "CO_Emergency.h"
50 | #include "CO_NMT_Heartbeat.h"
51 | #include "CO_SYNC.h"
52 | #include "CO_PDO.h"
53 | #include "CO_HBconsumer.h"
54 | #include "CO_timer.h"
55 | #if CO_NO_SDO_CLIENT == 1
56 | #include "CO_SDOmaster.h"
57 | #endif
58 |
59 |
60 | /**
61 | * @defgroup CO_CANopen_identifiers Default CANopen identifiers
62 | * @{
63 | *
64 | * Default CANopen identifiers for CANopen communication objects. Same as
65 | * 11-bit addresses of CAN messages. These are default identifiers and
66 | * can be changed in CANopen. Especially PDO identifiers are confgured
67 | * in PDO linking phase of the CANopen network configuration.
68 | */
69 | #define CO_CAN_ID_NMT_SERVICE 0x000 /**< Network management */
70 | #define CO_CAN_ID_SYNC 0x080 /**< Synchronous message */
71 | #define CO_CAN_ID_EMERGENCY 0x080 /**< Emergency messages (+nodeID) */
72 | #define CO_CAN_ID_TIME_STAMP 0x100 /**< Time stamp message */
73 | #define CO_CAN_ID_TPDO0 0x180 /**< Default TPDO1 (+nodeID) */
74 | #define CO_CAN_ID_RPDO0 0x200 /**< Default RPDO1 (+nodeID) */
75 | #define CO_CAN_ID_TPDO1 0x280 /**< Default TPDO2 (+nodeID) */
76 | #define CO_CAN_ID_RPDO1 0x300 /**< Default RPDO2 (+nodeID) */
77 | #define CO_CAN_ID_TPDO2 0x380 /**< Default TPDO3 (+nodeID) */
78 | #define CO_CAN_ID_RPDO2 0x400 /**< Default RPDO3 (+nodeID) */
79 | #define CO_CAN_ID_TPDO3 0x480 /**< Default TPDO4 (+nodeID) */
80 | #define CO_CAN_ID_RPDO3 0x500 /**< Default RPDO5 (+nodeID) */
81 | #define CO_CAN_ID_TSDO 0x580 /**< SDO response from server (+nodeID) */
82 | #define CO_CAN_ID_RSDO 0x600 /**< SDO request from client (+nodeID) */
83 | #define CO_CAN_ID_HEARTBEAT 0x700 /**< Heartbeat message */
84 | /** @} */
85 |
86 |
87 | /**
88 | * Number of CAN modules in use.
89 | *
90 | * If constant is set globaly to 2, second CAN module is initialized and fifth
91 | * and sixth RPDO (if exist) are configured to it.
92 | */
93 | #ifndef CO_NO_CAN_MODULES
94 | #define CO_NO_CAN_MODULES 1
95 | #endif
96 |
97 |
98 | /**
99 | * CANopen stack object combines pointers to all CANopen objects.
100 | */
101 | typedef struct{
102 | CO_CANmodule_t *CANmodule[CO_NO_CAN_MODULES];/**< CAN module objects */
103 | CO_SDO_t *SDO; /**< SDO object */
104 | CO_EM_t *EM; /**< Emergency report object */
105 | CO_EMpr_t *EMpr; /**< Emergency process object */
106 | CO_NMT_t *NMT; /**< NMT object */
107 | CO_SYNC_t *SYNC; /**< SYNC object */
108 | CO_RPDO_t *RPDO[CO_NO_RPDO];/**< RPDO objects */
109 | CO_TPDO_t *TPDO[CO_NO_TPDO];/**< TPDO objects */
110 | CO_HBconsumer_t *HBcons; /**< Heartbeat consumer object*/
111 | #if CO_NO_SDO_CLIENT == 1
112 | CO_SDOclient_t *SDOclient; /**< SDO client object */
113 | #endif
114 | }CO_t;
115 |
116 |
117 | /** CANopen object */
118 | extern CO_t *CO;
119 |
120 |
121 | /**
122 | * Function CO_sendNMTcommand() is simple function, which sends CANopen message.
123 | * This part of code is an example of custom definition of simple CANopen
124 | * object. Follow the code in CANopen.c file. If macro CO_NO_NMT_MASTER is 1,
125 | * function CO_sendNMTcommand can be used to send NMT master message.
126 | *
127 | * @param CO CANopen object.
128 | * @param command NMT command.
129 | * @param nodeID Node ID.
130 | *
131 | * @return 0: Operation completed successfully.
132 | * @return other: same as CO_CANsend().
133 | */
134 | #if CO_NO_NMT_MASTER == 1
135 | uint8_t CO_sendNMTcommand(CO_t *CO, uint8_t command, uint8_t nodeID);
136 | #endif
137 |
138 |
139 | /**
140 | * Initialize CANopen stack.
141 | *
142 | * Function must be called in the communication reset section.
143 | *
144 | * @return #CO_ReturnError_t: CO_ERROR_NO, CO_ERROR_ILLEGAL_ARGUMENT,
145 | * CO_ERROR_OUT_OF_MEMORY, CO_ERROR_ILLEGAL_BAUDRATE
146 | */
147 | int16_t CO_init();
148 |
149 |
150 | /**
151 | * Delete CANopen object and free memory. Must be called at program exit.
152 | */
153 | void CO_delete();
154 |
155 |
156 | /**
157 | * Process CANopen objects.
158 | *
159 | * Function must be called cyclically. It processes all "asynchronous" CANopen
160 | * objects. Function returns value from CO_NMT_process().
161 | *
162 | * @param CO This object
163 | * @param timeDifference_ms Time difference from previous function call in [milliseconds].
164 | *
165 | * @return 0: Normal return, no action.
166 | * @return 1: Application must provide communication reset.
167 | * @return 2: Application must provide complete device reset.
168 | */
169 | uint8_t CO_process(
170 | CO_t *CO,
171 | uint16_t timeDifference_ms);
172 |
173 |
174 | /**
175 | * Process CANopen SYNC and RPDO objects.
176 | *
177 | * Function must be called cyclically from synchronous 1ms task. It processes
178 | * SYNC and receive PDO CANopen objects.
179 | *
180 | * @param CO This object
181 | */
182 | void CO_process_RPDO(CO_t *CO);
183 |
184 |
185 | /**
186 | * Process CANopen TPDO objects.
187 | *
188 | * Function must be called cyclically from synchronous 1ms task. It processes
189 | * transmit PDO CANopen objects.
190 | *
191 | * @param CO This object
192 | */
193 | void CO_process_TPDO(CO_t *CO);
194 |
195 |
196 | /** @} */
197 | #endif
198 |
--------------------------------------------------------------------------------
/lib/CANopen/inc/CO_HBconsumer.h:
--------------------------------------------------------------------------------
1 | /**
2 | * CANopen Heartbeat consumer protocol.
3 | *
4 | * @file CO_HBconsumer.h
5 | * @ingroup CO_HBconsumer
6 | * @version SVN: \$Id: CO_HBconsumer.h 32 2013-03-11 08:24:27Z jani22 $
7 | * @author Janez Paternoster
8 | * @copyright 2004 - 2013 Janez Paternoster
9 | *
10 | * This file is part of CANopenNode, an opensource CANopen Stack.
11 | * Project home page is .
12 | * For more information on CANopen see .
13 | *
14 | * CANopenNode is free software: you can redistribute it and/or modify
15 | * it under the terms of the GNU Lesser General Public License as published by
16 | * the Free Software Foundation, either version 3 of the License, or
17 | * (at your option) any later version.
18 | *
19 | * This program is distributed in the hope that it will be useful,
20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 | * GNU Lesser General Public License for more details.
23 | *
24 | * You should have received a copy of the GNU Lesser General Public License
25 | * along with this program. If not, see .
26 | */
27 |
28 |
29 | #ifndef _CO_HB_CONS_H
30 | #define _CO_HB_CONS_H
31 |
32 |
33 | /**
34 | * @defgroup CO_HBconsumer Heartbeat consumer
35 | * @ingroup CO_CANopen
36 | * @{
37 | *
38 | * CANopen Heartbeat consumer protocol.
39 | *
40 | * Heartbeat consumer monitors Heartbeat messages from remote nodes. If any
41 | * monitored node don't send his Heartbeat in specified time, Heartbeat consumer
42 | * sends emergency message. If all monitored nodes are operational, then
43 | * variable _allMonitoredOperational_ inside CO_HBconsumer_t is set to true.
44 | * Monitoring starts after the reception of the first HeartBeat (not bootup).
45 | *
46 | * @see @ref CO_NMT_Heartbeat
47 | */
48 |
49 |
50 | /**
51 | * One monitored node inside CO_HBconsumer_t.
52 | */
53 | typedef struct{
54 | uint8_t NMTstate; /**< Of the remote node */
55 | uint8_t monStarted; /**< True after reception of the first Heartbeat mesage */
56 | uint16_t timeoutTimer; /**< Time since last heartbeat received */
57 | uint16_t time; /**< Consumer heartbeat time from OD */
58 | uint8_t CANrxNew; /**< True if new Heartbeat message received from the CAN bus */
59 | }CO_HBconsNode_t;
60 |
61 |
62 | /**
63 | * Heartbeat consumer object.
64 | *
65 | * Object is initilaized by CO_HBconsumer_init(). It contains an array of
66 | * CO_HBconsNode_t objects.
67 | */
68 | typedef struct{
69 | CO_EM_t *EM; /**< From CO_HBconsumer_init() */
70 | const uint32_t *HBconsTime; /**< From CO_HBconsumer_init() */
71 | CO_HBconsNode_t *monitoredNodes; /**< From CO_HBconsumer_init() */
72 | uint8_t numberOfMonitoredNodes; /**< From CO_HBconsumer_init() */
73 | /** True, if all monitored nodes are NMT operational or no node is
74 | monitored. Can be read by the application */
75 | uint8_t allMonitoredOperational;
76 | CO_CANmodule_t *CANdevRx; /**< From CO_HBconsumer_init() */
77 | uint16_t CANdevRxIdxStart; /**< From CO_HBconsumer_init() */
78 | }CO_HBconsumer_t;
79 |
80 |
81 | /**
82 | * Initialize Heartbeat consumer object.
83 | *
84 | * Function must be called in the communication reset section.
85 | *
86 | * @param HBcons This object will be initialized.
87 | * @param EM Emergency object.
88 | * @param SDO SDO server object.
89 | * @param HBconsTime Pointer to _Consumer Heartbeat Time_ array
90 | * from Object Dictionary (index 0x1016). Size of array is equal to numberOfMonitoredNodes.
91 | * @param monitoredNodes Pointer to the externaly defined array of the same size
92 | * as numberOfMonitoredNodes.
93 | * @param numberOfMonitoredNodes Total size of the above arrays.
94 | * @param CANdevRx CAN device for Heartbeat reception.
95 | * @param CANdevRxIdxStart Starting index of receive buffer in the above CAN device.
96 | * Number of used indexes is equal to numberOfMonitoredNodes.
97 | *
98 | * @return #CO_ReturnError_t CO_ERROR_NO or CO_ERROR_ILLEGAL_ARGUMENT.
99 | */
100 | int16_t CO_HBconsumer_init(
101 | CO_HBconsumer_t *HBcons,
102 | CO_EM_t *EM,
103 | CO_SDO_t *SDO,
104 | const uint32_t *HBconsTime,
105 | CO_HBconsNode_t *monitoredNodes,
106 | uint8_t numberOfMonitoredNodes,
107 | CO_CANmodule_t *CANdevRx,
108 | uint16_t CANdevRxIdxStart);
109 |
110 |
111 | /**
112 | * Process Heartbeat consumer object.
113 | *
114 | * Function must be called cyclically.
115 | *
116 | * @param HBcons This object.
117 | * @param NMTisPreOrOperational True if this node is NMT_PRE_OPERATIONAL or NMT_OPERATIONAL.
118 | * @param timeDifference_ms Time difference from previous function call in [milliseconds].
119 | */
120 | void CO_HBconsumer_process(
121 | CO_HBconsumer_t *HBcons,
122 | uint8_t NMTisPreOrOperational,
123 | uint16_t timeDifference_ms);
124 |
125 |
126 | /** @} */
127 | #endif
128 |
--------------------------------------------------------------------------------
/lib/CANopen/inc/CO_OD.h:
--------------------------------------------------------------------------------
1 | ../../od_config/inc/CO_OD.h
--------------------------------------------------------------------------------
/lib/CANopen/inc/CO_SYNC.h:
--------------------------------------------------------------------------------
1 | /**
2 | * CANopen SYNC object protocol.
3 | *
4 | * @file CO_SYNC.h
5 | * @ingroup CO_SYNC
6 | * @version SVN: \$Id: CO_SYNC.h 32 2013-03-11 08:24:27Z jani22 $
7 | * @author Janez Paternoster
8 | * @copyright 2004 - 2013 Janez Paternoster
9 | *
10 | * This file is part of CANopenNode, an opensource CANopen Stack.
11 | * Project home page is .
12 | * For more information on CANopen see .
13 | *
14 | * CANopenNode is free software: you can redistribute it and/or modify
15 | * it under the terms of the GNU Lesser General Public License as published by
16 | * the Free Software Foundation, either version 3 of the License, or
17 | * (at your option) any later version.
18 | *
19 | * This program is distributed in the hope that it will be useful,
20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 | * GNU Lesser General Public License for more details.
23 | *
24 | * You should have received a copy of the GNU Lesser General Public License
25 | * along with this program. If not, see .
26 | */
27 |
28 |
29 | #ifndef _CO_SYNC_H
30 | #define _CO_SYNC_H
31 |
32 |
33 | /**
34 | * @defgroup CO_SYNC SYNC
35 | * @ingroup CO_CANopen
36 | * @{
37 | *
38 | * CANopen SYNC object protocol.
39 | *
40 | * For CAN identifier see @ref CO_CANopen_identifiers.
41 | *
42 | * SYNC message is used for synchronization of the nodes on network. There is
43 | * one SYNC producer and zero or more SYNC consumers.
44 | *
45 | * ####Contents of SYNC message
46 | * By default SYNC message has no data. If _Synchronous counter overflow value_
47 | * from Object dictionary (index 0x1019) is different than 0, SYNC message has
48 | * one data byte: counter incremented by 1 with every SYNC transmission.
49 | */
50 |
51 |
52 | /**
53 | * SYNC producer and consumer object.
54 | */
55 | typedef struct{
56 | CO_EM_t *EM; /**< From CO_SYNC_init() */
57 | uint8_t *operatingState; /**< From CO_SYNC_init() */
58 | /** True, if device is SYNC producer. Calculated from _COB ID SYNC Message_
59 | variable from Object dictionary (index 0x1005). */
60 | uint8_t isProducer;
61 | /** COB_ID of SYNC message. Calculated from _COB ID SYNC Message_
62 | variable from Object dictionary (index 0x1005). */
63 | uint16_t COB_ID;
64 | /** Sync period time in [microseconds]. Calculated from _Communication cycle period_
65 | variable from Object dictionary (index 0x1006). */
66 | uint32_t periodTime;
67 | /** Sync period timeout time in [microseconds].
68 | (periodTimeoutTime = periodTime * 1,5) */
69 | uint32_t periodTimeoutTime;
70 | /** Value from _Synchronous counter overflow value_ variable from Object
71 | dictionary (index 0x1019) */
72 | uint8_t counterOverflowValue;
73 | /** True, if current time is inside synchronous window.
74 | In this case synchronous PDO may be sent. */
75 | uint8_t curentSyncTimeIsInsideWindow;
76 | /** True in operational, after first SYNC was received or transmitted */
77 | uint32_t running;
78 | /** Timer for the SYNC message in [microseconds].
79 | Set to zero after received or transmitted SYNC message */
80 | uint32_t timer;
81 | /** Counter of the SYNC message if counterOverflowValue is different than zero */
82 | uint8_t counter;
83 | CO_CANmodule_t *CANdevRx; /**< From CO_SYNC_init() */
84 | uint16_t CANdevRxIdx; /**< From CO_SYNC_init() */
85 | CO_CANmodule_t *CANdevTx; /**< From CO_SYNC_init() */
86 | CO_CANtx_t *CANtxBuff; /**< CAN transmit buffer inside CANdevTx */
87 | uint16_t CANdevTxIdx; /**< From CO_SYNC_init() */
88 | }CO_SYNC_t;
89 |
90 |
91 | /**
92 | * Initialize SYNC object.
93 | *
94 | * Function must be called in the communication reset section.
95 | *
96 | * @param SYNC This object will be initialized.
97 | * @param EM Emergency object.
98 | * @param SDO SDO server object.
99 | * @param operatingState Pointer to variable indicating CANopen device NMT internal state.
100 | * @param COB_ID_SYNCMessage From Object dictionary (index 0x1005).
101 | * @param communicationCyclePeriod From Object dictionary (index 0x1006).
102 | * @param synchronousCounterOverflowValue From Object dictionary (index 0x1019).
103 | * @param CANdevRx CAN device for SYNC reception.
104 | * @param CANdevRxIdx Index of receive buffer in the above CAN device.
105 | * @param CANdevTx CAN device for SYNC transmission.
106 | * @param CANdevTxIdx Index of transmit buffer in the above CAN device.
107 | *
108 | * @return #CO_ReturnError_t: CO_ERROR_NO or CO_ERROR_ILLEGAL_ARGUMENT.
109 | */
110 | int16_t CO_SYNC_init(
111 | CO_SYNC_t *SYNC,
112 | CO_EM_t *EM,
113 | CO_SDO_t *SDO,
114 | uint8_t *operatingState,
115 | uint32_t COB_ID_SYNCMessage,
116 | uint32_t communicationCyclePeriod,
117 | uint8_t synchronousCounterOverflowValue,
118 | CO_CANmodule_t *CANdevRx,
119 | uint16_t CANdevRxIdx,
120 | CO_CANmodule_t *CANdevTx,
121 | uint16_t CANdevTxIdx);
122 |
123 |
124 | /**
125 | * Process SYNC communication.
126 | *
127 | * Function must be called cyclically.
128 | *
129 | * @param SYNC This object.
130 | * @param timeDifference_us Time difference from previous function call in [microseconds].
131 | * @param ObjDict_synchronousWindowLength _Synchronous window length_ variable from
132 | * Object dictionary (index 0x1007).
133 | *
134 | * @return 0: No special meaning.
135 | * @return 1: New SYNC message recently received or was just transmitted.
136 | * @return 2: SYNC time was just passed out of window.
137 | */
138 | uint8_t CO_SYNC_process(
139 | CO_SYNC_t *SYNC,
140 | uint32_t timeDifference_us,
141 | uint32_t ObjDict_synchronousWindowLength);
142 |
143 |
144 | /** @} */
145 | #endif
146 |
--------------------------------------------------------------------------------
/lib/CANopen/inc/CO_timer.h:
--------------------------------------------------------------------------------
1 | /*
2 | * timer.h
3 | *
4 | * Created on: 13.9.2012
5 | * Author: one
6 | */
7 |
8 | #ifndef TIMER_H_
9 | #define TIMER_H_
10 | #include "CO_driver.h"
11 |
12 | typedef unsigned int (*pf_getTimerVal_us)();
13 |
14 | typedef struct {
15 | uint32_t savedTime;
16 | } ttimer;
17 |
18 | int initTimer(pf_getTimerVal_us gett);
19 | void saveTime(ttimer *tim);
20 | uint32_t getTime_ms(ttimer *tim);
21 | uint32_t getTime_us(ttimer *tim);
22 |
23 | #endif /* TIMER_H_ */
24 |
--------------------------------------------------------------------------------
/lib/CANopen/inc/STM32/CO_config.h:
--------------------------------------------------------------------------------
1 | ../../../od_config/inc/CO_config.h
--------------------------------------------------------------------------------
/lib/CANopen/inc/STM32/CO_driver.h:
--------------------------------------------------------------------------------
1 | /*
2 | * CAN module object for Microchip STM32F4xx microcontroller.
3 | *
4 | * @file CO_driver.h
5 | * @version SVN: \$Id: CO_driver.h 278 2013-03-04 17:11:47Z jani $
6 | * @author Janez Paternoster
7 | * @author Ondrej Netik
8 | * @copyright 2004 - 2013 Janez Paternoster, Ondrej Netik
9 | *
10 | * This file is part of CANopenNode, an opensource CANopen Stack.
11 | * Project home page is .
12 | * For more information on CANopen see .
13 | *
14 | * CANopenNode is free software: you can redistribute it and/or modify
15 | * it under the terms of the GNU Lesser General Public License as published by
16 | * the Free Software Foundation, either version 3 of the License, or
17 | * (at your option) any later version.
18 | *
19 | * This program is distributed in the hope that it will be useful,
20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 | * GNU Lesser General Public License for more details.
23 | *
24 | * You should have received a copy of the GNU Lesser General Public License
25 | * along with this program. If not, see .
26 | */
27 |
28 |
29 | #ifndef _CO_DRIVER_H
30 | #define _CO_DRIVER_H
31 |
32 | #include "stm32f4xx_conf.h"
33 |
34 | #define PACKED_STRUCT __attribute__((packed))
35 | #define ALIGN_STRUCT_DWORD __attribute__((aligned(4)))
36 |
37 |
38 | /* Peripheral addresses */
39 | #define ADDR_CAN1 CAN1
40 |
41 |
42 | /* Disabling interrupts */
43 | #define DISABLE_INTERRUPTS() __set_PRIMASK(1);
44 | #define ENABLE_INTERRUPTS() __set_PRIMASK(0);
45 |
46 |
47 | /* Data types */
48 | typedef unsigned char uint8_t;
49 | typedef unsigned short int uint16_t;
50 | typedef unsigned long int uint32_t;
51 | typedef unsigned long long int uint64_t;
52 | typedef signed char int8_t;
53 | typedef signed short int int16_t;
54 | typedef signed long int int32_t;
55 | typedef signed long long int int64_t;
56 | typedef float float32_t;
57 | typedef long double float64_t;
58 | typedef char char_t;
59 | typedef unsigned char oChar_t;
60 | typedef unsigned char domain_t;
61 |
62 |
63 | /* Return values */
64 | typedef enum{
65 | CO_ERROR_NO = 0,
66 | CO_ERROR_ILLEGAL_ARGUMENT = -1,
67 | CO_ERROR_OUT_OF_MEMORY = -2,
68 | CO_ERROR_TIMEOUT = -3,
69 | CO_ERROR_ILLEGAL_BAUDRATE = -4,
70 | CO_ERROR_RX_OVERFLOW = -5,
71 | CO_ERROR_RX_PDO_OVERFLOW = -6,
72 | CO_ERROR_RX_MSG_LENGTH = -7,
73 | CO_ERROR_RX_PDO_LENGTH = -8,
74 | CO_ERROR_TX_OVERFLOW = -9,
75 | CO_ERROR_TX_PDO_WINDOW = -10,
76 | CO_ERROR_TX_UNCONFIGURED = -11,
77 | CO_ERROR_PARAMETERS = -12,
78 | CO_ERROR_DATA_CORRUPT = -13,
79 | CO_ERROR_CRC = -14
80 | }CO_ReturnError_t;
81 |
82 |
83 | /* CAN receive message structure as aligned in CAN module.
84 | * prevzato z stm32f10_can.h - velikostne polozky a poradi odpovidaji. */
85 | typedef struct{
86 | uint32_t ident; /* Standard Identifier */
87 | uint32_t ExtId; /* Specifies the extended identifier */
88 | uint8_t IDE; /* Specifies the type of identifier for the
89 | message that will be received */
90 | uint8_t RTR; /* Remote Transmission Request bit */
91 | uint8_t DLC; /* Data length code (bits 0...3) */
92 | uint8_t data[8]; /* 8 data bytes */
93 | uint8_t FMI; /* Specifies the index of the filter the message
94 | stored in the mailbox passes through */
95 | }CO_CANrxMsg_t;
96 |
97 |
98 | /* Received message object */
99 | typedef struct{
100 | uint16_t ident;
101 | uint16_t mask;
102 | void *object;
103 | int16_t (*pFunct)(void *object, CO_CANrxMsg_t *message);
104 | }CO_CANrx_t;
105 |
106 |
107 | /* Transmit message object. */
108 | typedef struct{
109 | uint32_t ident;
110 | uint8_t DLC;
111 | uint8_t data[8];
112 | volatile uint8_t bufferFull;
113 | volatile uint8_t syncFlag;
114 | }CO_CANtx_t;/* ALIGN_STRUCT_DWORD; */
115 |
116 |
117 | /* CAN module object. */
118 | typedef struct{
119 | CAN_TypeDef *CANbaseAddress; /* STM32F4xx specific */
120 | CO_CANrx_t *rxArray;
121 | uint16_t rxSize;
122 | CO_CANtx_t *txArray;
123 | uint16_t txSize;
124 | volatile uint8_t *curentSyncTimeIsInsideWindow;
125 | volatile uint8_t useCANrxFilters;
126 | volatile uint8_t bufferInhibitFlag;
127 | volatile uint8_t firstCANtxMessage;
128 | volatile uint16_t CANtxCount;
129 | uint32_t errOld;
130 | void *EM;
131 | uint8_t transmittingAborted; /* STM32F4xx specific */
132 | }CO_CANmodule_t;
133 |
134 |
135 | /* Init CAN Led Interface */
136 | typedef enum {
137 | eCoLed_None = 0,
138 | eCoLed_Green = 1,
139 | eCoLed_Red = 2,
140 | } eCoLeds;
141 |
142 | void InitCanLeds();
143 | void CanLedsOn(eCoLeds led);
144 | void CanLedsOff(eCoLeds led);
145 | void CanLedsSet(eCoLeds led);
146 |
147 |
148 | /* Endianes */
149 | #ifdef __BIG_ENDIAN__
150 | #define BIG_ENDIAN
151 | #endif
152 | void memcpySwap2(uint8_t* dest, uint8_t* src);
153 | void memcpySwap4(uint8_t* dest, uint8_t* src);
154 |
155 |
156 | /* Request CAN configuration or normal mode */
157 | void CO_CANsetConfigurationMode(CAN_TypeDef *CANbaseAddress);
158 | void CO_CANsetNormalMode(CAN_TypeDef *CANbaseAddress);
159 |
160 |
161 | /* Initialize CAN module object. */
162 | int16_t CO_CANmodule_init(
163 | CO_CANmodule_t *CANmodule,
164 | CAN_TypeDef *CANbaseAddress,
165 | CO_CANrx_t *rxArray,
166 | uint16_t rxSize,
167 | CO_CANtx_t *txArray,
168 | uint16_t txSize,
169 | uint16_t CANbitRate);
170 |
171 |
172 | /* Switch off CANmodule. */
173 | void CO_CANmodule_disable(CO_CANmodule_t *CANmodule);
174 |
175 |
176 | /* Read CAN identifier */
177 | uint16_t CO_CANrxMsg_readIdent(CO_CANrxMsg_t *rxMsg);
178 |
179 |
180 | /* Configure CAN message receive buffer. */
181 | int16_t CO_CANrxBufferInit(
182 | CO_CANmodule_t *CANmodule,
183 | uint16_t index,
184 | uint16_t ident,
185 | uint16_t mask,
186 | uint8_t rtr,
187 | void *object,
188 | int16_t (*pFunct)(void *object, CO_CANrxMsg_t *message));
189 |
190 |
191 | /* Configure CAN message transmit buffer. */
192 | CO_CANtx_t *CO_CANtxBufferInit(
193 | CO_CANmodule_t *CANmodule,
194 | uint16_t index,
195 | uint16_t ident,
196 | uint8_t rtr,
197 | uint8_t noOfBytes,
198 | uint8_t syncFlag);
199 |
200 |
201 | /* Send CAN message. */
202 | int16_t CO_CANsend(CO_CANmodule_t *CANmodule, CO_CANtx_t *buffer);
203 |
204 |
205 | /* Clear all synchronous TPDOs from CAN module transmit buffers. */
206 | void CO_CANclearPendingSyncPDOs(CO_CANmodule_t *CANmodule);
207 |
208 |
209 | /* Verify all errors of CAN module. */
210 | void CO_CANverifyErrors(CO_CANmodule_t *CANmodule);
211 |
212 |
213 | /* CAN interrupts receives and transmits CAN messages. */
214 | void CO_CANinterrupt_Rx(CO_CANmodule_t *CANmodule);
215 |
216 | void CO_CANinterrupt_Tx(CO_CANmodule_t *CANmodule);
217 |
218 | void CO_CANinterrupt_Status(CO_CANmodule_t *CANmodule);
219 |
220 | void CO_CANsendToModule(CO_CANmodule_t *CANmodule, CO_CANtx_t *buffer, uint8_t transmit_mailbox);
221 |
222 | int CO_CANrecFromModule(CO_CANmodule_t *CANmodule, uint8_t FIFONumber, CO_CANrxMsg_t* RxMessage);
223 |
224 |
225 | #endif
226 |
--------------------------------------------------------------------------------
/lib/CANopen/inc/STM32/eeprom.h:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 |
3 | File: eeprom.h
4 | Object for retentive storage of Object Dictionary.
5 |
6 | Copyright (C) 2004-2010 Janez Paternoster
7 |
8 | License: GNU Lesser General Public License (LGPL).
9 |
10 |
11 | */
12 | /*
13 | This program is free software: you can redistribute it and/or modify
14 | it under the terms of the GNU Lesser General Public License as published by
15 | the Free Software Foundation, either version 3 of the License, or
16 | (at your option) any later version.
17 |
18 | This program is distributed in the hope that it will be useful,
19 | but WITHOUT ANY WARRANTY; without even the implied warranty of
20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 | GNU Lesser General Public License for more details.
22 |
23 | You should have received a copy of the GNU Lesser General Public License
24 | along with this program. If not, see .
25 |
26 |
27 | Author: Janez Paternoster
28 |
29 | *******************************************************************************/
30 |
31 | #ifndef _EEPROM_H
32 | #define _EEPROM_H
33 |
34 |
35 | #include "CO_driver.h"
36 | #include "CO_OD.h"
37 |
38 | /*******************************************************************************
39 | Topic: EEPROM
40 |
41 | Usage of device file system or SRAM for storing non-volatile variables.
42 |
43 | Two blocks of CANopen Object Dictionary data are stored as non-volatile:
44 | OD_EEPROM - Stored is in internal battery powered SRAM from address 0. Data
45 | are stored automatically on change. No data corruption control
46 | is made. Data are load on startup.
47 | OD_ROM - Stored in file named "OD_ROM01.dat". Data integrity is
48 | verified with CRC.
49 | Data are stored on special CANopen command - Writing 0x65766173
50 | into Object dictionary (index 1010, subindex 1). Default values
51 | are restored after reset, if writing 0x64616F6C into (1011, 1).
52 | *******************************************************************************/
53 |
54 |
55 | /*******************************************************************************
56 | Object: EE_t
57 |
58 | Variables for eeprom object.
59 |
60 | Variables:
61 | OD_EEPROMAddress - See parameters in .
62 | OD_EEPROMSize - OD_EEPROMSize in words (not bytes).
63 | OD_ROMAddress - See parameters in .
64 | OD_ROMSize - See parameters in .
65 | pSRAM - Pointer to start address of the battery powered SRAM
66 | OD_EEPROMCurrentIndex - Internal variable controls the OD_EEPROM vrite.
67 | *******************************************************************************/
68 | typedef struct{
69 | UNSIGNED32 *OD_EEPROMAddress;
70 | UNSIGNED32 OD_EEPROMSize;
71 | UNSIGNED8 *OD_ROMAddress;
72 | UNSIGNED32 OD_ROMSize;
73 | UNSIGNED32 *pSRAM;
74 | UNSIGNED32 OD_EEPROMCurrentIndex;
75 | }EE_t;
76 |
77 |
78 | /*******************************************************************************
79 | Function: EE_init_1
80 |
81 | First part of eeprom initialization. Called once after microcontroller reset.
82 |
83 | Allocate memory for object, configure SPI port for use with 25LCxxx, read
84 | eeprom and store to OD_EEPROM and OD_ROM.
85 |
86 | Variables:
87 | ppEE - Pointer to address of eeprom object .
88 | OD_EEPROMAddress - Address of OD_EEPROM structure from object dictionary.
89 | OD_EEPROMSize - Size of OD_EEPROM structure from object dictionary.
90 | OD_ROMAddress - Address of OD_ROM structure from object dictionary.
91 | OD_ROMSize - Size of OD_ROM structure from object dictionary.
92 |
93 | Return:
94 | CO_ERROR_NO - Operation completed successfully.
95 | CO_ERROR_OUT_OF_MEMORY - Memory allocation failed.
96 | CO_ERROR_DATA_CORRUPT - Data in eeprom corrupt.
97 | CO_ERROR_CRC - CRC from MBR does not match the CRC of OD_ROM block in eeprom.
98 | *******************************************************************************/
99 | INTEGER16 EE_init_1(
100 | EE_t **ppEE,
101 | UNSIGNED8 *OD_EEPROMAddress,
102 | UNSIGNED32 OD_EEPROMSize,
103 | UNSIGNED8 *OD_ROMAddress,
104 | UNSIGNED32 OD_ROMSize);
105 |
106 |
107 | /*******************************************************************************
108 | Function: EE_delete
109 |
110 | Delete EEPROM object and free memory.
111 |
112 | Parameters:
113 | ppEE - Pointer to pointer to EEPROM object .
114 | Pointer to object is set to 0.
115 | *******************************************************************************/
116 | void EE_delete(EE_t **ppEE);
117 |
118 |
119 | /*******************************************************************************
120 | Function: EE_init_2
121 |
122 | Second part of eeprom initialization. Called after CANopen communication reset.
123 |
124 | Call functions CO_OD_configureArgumentForODF() and CO_errorReport() if necessary.
125 |
126 | Variables:
127 | EE - Pointer eeprom object .
128 | EEStatus - Return value from .
129 | SDO - Pointer to SDO object .
130 | EM - Pointer to Emergency object .
131 | *******************************************************************************/
132 | #define EE_init_2(EE, EEStatus, SDO, EM) \
133 | CO_OD_configureArgumentForODF(SDO, 0x1010, (void*)EE); \
134 | CO_OD_configureArgumentForODF(SDO, 0x1011, (void*)EE); \
135 | if(EEStatus) CO_errorReport(EM, ERROR_NON_VOLATILE_MEMORY, EEStatus)
136 |
137 |
138 | /*******************************************************************************
139 | Function: EE_process
140 |
141 | Process eeprom object.
142 |
143 | Function must be called cyclically. It strores variables from OD_EEPROM data
144 | block into eeprom byte by byte (only if values are different).
145 |
146 | Parameters:
147 | EE - Pointer to eeprom object .
148 | *******************************************************************************/
149 | void EE_process(EE_t *EE);
150 |
151 |
152 | /*******************************************************************************
153 | Function: CRC16
154 |
155 | Calculate 16 bit CRC code from string.
156 |
157 | See DALLAS Application Note 27.
158 |
159 | Parameters:
160 | str - Pointer to array of characters.
161 | len - Length of above array.
162 |
163 | Return:
164 | Calculated CRC value of the str.
165 | *******************************************************************************/
166 | UNSIGNED16 CRC16(UNSIGNED8 *str, UNSIGNED16 len);
167 |
168 |
169 | #endif
170 |
--------------------------------------------------------------------------------
/lib/CANopen/inc/STM32/hwconfig.h:
--------------------------------------------------------------------------------
1 | #ifndef _HWCONFIG_H
2 | #define _HWCONFIG_H
3 |
4 |
5 | #pragma pack(4)
6 |
7 |
8 | /* CAN interface */
9 | #define CLOCK_CAN RCC_APB1Periph_CAN1
10 | #define CLOCK_GPIO_CAN RCC_AHB1Periph_GPIOD
11 |
12 | #define CAN_RX_PIN GPIO_Pin_11
13 | #define CAN_TX_PIN GPIO_Pin_12
14 | #define CAN_GPIO_PORT GPIOA
15 | #define CAN_GPIO_CLK RCC_AHB1Periph_GPIOA
16 | #define CAN_AF_PORT GPIO_AF_CAN1
17 | #define CAN_RX_SOURCE GPIO_PinSource0
18 | #define CAN_TX_SOURCE GPIO_PinSource1
19 |
20 | /* LED interface */
21 | #define RCC_APB2Periph_GPIO_LED RCC_AHB1Periph_GPIOB
22 | #define GPIO_LEDS GPIOB
23 | #define GPIO_Pin_Led_GREEN GPIO_Pin_15
24 | #define GPIO_Pin_Led_RED GPIO_Pin_14
25 | #define LED_POSITIVE
26 |
27 | /* Debug Interface */
28 | #define USART_DBG USART1
29 | #define USART_DBG_CLK RCC_APB2Periph_USART1
30 | #define GPIO_Remapping_DBG GPIO_Remap_USART1
31 |
32 | #define USART_DBG_GPIO GPIOB
33 | #define USART_DBG_GPIO_CLK RCC_APB2Periph_GPIOB
34 | #define USART_DBG_RxPin GPIO_Pin_7
35 | #define USART_DBG_TxPin GPIO_Pin_6
36 | #define USART_DBG_Remap_State ENABLE
37 |
38 |
39 |
40 | #endif
41 |
--------------------------------------------------------------------------------
/lib/CANopen/inc/application.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Application interface for CANopenNode stack.
3 | *
4 | * @file application.h
5 | * @ingroup CO_application
6 | * @version SVN: \$Id: application.h 31 2013-03-08 17:57:40Z jani22 $
7 | * @author Janez Paternoster
8 | * @copyright 2012 - 2013 Janez Paternoster
9 | *
10 | * This file is part of CANopenNode, an opensource CANopen Stack.
11 | * Project home page is .
12 | * For more information on CANopen see .
13 | *
14 | * CANopenNode is free software: you can redistribute it and/or modify
15 | * it under the terms of the GNU Lesser General Public License as published by
16 | * the Free Software Foundation, either version 3 of the License, or
17 | * (at your option) any later version.
18 | *
19 | * This program is distributed in the hope that it will be useful,
20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 | * GNU Lesser General Public License for more details.
23 | *
24 | * You should have received a copy of the GNU Lesser General Public License
25 | * along with this program. If not, see .
26 | */
27 |
28 |
29 | #ifndef _CO_APPLICATION_H
30 | #define _CO_APPLICATION_H
31 |
32 |
33 | /**
34 | * @defgroup CO_application Application interface
35 | * @ingroup CO_CANopen
36 | * @{
37 | *
38 | * Application interface for CANopenNode stack. Function is called
39 | * from file main_xxx.c (if implemented).
40 | *
41 | * ###Main program flow chart
42 | *
43 | * @code
44 | (Program Start)
45 | |
46 | V
47 | +------------------------------------+
48 | | programStart() |
49 | +------------------------------------+
50 | |
51 | |<-------------------------+
52 | | |
53 | V |
54 | (Initialze CANopen) |
55 | | |
56 | V |
57 | +------------------------------------+ |
58 | | communicationReset() | |
59 | +------------------------------------+ |
60 | | |
61 | V |
62 | (Enable CAN and interrupts) |
63 | | |
64 | |<----------------------+ |
65 | | | |
66 | V | |
67 | +------------------------------------+ | |
68 | | programAsync() | | |
69 | +------------------------------------+ | |
70 | | | |
71 | V | |
72 | (Process CANopen asynchronous) | |
73 | | | |
74 | +- infinite loop -------+ |
75 | | |
76 | +- reset communication ----+
77 | |
78 | V
79 | +------------------------------------+
80 | | programEnd() |
81 | +------------------------------------+
82 | |
83 | V
84 | (delete CANopen)
85 | |
86 | V
87 | (Program end)
88 | @endcode
89 | *
90 | *
91 | * ###Timer program flow chart
92 | *
93 | * @code
94 | (Timer interrupt 1 millisecond)
95 | |
96 | V
97 | (CANopen read RPDOs)
98 | |
99 | V
100 | +------------------------------------+
101 | | program1ms() |
102 | +------------------------------------+
103 | |
104 | V
105 | (CANopen write TPDOs)
106 | @endcode
107 | *
108 | *
109 | * ###Receive and transmit high priority interrupt flow chart
110 | *
111 | * @code
112 | (CAN receive event or)
113 | (CAN transmit buffer empty event)
114 | |
115 | V
116 | (Process received CAN message or)
117 | (copy next message to CAN transmit buffer)
118 | @endcode
119 | */
120 |
121 |
122 | /**
123 | * Called after microcontroller reset.
124 | */
125 | void programStart(void);
126 |
127 |
128 | /**
129 | * Called after communication reset.
130 | */
131 | void communicationReset(void);
132 |
133 |
134 | /**
135 | * Called before program end.
136 | */
137 | void programEnd(void);
138 |
139 |
140 | /**
141 | * Called cyclically from main.
142 | *
143 | * @param timer1msDiff Time difference since last call
144 | */
145 | void programAsync(uint16_t timer1msDiff);
146 |
147 |
148 | /**
149 | * Called cyclically from 1ms timer task.
150 | */
151 | void program1ms(void);
152 |
153 |
154 | /** @} */
155 | #endif
156 |
--------------------------------------------------------------------------------
/lib/CANopen/inc/crc16-ccitt.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Calculation of CRC 16 CCITT polynomial.
3 | *
4 | * @file crc16-ccitt.h
5 | * @ingroup CO_crc16_ccitt
6 | * @version SVN: \$Id: crc16-ccitt.h 31 2013-03-08 17:57:40Z jani22 $
7 | * @author Lammert Bies
8 | * @author Janez Paternoster
9 | * @copyright 2012 - 2013 Janez Paternoster
10 | *
11 | * This file is part of CANopenNode, an opensource CANopen Stack.
12 | * Project home page is .
13 | * For more information on CANopen see .
14 | *
15 | * CANopenNode is free software: you can redistribute it and/or modify
16 | * it under the terms of the GNU Lesser General Public License as published by
17 | * the Free Software Foundation, either version 3 of the License, or
18 | * (at your option) any later version.
19 | *
20 | * This program is distributed in the hope that it will be useful,
21 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 | * GNU Lesser General Public License for more details.
24 | *
25 | * You should have received a copy of the GNU Lesser General Public License
26 | * along with this program. If not, see .
27 | */
28 |
29 |
30 | #ifndef _CRC16_CCITT_H
31 | #define _CRC16_CCITT_H
32 |
33 |
34 | /**
35 | * @defgroup CO_crc16_ccitt CRC 16 CCITT
36 | * @ingroup CO_CANopen
37 | * @{
38 | *
39 | * Calculation of CRC 16 CCITT polynomial.
40 | *
41 | * Equation:
42 | *
43 | * `x^16 + x^12 + x^5 + 1`
44 | */
45 |
46 |
47 | /**
48 | * Calculate CRC sum on block of data.
49 | *
50 | * @param block Pointer to block of data.
51 | * @param blockLength Length of data in bytes;
52 | * @param crc Initial value (zero for xmodem). If block is split into
53 | * multiple segments, previous CRC is used as initial.
54 | *
55 | * @return Calculated CRC.
56 | */
57 | unsigned short crc16_ccitt(
58 | unsigned char *block,
59 | unsigned int blockLength,
60 | unsigned short crc);
61 |
62 |
63 | /** @} */
64 | #endif
65 |
--------------------------------------------------------------------------------
/lib/CANopen/inc/trace.h:
--------------------------------------------------------------------------------
1 | ///
2 | /// !Usage
3 | /// -# Initialize the DBGU using TRACE_CONFIGURE() if you intend to eventually
4 | /// disable ALL traces; otherwise use DBGU_Configure().
5 | /// -# Uses the TRACE_DEBUG(), TRACE_INFO(), TRACE_WARNING(), TRACE_ERROR()
6 | /// TRACE_FATAL() macros to output traces throughout the program.
7 | /// -# Each type of trace has a level : Debug 5, Info 4, Warning 3, Error 2
8 | /// and Fatal 1. Disable a group of traces by changing the value of
9 | /// TRACE_LEVEL during compilation; traces with a level bigger than TRACE_LEVEL
10 | /// are not generated. To generate no trace, use the reserved value 0.
11 | /// -# Trace disabling can be static or dynamic. If dynamic disabling is selected
12 | /// the trace level can be modified in runtime. If static disabling is selected
13 | /// the disabled traces are not compiled.
14 | ///
15 | /// !Trace level description
16 | /// -# TRACE_DEBUG (5): Traces whose only purpose is for debugging the program,
17 | /// and which do not produce meaningful information otherwise.
18 | /// -# TRACE_INFO (4): Informational trace about the program execution. Should
19 | /// enable the user to see the execution flow.
20 | /// -# TRACE_WARNING (3): Indicates that a minor error has happened. In most case
21 | /// it can be discarded safely; it may even be expected.
22 | /// -# TRACE_ERROR (2): Indicates an error which may not stop the program execution,
23 | /// but which indicates there is a problem with the code.
24 | /// -# TRACE_FATAL (1): Indicates a major error which prevents the program from going
25 | /// any further.
26 |
27 | //------------------------------------------------------------------------------
28 |
29 | #ifndef TRACE_H
30 | #define TRACE_H
31 |
32 | //------------------------------------------------------------------------------
33 | // Headers
34 | //------------------------------------------------------------------------------
35 | //#include
36 | #include
37 |
38 | //------------------------------------------------------------------------------
39 | // Global Definitions
40 | //------------------------------------------------------------------------------
41 |
42 | #define TRACE_LEVEL_DEBUG 5
43 | #define TRACE_LEVEL_INFO 4
44 | #define TRACE_LEVEL_WARNING 3
45 | #define TRACE_LEVEL_ERROR 2
46 | #define TRACE_LEVEL_FATAL 1
47 | #define TRACE_LEVEL_NO_TRACE 0
48 |
49 | // By default, all traces are output except the debug one.
50 | #if !defined(TRACE_LEVEL)
51 | #define TRACE_LEVEL TRACE_LEVEL_INFO
52 | #endif
53 |
54 | // By default, trace level is static (not dynamic)
55 | #if !defined(DYN_TRACES)
56 | #define DYN_TRACES 0
57 | #endif
58 |
59 | #if defined(NOTRACE)
60 | #error "Error: NOTRACE has to be not defined !"
61 | #endif
62 |
63 | #undef NOTRACE
64 | #if (TRACE_LEVEL == TRACE_LEVEL_NO_TRACE)
65 | #define NOTRACE
66 | #endif
67 |
68 |
69 |
70 | //------------------------------------------------------------------------------
71 | // Global Macros
72 | //------------------------------------------------------------------------------
73 |
74 | //------------------------------------------------------------------------------
75 | /// Outputs a formatted string using if the log level is high
76 | /// enough. Can be disabled by defining TRACE_LEVEL=0 during compilation.
77 | /// \param format Formatted string to output.
78 | /// \param ... Additional parameters depending on formatted string.
79 | //------------------------------------------------------------------------------
80 | #if defined(NOTRACE)
81 |
82 | // Empty macro
83 | #define TRACE_DEBUG(...) { }
84 | #define TRACE_INFO(...) { }
85 | #define TRACE_WARNING(...) { }
86 | #define TRACE_ERROR(...) { }
87 | #define TRACE_FATAL(...) { HaltCpu(0); }
88 |
89 | #define TRACE_DEBUG_WP(...) { }
90 | #define TRACE_INFO_WP(...) { }
91 | #define TRACE_WARNING_WP(...) { }
92 | #define TRACE_ERROR_WP(...) { }
93 | #define TRACE_FATAL_WP(...) { HaltCpu(0); }
94 |
95 | #elif (DYN_TRACES == 1)
96 |
97 | // Trace output depends on traceLevel value
98 | #define TRACE_DEBUG(...) { if (traceLevel >= TRACE_LEVEL_DEBUG) { printf("-D- " __VA_ARGS__); } }
99 | #define TRACE_INFO(...) { if (traceLevel >= TRACE_LEVEL_INFO) { printf("-I- " __VA_ARGS__); } }
100 | #define TRACE_WARNING(...) { if (traceLevel >= TRACE_LEVEL_WARNING) { printf("-W- " __VA_ARGS__); } }
101 | #define TRACE_ERROR(...) { if (traceLevel >= TRACE_LEVEL_ERROR) { printf("-E- " __VA_ARGS__); } }
102 | #define TRACE_FATAL(...) { if (traceLevel >= TRACE_LEVEL_FATAL) { printf("-F- " __VA_ARGS__); HaltCpu(0); } }
103 |
104 | #define TRACE_DEBUG_WP(...) { if (traceLevel >= TRACE_LEVEL_DEBUG) { printf(__VA_ARGS__); } }
105 | #define TRACE_INFO_WP(...) { if (traceLevel >= TRACE_LEVEL_INFO) { printf(__VA_ARGS__); } }
106 | #define TRACE_WARNING_WP(...) { if (traceLevel >= TRACE_LEVEL_WARNING) { printf(__VA_ARGS__); } }
107 | #define TRACE_ERROR_WP(...) { if (traceLevel >= TRACE_LEVEL_ERROR) { printf(__VA_ARGS__); } }
108 | #define TRACE_FATAL_WP(...) { if (traceLevel >= TRACE_LEVEL_FATAL) { printf(__VA_ARGS__); HaltCpu(0); } }
109 |
110 | #else
111 |
112 | // Trace compilation depends on TRACE_LEVEL value
113 | #if (TRACE_LEVEL >= TRACE_LEVEL_DEBUG)
114 | #define TRACE_DEBUG(...) { printf("-D- " __VA_ARGS__); }
115 | #define TRACE_DEBUG_WP(...) { printf(__VA_ARGS__); }
116 | #else
117 | #define TRACE_DEBUG(...) { }
118 | #define TRACE_DEBUG_WP(...) { }
119 | #endif
120 |
121 | #if (TRACE_LEVEL >= TRACE_LEVEL_INFO)
122 | #define TRACE_INFO(...) { printf("-I- " __VA_ARGS__); }
123 | #define TRACE_INFO_WP(...) { printf(__VA_ARGS__); }
124 | #else
125 | #define TRACE_INFO(...) { }
126 | #define TRACE_INFO_WP(...) { }
127 | #endif
128 |
129 | #if (TRACE_LEVEL >= TRACE_LEVEL_WARNING)
130 | #define TRACE_WARNING(...) { printf("-W- " __VA_ARGS__); }
131 | #define TRACE_WARNING_WP(...) { printf(__VA_ARGS__); }
132 | #else
133 | #define TRACE_WARNING(...) { }
134 | #define TRACE_WARNING_WP(...) { }
135 | #endif
136 |
137 | #if (TRACE_LEVEL >= TRACE_LEVEL_ERROR)
138 | #define TRACE_ERROR(...) { printf("-E- " __VA_ARGS__); }
139 | #define TRACE_ERROR_WP(...) { printf(__VA_ARGS__); }
140 | #else
141 | #define TRACE_ERROR(...) { }
142 | #define TRACE_ERROR_WP(...) { }
143 | #endif
144 |
145 | #if (TRACE_LEVEL >= TRACE_LEVEL_FATAL)
146 | #define TRACE_FATAL(...) { printf("-F- " __VA_ARGS__); while(1); }
147 | #define TRACE_FATAL_WP(...) { printf(__VA_ARGS__); while(1); }
148 | #else
149 | #define TRACE_FATAL(...) { HaltCpu(0); }
150 | #define TRACE_FATAL_WP(...) { HaltCpu(0); }
151 | #endif
152 |
153 | #endif
154 |
155 |
156 | //------------------------------------------------------------------------------
157 | // Exported variables
158 | //------------------------------------------------------------------------------
159 | // Depending on DYN_TRACES, traceLevel is a modifable runtime variable
160 | // or a define
161 | #if !defined(NOTRACE) && (DYN_TRACES == 1)
162 | extern unsigned int traceLevel;
163 | #endif
164 |
165 | #endif //#ifndef TRACE_H
166 |
167 |
--------------------------------------------------------------------------------
/lib/CANopen/module.mk:
--------------------------------------------------------------------------------
1 | local_dir := lib/CANopen
2 | local_lib := $(local_dir)/CANopen.a
3 | local_src := $(addprefix $(local_dir)/src/, \
4 | CANopen.c CO_Emergency.c CO_OD.c CO_timer.c \
5 | CO_HBconsumer.c CO_PDO.c CO_SDO.c CO_SYNC.c \
6 | CO_NMT_Heartbeat.c CO_SDOmaster.c crc16-ccitt.c stm32/CO_driver.c \
7 | )
8 | local_obj := $(patsubst %.c,%.o,$(local_src))
9 | libraries += $(local_lib)
10 | sources += $(local_src)
11 |
12 | $(local_lib): $(local_obj)
13 | $(AR) $(ARFLAGS) $@ $^
14 |
--------------------------------------------------------------------------------
/lib/CANopen/src/CO_OD.c:
--------------------------------------------------------------------------------
1 | ../../od_config/src/CO_OD.c
--------------------------------------------------------------------------------
/lib/CANopen/src/CO_timer.c:
--------------------------------------------------------------------------------
1 | /*
2 | * timer.c
3 | *
4 | * Created on: 13.9.2012
5 | * Author: one
6 | */
7 |
8 | #include "CO_timer.h"
9 |
10 | static pf_getTimerVal_us gettimerfunc = 0;
11 |
12 | int initTimer(pf_getTimerVal_us gett) {
13 | gettimerfunc = gett;
14 | return 0;
15 | }
16 |
17 | void saveTime(ttimer *tim) {
18 | if (!tim)
19 | return;
20 | tim->savedTime = gettimerfunc();
21 | }
22 |
23 | uint32_t getTime_ms(ttimer *tim) {
24 | if (!tim)
25 | return 0;
26 | return (gettimerfunc() - tim->savedTime) / 1000;
27 | }
28 |
29 | uint32_t getTime_us(ttimer *tim) {
30 | if (!tim)
31 | return 0;
32 | uint32_t now = gettimerfunc();
33 | return (now - tim->savedTime);
34 | }
35 |
--------------------------------------------------------------------------------
/lib/CANopen/src/EM:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zenglongGH/stm32f4-CANopen-project/3978d32dd86aadb9af3f4b475801d0a1d54c6231/lib/CANopen/src/EM
--------------------------------------------------------------------------------
/lib/CANopen/src/Readme.txt:
--------------------------------------------------------------------------------
1 | /******************************************************************************/
2 | Program: CANopenNode
3 | Library for communication of different microcontrollers via CANopen protocol.
4 |
5 | Copyright (C) 2004-2008 Janez Paternoster
6 |
7 | License: GNU Lesser General Public License (LGPL).
8 |
9 | */
10 |
11 |
12 | /******************************************************************************/
13 | Topic: Standards
14 |
15 | CANopen library according to CiA Draft Standard 301 (Version 4.2).
16 | See . */
17 |
18 |
19 | /******************************************************************************/
20 | Topic: Features
21 |
22 | Library is written on object-oriented way. Code for each CANopen object is
23 | split into two files: *.c and *.h. There are no global variables necessary.
24 | In general, application first defines object. In the Communication reset
25 | section it initializes it with the _init function. In the endless loop then
26 | calls the _process function.
27 |
28 | Since library is object oriented, multiple configurations are possible with
29 | processors with two CAN interfaces, for example: two independent CANopen
30 | devices on one processor; one CANopen device, but some fast PDOs are on second
31 | CAN interface.
32 |
33 | Source files, ordered in the following order:
34 | - describes CAN module object (microcontroller specific).
35 | - describes object dictionary and all variables inside it.
36 | Variables are structured into three memory blocks, so different non-volatile
37 | strategies are possible for each block. See for more information.
38 | This file is not a part of the stack, it belongs to specific project.
39 | Files are automatically generated by 'Object Dictionary editor', which is part
40 | of CANopenNode project.
41 | - describes CANopen SDO server object (SDO slave). Expedited
42 | and segmented transfers are implemented.
43 | - describes CANopen Emergency object and error control.
44 | All stack errors are reported here. Application can also report its own errors.
45 | - describes CANopen NMT and Heartbeat producer object.
46 | - describes CANopen SYNC object.
47 | - describes CANopen Process Data Object. Dynamic PDO mapping
48 | has granularity of one byte. PDO transmission can be triggered by:
49 | event timer, selective change of state with inhibit timer, SYNC object.
50 | - describes CANopen Heartbeat consumer object.
51 | - describes CANopen SDO client object (SDO master). Expedited
52 | and segmented transfers are implemented.
53 |
--------------------------------------------------------------------------------
/lib/CANopen/src/_project.xml:
--------------------------------------------------------------------------------
1 | ../../od_config/src/_project.xml
--------------------------------------------------------------------------------
/lib/CANopen/src/crc16-ccitt.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Calculation of CRC 16 CCITT polynomial, x^16 + x^12 + x^5 + 1.
3 | *
4 | * @file crc16-ccitt.c
5 | * @ingroup crc16-ccitt
6 | * @version SVN: \$Id: crc16-ccitt.c 31 2013-03-08 17:57:40Z jani22 $
7 | * @author Janez Paternoster
8 | * @copyright 2012 - 2013 Janez Paternoster
9 | *
10 | * This file is part of CANopenNode, an opensource CANopen Stack.
11 | * Project home page is .
12 | * For more information on CANopen see .
13 | *
14 | * CANopenNode is free software: you can redistribute it and/or modify
15 | * it under the terms of the GNU Lesser General Public License as published by
16 | * the Free Software Foundation, either version 3 of the License, or
17 | * (at your option) any later version.
18 | *
19 | * This program is distributed in the hope that it will be useful,
20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 | * GNU Lesser General Public License for more details.
23 | *
24 | * You should have received a copy of the GNU Lesser General Public License
25 | * along with this program. If not, see .
26 | */
27 |
28 |
29 | #include "crc16-ccitt.h"
30 |
31 |
32 | /*
33 | * CRC table calculated by the following algorithm:
34 | *
35 | * void crc16_ccitt_table_init(void){
36 | * unsigned short i, j;
37 | * for(i=0; i<256; i++){
38 | * unsigned short crc = 0;
39 | * unsigned short c = i << 8;
40 | * for(j=0; j<8; j++){
41 | * if((crc ^ c) & 0x8000) crc = (crc << 1) ^ 0x1021;
42 | * else crc = crc << 1;
43 | * c = c << 1;
44 | * }
45 | * crc16_ccitt_table[i] = crc;
46 | * }
47 | * }
48 | */
49 | static const unsigned short crc16_ccitt_table[256] = {
50 | 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50A5, 0x60C6, 0x70E7,
51 | 0x8108, 0x9129, 0xA14A, 0xB16B, 0xC18C, 0xD1AD, 0xE1CE, 0xF1EF,
52 | 0x1231, 0x0210, 0x3273, 0x2252, 0x52B5, 0x4294, 0x72F7, 0x62D6,
53 | 0x9339, 0x8318, 0xB37B, 0xA35A, 0xD3BD, 0xC39C, 0xF3FF, 0xE3DE,
54 | 0x2462, 0x3443, 0x0420, 0x1401, 0x64E6, 0x74C7, 0x44A4, 0x5485,
55 | 0xA56A, 0xB54B, 0x8528, 0x9509, 0xE5EE, 0xF5CF, 0xC5AC, 0xD58D,
56 | 0x3653, 0x2672, 0x1611, 0x0630, 0x76D7, 0x66F6, 0x5695, 0x46B4,
57 | 0xB75B, 0xA77A, 0x9719, 0x8738, 0xF7DF, 0xE7FE, 0xD79D, 0xC7BC,
58 | 0x48C4, 0x58E5, 0x6886, 0x78A7, 0x0840, 0x1861, 0x2802, 0x3823,
59 | 0xC9CC, 0xD9ED, 0xE98E, 0xF9AF, 0x8948, 0x9969, 0xA90A, 0xB92B,
60 | 0x5AF5, 0x4AD4, 0x7AB7, 0x6A96, 0x1A71, 0x0A50, 0x3A33, 0x2A12,
61 | 0xDBFD, 0xCBDC, 0xFBBF, 0xEB9E, 0x9B79, 0x8B58, 0xBB3B, 0xAB1A,
62 | 0x6CA6, 0x7C87, 0x4CE4, 0x5CC5, 0x2C22, 0x3C03, 0x0C60, 0x1C41,
63 | 0xEDAE, 0xFD8F, 0xCDEC, 0xDDCD, 0xAD2A, 0xBD0B, 0x8D68, 0x9D49,
64 | 0x7E97, 0x6EB6, 0x5ED5, 0x4EF4, 0x3E13, 0x2E32, 0x1E51, 0x0E70,
65 | 0xFF9F, 0xEFBE, 0xDFDD, 0xCFFC, 0xBF1B, 0xAF3A, 0x9F59, 0x8F78,
66 | 0x9188, 0x81A9, 0xB1CA, 0xA1EB, 0xD10C, 0xC12D, 0xF14E, 0xE16F,
67 | 0x1080, 0x00A1, 0x30C2, 0x20E3, 0x5004, 0x4025, 0x7046, 0x6067,
68 | 0x83B9, 0x9398, 0xA3FB, 0xB3DA, 0xC33D, 0xD31C, 0xE37F, 0xF35E,
69 | 0x02B1, 0x1290, 0x22F3, 0x32D2, 0x4235, 0x5214, 0x6277, 0x7256,
70 | 0xB5EA, 0xA5CB, 0x95A8, 0x8589, 0xF56E, 0xE54F, 0xD52C, 0xC50D,
71 | 0x34E2, 0x24C3, 0x14A0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405,
72 | 0xA7DB, 0xB7FA, 0x8799, 0x97B8, 0xE75F, 0xF77E, 0xC71D, 0xD73C,
73 | 0x26D3, 0x36F2, 0x0691, 0x16B0, 0x6657, 0x7676, 0x4615, 0x5634,
74 | 0xD94C, 0xC96D, 0xF90E, 0xE92F, 0x99C8, 0x89E9, 0xB98A, 0xA9AB,
75 | 0x5844, 0x4865, 0x7806, 0x6827, 0x18C0, 0x08E1, 0x3882, 0x28A3,
76 | 0xCB7D, 0xDB5C, 0xEB3F, 0xFB1E, 0x8BF9, 0x9BD8, 0xABBB, 0xBB9A,
77 | 0x4A75, 0x5A54, 0x6A37, 0x7A16, 0x0AF1, 0x1AD0, 0x2AB3, 0x3A92,
78 | 0xFD2E, 0xED0F, 0xDD6C, 0xCD4D, 0xBDAA, 0xAD8B, 0x9DE8, 0x8DC9,
79 | 0x7C26, 0x6C07, 0x5C64, 0x4C45, 0x3CA2, 0x2C83, 0x1CE0, 0x0CC1,
80 | 0xEF1F, 0xFF3E, 0xCF5D, 0xDF7C, 0xAF9B, 0xBFBA, 0x8FD9, 0x9FF8,
81 | 0x6E17, 0x7E36, 0x4E55, 0x5E74, 0x2E93, 0x3EB2, 0x0ED1, 0x1EF0
82 | };
83 |
84 |
85 | /******************************************************************************/
86 | unsigned short crc16_ccitt(
87 | unsigned char *block,
88 | unsigned int blockLength,
89 | unsigned short crc)
90 | {
91 | while(blockLength--){
92 | unsigned short tmp = (crc >> 8) ^ (unsigned short) *block++;
93 | crc = (crc << 8) ^ crc16_ccitt_table[tmp];
94 | }
95 | return crc;
96 | }
97 |
--------------------------------------------------------------------------------
/lib/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zenglongGH/stm32f4-CANopen-project/3978d32dd86aadb9af3f4b475801d0a1d54c6231/lib/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h
--------------------------------------------------------------------------------
/lib/CMSIS/Device/ST/STM32F4xx/Include/system_stm32f4xx.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file system_stm32f4xx.h
4 | * @author MCD Application Team
5 | * @version V1.0.2
6 | * @date 05-March-2012
7 | * @brief CMSIS Cortex-M4 Device System Source File for STM32F4xx devices.
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * © COPYRIGHT 2012 STMicroelectronics
12 | *
13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
14 | * You may not use this file except in compliance with the License.
15 | * You may obtain a copy of the License at:
16 | *
17 | * http://www.st.com/software_license_agreement_liberty_v2
18 | *
19 | * Unless required by applicable law or agreed to in writing, software
20 | * distributed under the License is distributed on an "AS IS" BASIS,
21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 | * See the License for the specific language governing permissions and
23 | * limitations under the License.
24 | *
25 | ******************************************************************************
26 | */
27 |
28 | /** @addtogroup CMSIS
29 | * @{
30 | */
31 |
32 | /** @addtogroup stm32f4xx_system
33 | * @{
34 | */
35 |
36 | /**
37 | * @brief Define to prevent recursive inclusion
38 | */
39 | #ifndef __SYSTEM_STM32F4XX_H
40 | #define __SYSTEM_STM32F4XX_H
41 |
42 | #ifdef __cplusplus
43 | extern "C" {
44 | #endif
45 |
46 | /** @addtogroup STM32F4xx_System_Includes
47 | * @{
48 | */
49 |
50 | /**
51 | * @}
52 | */
53 |
54 |
55 | /** @addtogroup STM32F4xx_System_Exported_types
56 | * @{
57 | */
58 |
59 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */
60 |
61 |
62 | /**
63 | * @}
64 | */
65 |
66 | /** @addtogroup STM32F4xx_System_Exported_Constants
67 | * @{
68 | */
69 |
70 | /**
71 | * @}
72 | */
73 |
74 | /** @addtogroup STM32F4xx_System_Exported_Macros
75 | * @{
76 | */
77 |
78 | /**
79 | * @}
80 | */
81 |
82 | /** @addtogroup STM32F4xx_System_Exported_Functions
83 | * @{
84 | */
85 |
86 | extern void SystemInit(void);
87 | extern void SystemCoreClockUpdate(void);
88 | /**
89 | * @}
90 | */
91 |
92 | #ifdef __cplusplus
93 | }
94 | #endif
95 |
96 | #endif /*__SYSTEM_STM32F4XX_H */
97 |
98 | /**
99 | * @}
100 | */
101 |
102 | /**
103 | * @}
104 | */
105 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
106 |
--------------------------------------------------------------------------------
/lib/CMSIS/Device/ST/STM32F4xx/Source/Templates/TASKING/cstart_thumb2.asm:
--------------------------------------------------------------------------------
1 |
2 |
3 | ;; NOTE: To allow the use of this file for both ARMv6M and ARMv7M,
4 | ;; we will only use 16-bit Thumb intructions.
5 |
6 | .extern _lc_ub_stack ; usr/sys mode stack pointer
7 | .extern _lc_ue_stack ; symbol required by debugger
8 | .extern _lc_ub_table ; ROM to RAM copy table
9 | .extern main
10 | .extern _Exit
11 | .extern exit
12 | .weak exit
13 | .global __get_argcv
14 | .weak __get_argcv
15 | .extern __argcvbuf
16 | .weak __argcvbuf
17 | ;;.extern __init_hardware
18 |
19 | .extern SystemInit
20 |
21 | .if @defined('__PROF_ENABLE__')
22 | .extern __prof_init
23 | .endif
24 | .if @defined('__POSIX__')
25 | .extern posix_main
26 | .extern _posix_boot_stack_top
27 | .endif
28 |
29 | .global _START
30 |
31 | .section .text.cstart
32 |
33 | .thumb
34 | _START:
35 | ;; anticipate possible ROM/RAM remapping
36 | ;; by loading the 'real' program address
37 | ldr r1,=_Next
38 | bx r1
39 | _Next:
40 | ;; initialize the stack pointer
41 | ldr r1,=_lc_ub_stack ; TODO: make this part of the vector table
42 | mov sp,r1
43 |
44 | ; Call the clock system intitialization function.
45 | bl SystemInit
46 |
47 | ;; copy initialized sections from ROM to RAM
48 | ;; and clear uninitialized data sections in RAM
49 |
50 | ldr r3,=_lc_ub_table
51 | movs r0,#0
52 | cploop:
53 | ldr r4,[r3,#0] ; load type
54 | ldr r5,[r3,#4] ; dst address
55 | ldr r6,[r3,#8] ; src address
56 | ldr r7,[r3,#12] ; size
57 |
58 | cmp r4,#1
59 | beq copy
60 | cmp r4,#2
61 | beq clear
62 | b done
63 |
64 | copy:
65 | subs r7,r7,#1
66 | ldrb r1,[r6,r7]
67 | strb r1,[r5,r7]
68 | bne copy
69 |
70 | adds r3,r3,#16
71 | b cploop
72 |
73 | clear:
74 | subs r7,r7,#1
75 | strb r0,[r5,r7]
76 | bne clear
77 |
78 | adds r3,r3,#16
79 | b cploop
80 |
81 | done:
82 |
83 |
84 | .if @defined('__POSIX__')
85 |
86 | ;; posix stack buffer for system upbringing
87 | ldr r0,=_posix_boot_stack_top
88 | ldr r0, [r0]
89 | mov sp,r0
90 |
91 | .else
92 |
93 | ;; load r10 with end of USR/SYS stack, which is
94 | ;; needed in case stack overflow checking is on
95 | ;; NOTE: use 16-bit instructions only, for ARMv6M
96 | ldr r0,=_lc_ue_stack
97 | mov r10,r0
98 |
99 | .endif
100 |
101 | .if @defined('__PROF_ENABLE__')
102 | bl __prof_init
103 | .endif
104 |
105 | .if @defined('__POSIX__')
106 | ;; call posix_main with no arguments
107 | bl posix_main
108 | .else
109 | ;; retrieve argc and argv (default argv[0]==NULL & argc==0)
110 | bl __get_argcv
111 | ldr r1,=__argcvbuf
112 | ;; call main
113 | bl main
114 | .endif
115 |
116 | ;; call exit using the return value from main()
117 | ;; Note. Calling exit will also run all functions
118 | ;; that were supplied through atexit().
119 | bl exit
120 |
121 | __get_argcv: ; weak definition
122 | movs r0,#0
123 | bx lr
124 |
125 | .ltorg
126 | .endsec
127 |
128 | .calls '_START', ' '
129 | .calls '_START','__init_vector_table'
130 | .if @defined('__PROF_ENABLE__')
131 | .calls '_START','__prof_init'
132 | .endif
133 | .if @defined('__POSIX__')
134 | .calls '_START','posix_main'
135 | .else
136 | .calls '_START','__get_argcv'
137 | .calls '_START','main'
138 | .endif
139 | .calls '_START','exit'
140 | .calls '_START','',0
141 |
142 | .end
143 |
--------------------------------------------------------------------------------
/lib/CMSIS/Include/arm_common_tables.h:
--------------------------------------------------------------------------------
1 | /* ----------------------------------------------------------------------
2 | * Copyright (C) 2010 ARM Limited. All rights reserved.
3 | *
4 | * $Date: 11. November 2010
5 | * $Revision: V1.0.2
6 | *
7 | * Project: CMSIS DSP Library
8 | * Title: arm_common_tables.h
9 | *
10 | * Description: This file has extern declaration for common tables like Bitreverse, reciprocal etc which are used across different functions
11 | *
12 | * Target Processor: Cortex-M4/Cortex-M3
13 | *
14 | * Version 1.0.2 2010/11/11
15 | * Documentation updated.
16 | *
17 | * Version 1.0.1 2010/10/05
18 | * Production release and review comments incorporated.
19 | *
20 | * Version 1.0.0 2010/09/20
21 | * Production release and review comments incorporated.
22 | * -------------------------------------------------------------------- */
23 |
24 | #ifndef _ARM_COMMON_TABLES_H
25 | #define _ARM_COMMON_TABLES_H
26 |
27 | #include "arm_math.h"
28 |
29 | extern uint16_t armBitRevTable[256];
30 | extern q15_t armRecipTableQ15[64];
31 | extern q31_t armRecipTableQ31[64];
32 | extern const q31_t realCoefAQ31[1024];
33 | extern const q31_t realCoefBQ31[1024];
34 |
35 | #endif /* ARM_COMMON_TABLES_H */
36 |
--------------------------------------------------------------------------------
/lib/CMSIS/README.txt:
--------------------------------------------------------------------------------
1 | * -------------------------------------------------------------------
2 | * Copyright (C) 2011 ARM Limited. All rights reserved.
3 | *
4 | * Date: 25 July 2011
5 | * Revision: V2.10
6 | *
7 | * Project: Cortex Microcontroller Software Interface Standard (CMSIS)
8 | * Title: Release Note for CMSIS
9 | *
10 | * -------------------------------------------------------------------
11 |
12 |
13 | NOTE - Open the index.html file to access CMSIS documentation
14 |
15 |
16 | The Cortex Microcontroller Software Interface Standard (CMSIS) provides a single standard across all
17 | Cortex-Mx processor series vendors. It enables code re-use and code sharing across software projects
18 | and reduces time-to-market for new embedded applications.
19 |
20 | CMSIS is released under the terms of the end user license agreement ("CMSIS END USER LICENCE AGREEMENT.pdf").
21 | Any user of the software package is bound to the terms and conditions of the end user license agreement.
22 |
23 |
24 | You will find the following sub-directories:
25 |
26 | Documentation - Contains CMSIS documentation.
27 |
28 | DSP_Lib - MDK project files, Examples and source files etc.. to build the
29 | CMSIS DSP Software Library for Cortex-M0, Cortex-M3, Cortex-M4 processors.
30 |
31 | Include - CMSIS Core Support and CMSIS DSP Include Files.
32 |
33 | Lib - CMSIS DSP Binaries
34 | ---
--------------------------------------------------------------------------------
/lib/STM32F4xx_StdPeriph_Driver/Release_Notes.html:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zenglongGH/stm32f4-CANopen-project/3978d32dd86aadb9af3f4b475801d0a1d54c6231/lib/STM32F4xx_StdPeriph_Driver/Release_Notes.html
--------------------------------------------------------------------------------
/lib/STM32F4xx_StdPeriph_Driver/inc/misc.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file misc.h
4 | * @author MCD Application Team
5 | * @version V1.0.2
6 | * @date 05-March-2012
7 | * @brief This file contains all the functions prototypes for the miscellaneous
8 | * firmware library functions (add-on to CMSIS functions).
9 | ******************************************************************************
10 | * @attention
11 | *
12 | * © COPYRIGHT 2012 STMicroelectronics
13 | *
14 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
15 | * You may not use this file except in compliance with the License.
16 | * You may obtain a copy of the License at:
17 | *
18 | * http://www.st.com/software_license_agreement_liberty_v2
19 | *
20 | * Unless required by applicable law or agreed to in writing, software
21 | * distributed under the License is distributed on an "AS IS" BASIS,
22 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 | * See the License for the specific language governing permissions and
24 | * limitations under the License.
25 | *
26 | ******************************************************************************
27 | */
28 |
29 | /* Define to prevent recursive inclusion -------------------------------------*/
30 | #ifndef __MISC_H
31 | #define __MISC_H
32 |
33 | #ifdef __cplusplus
34 | extern "C" {
35 | #endif
36 |
37 | /* Includes ------------------------------------------------------------------*/
38 | #include "stm32f4xx.h"
39 |
40 | /** @addtogroup STM32F4xx_StdPeriph_Driver
41 | * @{
42 | */
43 |
44 | /** @addtogroup MISC
45 | * @{
46 | */
47 |
48 | /* Exported types ------------------------------------------------------------*/
49 |
50 | /**
51 | * @brief NVIC Init Structure definition
52 | */
53 |
54 | typedef struct
55 | {
56 | uint8_t NVIC_IRQChannel; /*!< Specifies the IRQ channel to be enabled or disabled.
57 | This parameter can be an enumerator of @ref IRQn_Type
58 | enumeration (For the complete STM32 Devices IRQ Channels
59 | list, please refer to stm32f4xx.h file) */
60 |
61 | uint8_t NVIC_IRQChannelPreemptionPriority; /*!< Specifies the pre-emption priority for the IRQ channel
62 | specified in NVIC_IRQChannel. This parameter can be a value
63 | between 0 and 15 as described in the table @ref MISC_NVIC_Priority_Table
64 | A lower priority value indicates a higher priority */
65 |
66 | uint8_t NVIC_IRQChannelSubPriority; /*!< Specifies the subpriority level for the IRQ channel specified
67 | in NVIC_IRQChannel. This parameter can be a value
68 | between 0 and 15 as described in the table @ref MISC_NVIC_Priority_Table
69 | A lower priority value indicates a higher priority */
70 |
71 | FunctionalState NVIC_IRQChannelCmd; /*!< Specifies whether the IRQ channel defined in NVIC_IRQChannel
72 | will be enabled or disabled.
73 | This parameter can be set either to ENABLE or DISABLE */
74 | } NVIC_InitTypeDef;
75 |
76 | /* Exported constants --------------------------------------------------------*/
77 |
78 | /** @defgroup MISC_Exported_Constants
79 | * @{
80 | */
81 |
82 | /** @defgroup MISC_Vector_Table_Base
83 | * @{
84 | */
85 |
86 | #define NVIC_VectTab_RAM ((uint32_t)0x20000000)
87 | #define NVIC_VectTab_FLASH ((uint32_t)0x08000000)
88 | #define IS_NVIC_VECTTAB(VECTTAB) (((VECTTAB) == NVIC_VectTab_RAM) || \
89 | ((VECTTAB) == NVIC_VectTab_FLASH))
90 | /**
91 | * @}
92 | */
93 |
94 | /** @defgroup MISC_System_Low_Power
95 | * @{
96 | */
97 |
98 | #define NVIC_LP_SEVONPEND ((uint8_t)0x10)
99 | #define NVIC_LP_SLEEPDEEP ((uint8_t)0x04)
100 | #define NVIC_LP_SLEEPONEXIT ((uint8_t)0x02)
101 | #define IS_NVIC_LP(LP) (((LP) == NVIC_LP_SEVONPEND) || \
102 | ((LP) == NVIC_LP_SLEEPDEEP) || \
103 | ((LP) == NVIC_LP_SLEEPONEXIT))
104 | /**
105 | * @}
106 | */
107 |
108 | /** @defgroup MISC_Preemption_Priority_Group
109 | * @{
110 | */
111 |
112 | #define NVIC_PriorityGroup_0 ((uint32_t)0x700) /*!< 0 bits for pre-emption priority
113 | 4 bits for subpriority */
114 | #define NVIC_PriorityGroup_1 ((uint32_t)0x600) /*!< 1 bits for pre-emption priority
115 | 3 bits for subpriority */
116 | #define NVIC_PriorityGroup_2 ((uint32_t)0x500) /*!< 2 bits for pre-emption priority
117 | 2 bits for subpriority */
118 | #define NVIC_PriorityGroup_3 ((uint32_t)0x400) /*!< 3 bits for pre-emption priority
119 | 1 bits for subpriority */
120 | #define NVIC_PriorityGroup_4 ((uint32_t)0x300) /*!< 4 bits for pre-emption priority
121 | 0 bits for subpriority */
122 |
123 | #define IS_NVIC_PRIORITY_GROUP(GROUP) (((GROUP) == NVIC_PriorityGroup_0) || \
124 | ((GROUP) == NVIC_PriorityGroup_1) || \
125 | ((GROUP) == NVIC_PriorityGroup_2) || \
126 | ((GROUP) == NVIC_PriorityGroup_3) || \
127 | ((GROUP) == NVIC_PriorityGroup_4))
128 |
129 | #define IS_NVIC_PREEMPTION_PRIORITY(PRIORITY) ((PRIORITY) < 0x10)
130 |
131 | #define IS_NVIC_SUB_PRIORITY(PRIORITY) ((PRIORITY) < 0x10)
132 |
133 | #define IS_NVIC_OFFSET(OFFSET) ((OFFSET) < 0x000FFFFF)
134 |
135 | /**
136 | * @}
137 | */
138 |
139 | /** @defgroup MISC_SysTick_clock_source
140 | * @{
141 | */
142 |
143 | #define SysTick_CLKSource_HCLK_Div8 ((uint32_t)0xFFFFFFFB)
144 | #define SysTick_CLKSource_HCLK ((uint32_t)0x00000004)
145 | #define IS_SYSTICK_CLK_SOURCE(SOURCE) (((SOURCE) == SysTick_CLKSource_HCLK) || \
146 | ((SOURCE) == SysTick_CLKSource_HCLK_Div8))
147 | /**
148 | * @}
149 | */
150 |
151 | /**
152 | * @}
153 | */
154 |
155 | /* Exported macro ------------------------------------------------------------*/
156 | /* Exported functions --------------------------------------------------------*/
157 |
158 | void NVIC_PriorityGroupConfig(uint32_t NVIC_PriorityGroup);
159 | void NVIC_Init(NVIC_InitTypeDef* NVIC_InitStruct);
160 | void NVIC_SetVectorTable(uint32_t NVIC_VectTab, uint32_t Offset);
161 | void NVIC_SystemLPConfig(uint8_t LowPowerMode, FunctionalState NewState);
162 | void SysTick_CLKSourceConfig(uint32_t SysTick_CLKSource);
163 |
164 | #ifdef __cplusplus
165 | }
166 | #endif
167 |
168 | #endif /* __MISC_H */
169 |
170 | /**
171 | * @}
172 | */
173 |
174 | /**
175 | * @}
176 | */
177 |
178 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
179 |
--------------------------------------------------------------------------------
/lib/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_crc.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f4xx_crc.h
4 | * @author MCD Application Team
5 | * @version V1.0.2
6 | * @date 05-March-2012
7 | * @brief This file contains all the functions prototypes for the CRC firmware
8 | * library.
9 | ******************************************************************************
10 | * @attention
11 | *
12 | * © COPYRIGHT 2012 STMicroelectronics
13 | *
14 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
15 | * You may not use this file except in compliance with the License.
16 | * You may obtain a copy of the License at:
17 | *
18 | * http://www.st.com/software_license_agreement_liberty_v2
19 | *
20 | * Unless required by applicable law or agreed to in writing, software
21 | * distributed under the License is distributed on an "AS IS" BASIS,
22 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 | * See the License for the specific language governing permissions and
24 | * limitations under the License.
25 | *
26 | ******************************************************************************
27 | */
28 |
29 | /* Define to prevent recursive inclusion -------------------------------------*/
30 | #ifndef __STM32F4xx_CRC_H
31 | #define __STM32F4xx_CRC_H
32 |
33 | #ifdef __cplusplus
34 | extern "C" {
35 | #endif
36 |
37 | /* Includes ------------------------------------------------------------------*/
38 | #include "stm32f4xx.h"
39 |
40 | /** @addtogroup STM32F4xx_StdPeriph_Driver
41 | * @{
42 | */
43 |
44 | /** @addtogroup CRC
45 | * @{
46 | */
47 |
48 | /* Exported types ------------------------------------------------------------*/
49 | /* Exported constants --------------------------------------------------------*/
50 |
51 | /** @defgroup CRC_Exported_Constants
52 | * @{
53 | */
54 |
55 | /**
56 | * @}
57 | */
58 |
59 | /* Exported macro ------------------------------------------------------------*/
60 | /* Exported functions --------------------------------------------------------*/
61 |
62 | void CRC_ResetDR(void);
63 | uint32_t CRC_CalcCRC(uint32_t Data);
64 | uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength);
65 | uint32_t CRC_GetCRC(void);
66 | void CRC_SetIDRegister(uint8_t IDValue);
67 | uint8_t CRC_GetIDRegister(void);
68 |
69 | #ifdef __cplusplus
70 | }
71 | #endif
72 |
73 | #endif /* __STM32F4xx_CRC_H */
74 |
75 | /**
76 | * @}
77 | */
78 |
79 | /**
80 | * @}
81 | */
82 |
83 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
84 |
--------------------------------------------------------------------------------
/lib/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_dbgmcu.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f4xx_dbgmcu.h
4 | * @author MCD Application Team
5 | * @version V1.0.2
6 | * @date 05-March-2012
7 | * @brief This file contains all the functions prototypes for the DBGMCU firmware library.
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * © COPYRIGHT 2012 STMicroelectronics
12 | *
13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
14 | * You may not use this file except in compliance with the License.
15 | * You may obtain a copy of the License at:
16 | *
17 | * http://www.st.com/software_license_agreement_liberty_v2
18 | *
19 | * Unless required by applicable law or agreed to in writing, software
20 | * distributed under the License is distributed on an "AS IS" BASIS,
21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 | * See the License for the specific language governing permissions and
23 | * limitations under the License.
24 | *
25 | ******************************************************************************
26 | */
27 |
28 | /* Define to prevent recursive inclusion -------------------------------------*/
29 | #ifndef __STM32F4xx_DBGMCU_H
30 | #define __STM32F4xx_DBGMCU_H
31 |
32 | #ifdef __cplusplus
33 | extern "C" {
34 | #endif
35 |
36 | /* Includes ------------------------------------------------------------------*/
37 | #include "stm32f4xx.h"
38 |
39 | /** @addtogroup STM32F4xx_StdPeriph_Driver
40 | * @{
41 | */
42 |
43 | /** @addtogroup DBGMCU
44 | * @{
45 | */
46 |
47 | /* Exported types ------------------------------------------------------------*/
48 | /* Exported constants --------------------------------------------------------*/
49 |
50 | /** @defgroup DBGMCU_Exported_Constants
51 | * @{
52 | */
53 | #define DBGMCU_SLEEP ((uint32_t)0x00000001)
54 | #define DBGMCU_STOP ((uint32_t)0x00000002)
55 | #define DBGMCU_STANDBY ((uint32_t)0x00000004)
56 | #define IS_DBGMCU_PERIPH(PERIPH) ((((PERIPH) & 0xFFFFFFF8) == 0x00) && ((PERIPH) != 0x00))
57 |
58 | #define DBGMCU_TIM2_STOP ((uint32_t)0x00000001)
59 | #define DBGMCU_TIM3_STOP ((uint32_t)0x00000002)
60 | #define DBGMCU_TIM4_STOP ((uint32_t)0x00000004)
61 | #define DBGMCU_TIM5_STOP ((uint32_t)0x00000008)
62 | #define DBGMCU_TIM6_STOP ((uint32_t)0x00000010)
63 | #define DBGMCU_TIM7_STOP ((uint32_t)0x00000020)
64 | #define DBGMCU_TIM12_STOP ((uint32_t)0x00000040)
65 | #define DBGMCU_TIM13_STOP ((uint32_t)0x00000080)
66 | #define DBGMCU_TIM14_STOP ((uint32_t)0x00000100)
67 | #define DBGMCU_RTC_STOP ((uint32_t)0x00000400)
68 | #define DBGMCU_WWDG_STOP ((uint32_t)0x00000800)
69 | #define DBGMCU_IWDG_STOP ((uint32_t)0x00001000)
70 | #define DBGMCU_I2C1_SMBUS_TIMEOUT ((uint32_t)0x00200000)
71 | #define DBGMCU_I2C2_SMBUS_TIMEOUT ((uint32_t)0x00400000)
72 | #define DBGMCU_I2C3_SMBUS_TIMEOUT ((uint32_t)0x00800000)
73 | #define DBGMCU_CAN1_STOP ((uint32_t)0x02000000)
74 | #define DBGMCU_CAN2_STOP ((uint32_t)0x04000000)
75 | #define IS_DBGMCU_APB1PERIPH(PERIPH) ((((PERIPH) & 0xF91FE200) == 0x00) && ((PERIPH) != 0x00))
76 |
77 | #define DBGMCU_TIM1_STOP ((uint32_t)0x00000001)
78 | #define DBGMCU_TIM8_STOP ((uint32_t)0x00000002)
79 | #define DBGMCU_TIM9_STOP ((uint32_t)0x00010000)
80 | #define DBGMCU_TIM10_STOP ((uint32_t)0x00020000)
81 | #define DBGMCU_TIM11_STOP ((uint32_t)0x00040000)
82 | #define IS_DBGMCU_APB2PERIPH(PERIPH) ((((PERIPH) & 0xFFF8FFFC) == 0x00) && ((PERIPH) != 0x00))
83 | /**
84 | * @}
85 | */
86 |
87 | /* Exported macro ------------------------------------------------------------*/
88 | /* Exported functions --------------------------------------------------------*/
89 | uint32_t DBGMCU_GetREVID(void);
90 | uint32_t DBGMCU_GetDEVID(void);
91 | void DBGMCU_Config(uint32_t DBGMCU_Periph, FunctionalState NewState);
92 | void DBGMCU_APB1PeriphConfig(uint32_t DBGMCU_Periph, FunctionalState NewState);
93 | void DBGMCU_APB2PeriphConfig(uint32_t DBGMCU_Periph, FunctionalState NewState);
94 |
95 | #ifdef __cplusplus
96 | }
97 | #endif
98 |
99 | #endif /* __STM32F4xx_DBGMCU_H */
100 |
101 | /**
102 | * @}
103 | */
104 |
105 | /**
106 | * @}
107 | */
108 |
109 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
110 |
--------------------------------------------------------------------------------
/lib/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_iwdg.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f4xx_iwdg.h
4 | * @author MCD Application Team
5 | * @version V1.0.2
6 | * @date 05-March-2012
7 | * @brief This file contains all the functions prototypes for the IWDG
8 | * firmware library.
9 | ******************************************************************************
10 | * @attention
11 | *
12 | * © COPYRIGHT 2012 STMicroelectronics
13 | *
14 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
15 | * You may not use this file except in compliance with the License.
16 | * You may obtain a copy of the License at:
17 | *
18 | * http://www.st.com/software_license_agreement_liberty_v2
19 | *
20 | * Unless required by applicable law or agreed to in writing, software
21 | * distributed under the License is distributed on an "AS IS" BASIS,
22 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 | * See the License for the specific language governing permissions and
24 | * limitations under the License.
25 | *
26 | ******************************************************************************
27 | */
28 |
29 | /* Define to prevent recursive inclusion -------------------------------------*/
30 | #ifndef __STM32F4xx_IWDG_H
31 | #define __STM32F4xx_IWDG_H
32 |
33 | #ifdef __cplusplus
34 | extern "C" {
35 | #endif
36 |
37 | /* Includes ------------------------------------------------------------------*/
38 | #include "stm32f4xx.h"
39 |
40 | /** @addtogroup STM32F4xx_StdPeriph_Driver
41 | * @{
42 | */
43 |
44 | /** @addtogroup IWDG
45 | * @{
46 | */
47 |
48 | /* Exported types ------------------------------------------------------------*/
49 | /* Exported constants --------------------------------------------------------*/
50 |
51 | /** @defgroup IWDG_Exported_Constants
52 | * @{
53 | */
54 |
55 | /** @defgroup IWDG_WriteAccess
56 | * @{
57 | */
58 | #define IWDG_WriteAccess_Enable ((uint16_t)0x5555)
59 | #define IWDG_WriteAccess_Disable ((uint16_t)0x0000)
60 | #define IS_IWDG_WRITE_ACCESS(ACCESS) (((ACCESS) == IWDG_WriteAccess_Enable) || \
61 | ((ACCESS) == IWDG_WriteAccess_Disable))
62 | /**
63 | * @}
64 | */
65 |
66 | /** @defgroup IWDG_prescaler
67 | * @{
68 | */
69 | #define IWDG_Prescaler_4 ((uint8_t)0x00)
70 | #define IWDG_Prescaler_8 ((uint8_t)0x01)
71 | #define IWDG_Prescaler_16 ((uint8_t)0x02)
72 | #define IWDG_Prescaler_32 ((uint8_t)0x03)
73 | #define IWDG_Prescaler_64 ((uint8_t)0x04)
74 | #define IWDG_Prescaler_128 ((uint8_t)0x05)
75 | #define IWDG_Prescaler_256 ((uint8_t)0x06)
76 | #define IS_IWDG_PRESCALER(PRESCALER) (((PRESCALER) == IWDG_Prescaler_4) || \
77 | ((PRESCALER) == IWDG_Prescaler_8) || \
78 | ((PRESCALER) == IWDG_Prescaler_16) || \
79 | ((PRESCALER) == IWDG_Prescaler_32) || \
80 | ((PRESCALER) == IWDG_Prescaler_64) || \
81 | ((PRESCALER) == IWDG_Prescaler_128)|| \
82 | ((PRESCALER) == IWDG_Prescaler_256))
83 | /**
84 | * @}
85 | */
86 |
87 | /** @defgroup IWDG_Flag
88 | * @{
89 | */
90 | #define IWDG_FLAG_PVU ((uint16_t)0x0001)
91 | #define IWDG_FLAG_RVU ((uint16_t)0x0002)
92 | #define IS_IWDG_FLAG(FLAG) (((FLAG) == IWDG_FLAG_PVU) || ((FLAG) == IWDG_FLAG_RVU))
93 | #define IS_IWDG_RELOAD(RELOAD) ((RELOAD) <= 0xFFF)
94 | /**
95 | * @}
96 | */
97 |
98 | /**
99 | * @}
100 | */
101 |
102 | /* Exported macro ------------------------------------------------------------*/
103 | /* Exported functions --------------------------------------------------------*/
104 |
105 | /* Prescaler and Counter configuration functions ******************************/
106 | void IWDG_WriteAccessCmd(uint16_t IWDG_WriteAccess);
107 | void IWDG_SetPrescaler(uint8_t IWDG_Prescaler);
108 | void IWDG_SetReload(uint16_t Reload);
109 | void IWDG_ReloadCounter(void);
110 |
111 | /* IWDG activation function ***************************************************/
112 | void IWDG_Enable(void);
113 |
114 | /* Flag management function ***************************************************/
115 | FlagStatus IWDG_GetFlagStatus(uint16_t IWDG_FLAG);
116 |
117 | #ifdef __cplusplus
118 | }
119 | #endif
120 |
121 | #endif /* __STM32F4xx_IWDG_H */
122 |
123 | /**
124 | * @}
125 | */
126 |
127 | /**
128 | * @}
129 | */
130 |
131 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
132 |
--------------------------------------------------------------------------------
/lib/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_pwr.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f4xx_pwr.h
4 | * @author MCD Application Team
5 | * @version V1.0.2
6 | * @date 05-March-2012
7 | * @brief This file contains all the functions prototypes for the PWR firmware
8 | * library.
9 | ******************************************************************************
10 | * @attention
11 | *
12 | * © COPYRIGHT 2012 STMicroelectronics
13 | *
14 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
15 | * You may not use this file except in compliance with the License.
16 | * You may obtain a copy of the License at:
17 | *
18 | * http://www.st.com/software_license_agreement_liberty_v2
19 | *
20 | * Unless required by applicable law or agreed to in writing, software
21 | * distributed under the License is distributed on an "AS IS" BASIS,
22 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 | * See the License for the specific language governing permissions and
24 | * limitations under the License.
25 | *
26 | ******************************************************************************
27 | */
28 |
29 | /* Define to prevent recursive inclusion -------------------------------------*/
30 | #ifndef __STM32F4xx_PWR_H
31 | #define __STM32F4xx_PWR_H
32 |
33 | #ifdef __cplusplus
34 | extern "C" {
35 | #endif
36 |
37 | /* Includes ------------------------------------------------------------------*/
38 | #include "stm32f4xx.h"
39 |
40 | /** @addtogroup STM32F4xx_StdPeriph_Driver
41 | * @{
42 | */
43 |
44 | /** @addtogroup PWR
45 | * @{
46 | */
47 |
48 | /* Exported types ------------------------------------------------------------*/
49 | /* Exported constants --------------------------------------------------------*/
50 |
51 | /** @defgroup PWR_Exported_Constants
52 | * @{
53 | */
54 |
55 | /** @defgroup PWR_PVD_detection_level
56 | * @{
57 | */
58 |
59 | #define PWR_PVDLevel_0 PWR_CR_PLS_LEV0
60 | #define PWR_PVDLevel_1 PWR_CR_PLS_LEV1
61 | #define PWR_PVDLevel_2 PWR_CR_PLS_LEV2
62 | #define PWR_PVDLevel_3 PWR_CR_PLS_LEV3
63 | #define PWR_PVDLevel_4 PWR_CR_PLS_LEV4
64 | #define PWR_PVDLevel_5 PWR_CR_PLS_LEV5
65 | #define PWR_PVDLevel_6 PWR_CR_PLS_LEV6
66 | #define PWR_PVDLevel_7 PWR_CR_PLS_LEV7
67 |
68 | #define IS_PWR_PVD_LEVEL(LEVEL) (((LEVEL) == PWR_PVDLevel_0) || ((LEVEL) == PWR_PVDLevel_1)|| \
69 | ((LEVEL) == PWR_PVDLevel_2) || ((LEVEL) == PWR_PVDLevel_3)|| \
70 | ((LEVEL) == PWR_PVDLevel_4) || ((LEVEL) == PWR_PVDLevel_5)|| \
71 | ((LEVEL) == PWR_PVDLevel_6) || ((LEVEL) == PWR_PVDLevel_7))
72 | /**
73 | * @}
74 | */
75 |
76 |
77 | /** @defgroup PWR_Regulator_state_in_STOP_mode
78 | * @{
79 | */
80 |
81 | #define PWR_Regulator_ON ((uint32_t)0x00000000)
82 | #define PWR_Regulator_LowPower PWR_CR_LPDS
83 | #define IS_PWR_REGULATOR(REGULATOR) (((REGULATOR) == PWR_Regulator_ON) || \
84 | ((REGULATOR) == PWR_Regulator_LowPower))
85 | /**
86 | * @}
87 | */
88 |
89 | /** @defgroup PWR_STOP_mode_entry
90 | * @{
91 | */
92 |
93 | #define PWR_STOPEntry_WFI ((uint8_t)0x01)
94 | #define PWR_STOPEntry_WFE ((uint8_t)0x02)
95 | #define IS_PWR_STOP_ENTRY(ENTRY) (((ENTRY) == PWR_STOPEntry_WFI) || ((ENTRY) == PWR_STOPEntry_WFE))
96 |
97 | /** @defgroup PWR_Regulator_Voltage_Scale
98 | * @{
99 | */
100 |
101 | #define PWR_Regulator_Voltage_Scale1 ((uint32_t)0x00004000)
102 | #define PWR_Regulator_Voltage_Scale2 ((uint32_t)0x00000000)
103 | #define IS_PWR_REGULATOR_VOLTAGE(VOLTAGE) (((VOLTAGE) == PWR_Regulator_Voltage_Scale1) || ((VOLTAGE) == PWR_Regulator_Voltage_Scale2))
104 |
105 | /**
106 | * @}
107 | */
108 |
109 | /** @defgroup PWR_Flag
110 | * @{
111 | */
112 |
113 | #define PWR_FLAG_WU PWR_CSR_WUF
114 | #define PWR_FLAG_SB PWR_CSR_SBF
115 | #define PWR_FLAG_PVDO PWR_CSR_PVDO
116 | #define PWR_FLAG_BRR PWR_CSR_BRR
117 | #define PWR_FLAG_VOSRDY PWR_CSR_VOSRDY
118 |
119 | /** @defgroup PWR_Flag_Legacy
120 | * @{
121 | */
122 | #define PWR_FLAG_REGRDY PWR_FLAG_VOSRDY
123 | /**
124 | * @}
125 | */
126 |
127 | #define IS_PWR_GET_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB) || \
128 | ((FLAG) == PWR_FLAG_PVDO) || ((FLAG) == PWR_FLAG_BRR) || \
129 | ((FLAG) == PWR_FLAG_VOSRDY))
130 |
131 | #define IS_PWR_CLEAR_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB))
132 | /**
133 | * @}
134 | */
135 |
136 | /**
137 | * @}
138 | */
139 |
140 | /* Exported macro ------------------------------------------------------------*/
141 | /* Exported functions --------------------------------------------------------*/
142 |
143 | /* Function used to set the PWR configuration to the default reset state ******/
144 | void PWR_DeInit(void);
145 |
146 | /* Backup Domain Access function **********************************************/
147 | void PWR_BackupAccessCmd(FunctionalState NewState);
148 |
149 | /* PVD configuration functions ************************************************/
150 | void PWR_PVDLevelConfig(uint32_t PWR_PVDLevel);
151 | void PWR_PVDCmd(FunctionalState NewState);
152 |
153 | /* WakeUp pins configuration functions ****************************************/
154 | void PWR_WakeUpPinCmd(FunctionalState NewState);
155 |
156 | /* Main and Backup Regulators configuration functions *************************/
157 | void PWR_BackupRegulatorCmd(FunctionalState NewState);
158 | void PWR_MainRegulatorModeConfig(uint32_t PWR_Regulator_Voltage);
159 |
160 | /* FLASH Power Down configuration functions ***********************************/
161 | void PWR_FlashPowerDownCmd(FunctionalState NewState);
162 |
163 | /* Low Power modes configuration functions ************************************/
164 | void PWR_EnterSTOPMode(uint32_t PWR_Regulator, uint8_t PWR_STOPEntry);
165 | void PWR_EnterSTANDBYMode(void);
166 |
167 | /* Flags management functions *************************************************/
168 | FlagStatus PWR_GetFlagStatus(uint32_t PWR_FLAG);
169 | void PWR_ClearFlag(uint32_t PWR_FLAG);
170 |
171 | #ifdef __cplusplus
172 | }
173 | #endif
174 |
175 | #endif /* __STM32F4xx_PWR_H */
176 |
177 | /**
178 | * @}
179 | */
180 |
181 | /**
182 | * @}
183 | */
184 |
185 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
186 |
--------------------------------------------------------------------------------
/lib/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_rng.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f4xx_rng.h
4 | * @author MCD Application Team
5 | * @version V1.0.2
6 | * @date 05-March-2012
7 | * @brief This file contains all the functions prototypes for the Random
8 | * Number Generator(RNG) firmware library.
9 | ******************************************************************************
10 | * @attention
11 | *
12 | * © COPYRIGHT 2012 STMicroelectronics
13 | *
14 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
15 | * You may not use this file except in compliance with the License.
16 | * You may obtain a copy of the License at:
17 | *
18 | * http://www.st.com/software_license_agreement_liberty_v2
19 | *
20 | * Unless required by applicable law or agreed to in writing, software
21 | * distributed under the License is distributed on an "AS IS" BASIS,
22 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 | * See the License for the specific language governing permissions and
24 | * limitations under the License.
25 | *
26 | ******************************************************************************
27 | */
28 |
29 | /* Define to prevent recursive inclusion -------------------------------------*/
30 | #ifndef __STM32F4xx_RNG_H
31 | #define __STM32F4xx_RNG_H
32 |
33 | #ifdef __cplusplus
34 | extern "C" {
35 | #endif
36 |
37 | /* Includes ------------------------------------------------------------------*/
38 | #include "stm32f4xx.h"
39 |
40 | /** @addtogroup STM32F4xx_StdPeriph_Driver
41 | * @{
42 | */
43 |
44 | /** @addtogroup RNG
45 | * @{
46 | */
47 |
48 | /* Exported types ------------------------------------------------------------*/
49 | /* Exported constants --------------------------------------------------------*/
50 |
51 | /** @defgroup RNG_Exported_Constants
52 | * @{
53 | */
54 |
55 | /** @defgroup RNG_flags_definition
56 | * @{
57 | */
58 | #define RNG_FLAG_DRDY ((uint8_t)0x0001) /*!< Data ready */
59 | #define RNG_FLAG_CECS ((uint8_t)0x0002) /*!< Clock error current status */
60 | #define RNG_FLAG_SECS ((uint8_t)0x0004) /*!< Seed error current status */
61 |
62 | #define IS_RNG_GET_FLAG(RNG_FLAG) (((RNG_FLAG) == RNG_FLAG_DRDY) || \
63 | ((RNG_FLAG) == RNG_FLAG_CECS) || \
64 | ((RNG_FLAG) == RNG_FLAG_SECS))
65 | #define IS_RNG_CLEAR_FLAG(RNG_FLAG) (((RNG_FLAG) == RNG_FLAG_CECS) || \
66 | ((RNG_FLAG) == RNG_FLAG_SECS))
67 | /**
68 | * @}
69 | */
70 |
71 | /** @defgroup RNG_interrupts_definition
72 | * @{
73 | */
74 | #define RNG_IT_CEI ((uint8_t)0x20) /*!< Clock error interrupt */
75 | #define RNG_IT_SEI ((uint8_t)0x40) /*!< Seed error interrupt */
76 |
77 | #define IS_RNG_IT(IT) ((((IT) & (uint8_t)0x9F) == 0x00) && ((IT) != 0x00))
78 | #define IS_RNG_GET_IT(RNG_IT) (((RNG_IT) == RNG_IT_CEI) || ((RNG_IT) == RNG_IT_SEI))
79 | /**
80 | * @}
81 | */
82 |
83 | /**
84 | * @}
85 | */
86 |
87 | /* Exported macro ------------------------------------------------------------*/
88 | /* Exported functions --------------------------------------------------------*/
89 |
90 | /* Function used to set the RNG configuration to the default reset state *****/
91 | void RNG_DeInit(void);
92 |
93 | /* Configuration function *****************************************************/
94 | void RNG_Cmd(FunctionalState NewState);
95 |
96 | /* Get 32 bit Random number function ******************************************/
97 | uint32_t RNG_GetRandomNumber(void);
98 |
99 | /* Interrupts and flags management functions **********************************/
100 | void RNG_ITConfig(FunctionalState NewState);
101 | FlagStatus RNG_GetFlagStatus(uint8_t RNG_FLAG);
102 | void RNG_ClearFlag(uint8_t RNG_FLAG);
103 | ITStatus RNG_GetITStatus(uint8_t RNG_IT);
104 | void RNG_ClearITPendingBit(uint8_t RNG_IT);
105 |
106 | #ifdef __cplusplus
107 | }
108 | #endif
109 |
110 | #endif /*__STM32F4xx_RNG_H */
111 |
112 | /**
113 | * @}
114 | */
115 |
116 | /**
117 | * @}
118 | */
119 |
120 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
121 |
--------------------------------------------------------------------------------
/lib/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_syscfg.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f4xx_syscfg.h
4 | * @author MCD Application Team
5 | * @version V1.0.2
6 | * @date 05-March-2012
7 | * @brief This file contains all the functions prototypes for the SYSCFG firmware
8 | * library.
9 | ******************************************************************************
10 | * @attention
11 | *
12 | * © COPYRIGHT 2012 STMicroelectronics
13 | *
14 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
15 | * You may not use this file except in compliance with the License.
16 | * You may obtain a copy of the License at:
17 | *
18 | * http://www.st.com/software_license_agreement_liberty_v2
19 | *
20 | * Unless required by applicable law or agreed to in writing, software
21 | * distributed under the License is distributed on an "AS IS" BASIS,
22 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 | * See the License for the specific language governing permissions and
24 | * limitations under the License.
25 | *
26 | ******************************************************************************
27 | */
28 |
29 | /* Define to prevent recursive inclusion -------------------------------------*/
30 | #ifndef __STM32F4xx_SYSCFG_H
31 | #define __STM32F4xx_SYSCFG_H
32 |
33 | #ifdef __cplusplus
34 | extern "C" {
35 | #endif
36 |
37 | /* Includes ------------------------------------------------------------------*/
38 | #include "stm32f4xx.h"
39 |
40 | /** @addtogroup STM32F4xx_StdPeriph_Driver
41 | * @{
42 | */
43 |
44 | /** @addtogroup SYSCFG
45 | * @{
46 | */
47 |
48 | /* Exported types ------------------------------------------------------------*/
49 | /* Exported constants --------------------------------------------------------*/
50 |
51 | /** @defgroup SYSCFG_Exported_Constants
52 | * @{
53 | */
54 |
55 | /** @defgroup SYSCFG_EXTI_Port_Sources
56 | * @{
57 | */
58 | #define EXTI_PortSourceGPIOA ((uint8_t)0x00)
59 | #define EXTI_PortSourceGPIOB ((uint8_t)0x01)
60 | #define EXTI_PortSourceGPIOC ((uint8_t)0x02)
61 | #define EXTI_PortSourceGPIOD ((uint8_t)0x03)
62 | #define EXTI_PortSourceGPIOE ((uint8_t)0x04)
63 | #define EXTI_PortSourceGPIOF ((uint8_t)0x05)
64 | #define EXTI_PortSourceGPIOG ((uint8_t)0x06)
65 | #define EXTI_PortSourceGPIOH ((uint8_t)0x07)
66 | #define EXTI_PortSourceGPIOI ((uint8_t)0x08)
67 |
68 | #define IS_EXTI_PORT_SOURCE(PORTSOURCE) (((PORTSOURCE) == EXTI_PortSourceGPIOA) || \
69 | ((PORTSOURCE) == EXTI_PortSourceGPIOB) || \
70 | ((PORTSOURCE) == EXTI_PortSourceGPIOC) || \
71 | ((PORTSOURCE) == EXTI_PortSourceGPIOD) || \
72 | ((PORTSOURCE) == EXTI_PortSourceGPIOE) || \
73 | ((PORTSOURCE) == EXTI_PortSourceGPIOF) || \
74 | ((PORTSOURCE) == EXTI_PortSourceGPIOG) || \
75 | ((PORTSOURCE) == EXTI_PortSourceGPIOH) || \
76 | ((PORTSOURCE) == EXTI_PortSourceGPIOI))
77 | /**
78 | * @}
79 | */
80 |
81 |
82 | /** @defgroup SYSCFG_EXTI_Pin_Sources
83 | * @{
84 | */
85 | #define EXTI_PinSource0 ((uint8_t)0x00)
86 | #define EXTI_PinSource1 ((uint8_t)0x01)
87 | #define EXTI_PinSource2 ((uint8_t)0x02)
88 | #define EXTI_PinSource3 ((uint8_t)0x03)
89 | #define EXTI_PinSource4 ((uint8_t)0x04)
90 | #define EXTI_PinSource5 ((uint8_t)0x05)
91 | #define EXTI_PinSource6 ((uint8_t)0x06)
92 | #define EXTI_PinSource7 ((uint8_t)0x07)
93 | #define EXTI_PinSource8 ((uint8_t)0x08)
94 | #define EXTI_PinSource9 ((uint8_t)0x09)
95 | #define EXTI_PinSource10 ((uint8_t)0x0A)
96 | #define EXTI_PinSource11 ((uint8_t)0x0B)
97 | #define EXTI_PinSource12 ((uint8_t)0x0C)
98 | #define EXTI_PinSource13 ((uint8_t)0x0D)
99 | #define EXTI_PinSource14 ((uint8_t)0x0E)
100 | #define EXTI_PinSource15 ((uint8_t)0x0F)
101 | #define IS_EXTI_PIN_SOURCE(PINSOURCE) (((PINSOURCE) == EXTI_PinSource0) || \
102 | ((PINSOURCE) == EXTI_PinSource1) || \
103 | ((PINSOURCE) == EXTI_PinSource2) || \
104 | ((PINSOURCE) == EXTI_PinSource3) || \
105 | ((PINSOURCE) == EXTI_PinSource4) || \
106 | ((PINSOURCE) == EXTI_PinSource5) || \
107 | ((PINSOURCE) == EXTI_PinSource6) || \
108 | ((PINSOURCE) == EXTI_PinSource7) || \
109 | ((PINSOURCE) == EXTI_PinSource8) || \
110 | ((PINSOURCE) == EXTI_PinSource9) || \
111 | ((PINSOURCE) == EXTI_PinSource10) || \
112 | ((PINSOURCE) == EXTI_PinSource11) || \
113 | ((PINSOURCE) == EXTI_PinSource12) || \
114 | ((PINSOURCE) == EXTI_PinSource13) || \
115 | ((PINSOURCE) == EXTI_PinSource14) || \
116 | ((PINSOURCE) == EXTI_PinSource15))
117 | /**
118 | * @}
119 | */
120 |
121 |
122 | /** @defgroup SYSCFG_Memory_Remap_Config
123 | * @{
124 | */
125 | #define SYSCFG_MemoryRemap_Flash ((uint8_t)0x00)
126 | #define SYSCFG_MemoryRemap_SystemFlash ((uint8_t)0x01)
127 | #define SYSCFG_MemoryRemap_FSMC ((uint8_t)0x02)
128 | #define SYSCFG_MemoryRemap_SRAM ((uint8_t)0x03)
129 |
130 | #define IS_SYSCFG_MEMORY_REMAP_CONFING(REMAP) (((REMAP) == SYSCFG_MemoryRemap_Flash) || \
131 | ((REMAP) == SYSCFG_MemoryRemap_SystemFlash) || \
132 | ((REMAP) == SYSCFG_MemoryRemap_SRAM) || \
133 | ((REMAP) == SYSCFG_MemoryRemap_FSMC))
134 | /**
135 | * @}
136 | */
137 |
138 |
139 | /** @defgroup SYSCFG_ETHERNET_Media_Interface
140 | * @{
141 | */
142 | #define SYSCFG_ETH_MediaInterface_MII ((uint32_t)0x00000000)
143 | #define SYSCFG_ETH_MediaInterface_RMII ((uint32_t)0x00000001)
144 |
145 | #define IS_SYSCFG_ETH_MEDIA_INTERFACE(INTERFACE) (((INTERFACE) == SYSCFG_ETH_MediaInterface_MII) || \
146 | ((INTERFACE) == SYSCFG_ETH_MediaInterface_RMII))
147 | /**
148 | * @}
149 | */
150 |
151 | /**
152 | * @}
153 | */
154 |
155 | /* Exported macro ------------------------------------------------------------*/
156 | /* Exported functions --------------------------------------------------------*/
157 |
158 | void SYSCFG_DeInit(void);
159 | void SYSCFG_MemoryRemapConfig(uint8_t SYSCFG_MemoryRemap);
160 | void SYSCFG_EXTILineConfig(uint8_t EXTI_PortSourceGPIOx, uint8_t EXTI_PinSourcex);
161 | void SYSCFG_ETH_MediaInterfaceConfig(uint32_t SYSCFG_ETH_MediaInterface);
162 | void SYSCFG_CompensationCellCmd(FunctionalState NewState);
163 | FlagStatus SYSCFG_GetCompensationCellStatus(void);
164 |
165 | #ifdef __cplusplus
166 | }
167 | #endif
168 |
169 | #endif /*__STM32F4xx_SYSCFG_H */
170 |
171 | /**
172 | * @}
173 | */
174 |
175 | /**
176 | * @}
177 | */
178 |
179 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
180 |
--------------------------------------------------------------------------------
/lib/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_wwdg.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f4xx_wwdg.h
4 | * @author MCD Application Team
5 | * @version V1.0.2
6 | * @date 05-March-2012
7 | * @brief This file contains all the functions prototypes for the WWDG firmware
8 | * library.
9 | ******************************************************************************
10 | * @attention
11 | *
12 | * © COPYRIGHT 2012 STMicroelectronics
13 | *
14 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
15 | * You may not use this file except in compliance with the License.
16 | * You may obtain a copy of the License at:
17 | *
18 | * http://www.st.com/software_license_agreement_liberty_v2
19 | *
20 | * Unless required by applicable law or agreed to in writing, software
21 | * distributed under the License is distributed on an "AS IS" BASIS,
22 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 | * See the License for the specific language governing permissions and
24 | * limitations under the License.
25 | *
26 | ******************************************************************************
27 | */
28 |
29 | /* Define to prevent recursive inclusion -------------------------------------*/
30 | #ifndef __STM32F4xx_WWDG_H
31 | #define __STM32F4xx_WWDG_H
32 |
33 | #ifdef __cplusplus
34 | extern "C" {
35 | #endif
36 |
37 | /* Includes ------------------------------------------------------------------*/
38 | #include "stm32f4xx.h"
39 |
40 | /** @addtogroup STM32F4xx_StdPeriph_Driver
41 | * @{
42 | */
43 |
44 | /** @addtogroup WWDG
45 | * @{
46 | */
47 |
48 | /* Exported types ------------------------------------------------------------*/
49 | /* Exported constants --------------------------------------------------------*/
50 |
51 | /** @defgroup WWDG_Exported_Constants
52 | * @{
53 | */
54 |
55 | /** @defgroup WWDG_Prescaler
56 | * @{
57 | */
58 |
59 | #define WWDG_Prescaler_1 ((uint32_t)0x00000000)
60 | #define WWDG_Prescaler_2 ((uint32_t)0x00000080)
61 | #define WWDG_Prescaler_4 ((uint32_t)0x00000100)
62 | #define WWDG_Prescaler_8 ((uint32_t)0x00000180)
63 | #define IS_WWDG_PRESCALER(PRESCALER) (((PRESCALER) == WWDG_Prescaler_1) || \
64 | ((PRESCALER) == WWDG_Prescaler_2) || \
65 | ((PRESCALER) == WWDG_Prescaler_4) || \
66 | ((PRESCALER) == WWDG_Prescaler_8))
67 | #define IS_WWDG_WINDOW_VALUE(VALUE) ((VALUE) <= 0x7F)
68 | #define IS_WWDG_COUNTER(COUNTER) (((COUNTER) >= 0x40) && ((COUNTER) <= 0x7F))
69 |
70 | /**
71 | * @}
72 | */
73 |
74 | /**
75 | * @}
76 | */
77 |
78 | /* Exported macro ------------------------------------------------------------*/
79 | /* Exported functions --------------------------------------------------------*/
80 |
81 | /* Function used to set the WWDG configuration to the default reset state ****/
82 | void WWDG_DeInit(void);
83 |
84 | /* Prescaler, Refresh window and Counter configuration functions **************/
85 | void WWDG_SetPrescaler(uint32_t WWDG_Prescaler);
86 | void WWDG_SetWindowValue(uint8_t WindowValue);
87 | void WWDG_EnableIT(void);
88 | void WWDG_SetCounter(uint8_t Counter);
89 |
90 | /* WWDG activation function ***************************************************/
91 | void WWDG_Enable(uint8_t Counter);
92 |
93 | /* Interrupts and flags management functions **********************************/
94 | FlagStatus WWDG_GetFlagStatus(void);
95 | void WWDG_ClearFlag(void);
96 |
97 | #ifdef __cplusplus
98 | }
99 | #endif
100 |
101 | #endif /* __STM32F4xx_WWDG_H */
102 |
103 | /**
104 | * @}
105 | */
106 |
107 | /**
108 | * @}
109 | */
110 |
111 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
112 |
--------------------------------------------------------------------------------
/lib/STM32F4xx_StdPeriph_Driver/module.mk:
--------------------------------------------------------------------------------
1 | local_dir := lib/STM32F4xx_StdPeriph_Driver
2 | local_lib := $(local_dir)/libstm32f4xx.a
3 | local_src := $(addprefix $(local_dir)/src/, \
4 | misc.c stm32f4xx_dma.c stm32f4xx_rcc.c \
5 | stm32f4xx_adc.c stm32f4xx_exti.c stm32f4xx_rng.c \
6 | stm32f4xx_can.c stm32f4xx_flash.c stm32f4xx_rtc.c \
7 | stm32f4xx_crc.c stm32f4xx_fsmc.c stm32f4xx_sdio.c \
8 | stm32f4xx_cryp_aes.c stm32f4xx_gpio.c stm32f4xx_spi.c \
9 | stm32f4xx_cryp.c stm32f4xx_hash.c stm32f4xx_syscfg.c \
10 | stm32f4xx_cryp_des.c stm32f4xx_hash_md5.c stm32f4xx_tim.c \
11 | stm32f4xx_cryp_tdes.c stm32f4xx_hash_sha1.c stm32f4xx_usart.c \
12 | stm32f4xx_dac.c stm32f4xx_i2c.c stm32f4xx_wwdg.c \
13 | stm32f4xx_dbgmcu.c stm32f4xx_iwdg.c \
14 | stm32f4xx_dcmi.c stm32f4xx_pwr.c \
15 | )
16 | local_obj := $(patsubst %.c,%.o,$(local_src))
17 | libraries += $(local_lib)
18 | sources += $(local_src)
19 |
20 | $(local_lib): $(local_obj)
21 | $(AR) $(ARFLAGS) $@ $^
22 |
--------------------------------------------------------------------------------
/lib/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_crc.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f4xx_crc.c
4 | * @author MCD Application Team
5 | * @version V1.0.2
6 | * @date 05-March-2012
7 | * @brief This file provides all the CRC firmware functions.
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * © COPYRIGHT 2012 STMicroelectronics
12 | *
13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
14 | * You may not use this file except in compliance with the License.
15 | * You may obtain a copy of the License at:
16 | *
17 | * http://www.st.com/software_license_agreement_liberty_v2
18 | *
19 | * Unless required by applicable law or agreed to in writing, software
20 | * distributed under the License is distributed on an "AS IS" BASIS,
21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 | * See the License for the specific language governing permissions and
23 | * limitations under the License.
24 | *
25 | ******************************************************************************
26 | */
27 |
28 | /* Includes ------------------------------------------------------------------*/
29 | #include "stm32f4xx_crc.h"
30 |
31 | /** @addtogroup STM32F4xx_StdPeriph_Driver
32 | * @{
33 | */
34 |
35 | /** @defgroup CRC
36 | * @brief CRC driver modules
37 | * @{
38 | */
39 |
40 | /* Private typedef -----------------------------------------------------------*/
41 | /* Private define ------------------------------------------------------------*/
42 | /* Private macro -------------------------------------------------------------*/
43 | /* Private variables ---------------------------------------------------------*/
44 | /* Private function prototypes -----------------------------------------------*/
45 | /* Private functions ---------------------------------------------------------*/
46 |
47 | /** @defgroup CRC_Private_Functions
48 | * @{
49 | */
50 |
51 | /**
52 | * @brief Resets the CRC Data register (DR).
53 | * @param None
54 | * @retval None
55 | */
56 | void CRC_ResetDR(void)
57 | {
58 | /* Reset CRC generator */
59 | CRC->CR = CRC_CR_RESET;
60 | }
61 |
62 | /**
63 | * @brief Computes the 32-bit CRC of a given data word(32-bit).
64 | * @param Data: data word(32-bit) to compute its CRC
65 | * @retval 32-bit CRC
66 | */
67 | uint32_t CRC_CalcCRC(uint32_t Data)
68 | {
69 | CRC->DR = Data;
70 |
71 | return (CRC->DR);
72 | }
73 |
74 | /**
75 | * @brief Computes the 32-bit CRC of a given buffer of data word(32-bit).
76 | * @param pBuffer: pointer to the buffer containing the data to be computed
77 | * @param BufferLength: length of the buffer to be computed
78 | * @retval 32-bit CRC
79 | */
80 | uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength)
81 | {
82 | uint32_t index = 0;
83 |
84 | for(index = 0; index < BufferLength; index++)
85 | {
86 | CRC->DR = pBuffer[index];
87 | }
88 | return (CRC->DR);
89 | }
90 |
91 | /**
92 | * @brief Returns the current CRC value.
93 | * @param None
94 | * @retval 32-bit CRC
95 | */
96 | uint32_t CRC_GetCRC(void)
97 | {
98 | return (CRC->DR);
99 | }
100 |
101 | /**
102 | * @brief Stores a 8-bit data in the Independent Data(ID) register.
103 | * @param IDValue: 8-bit value to be stored in the ID register
104 | * @retval None
105 | */
106 | void CRC_SetIDRegister(uint8_t IDValue)
107 | {
108 | CRC->IDR = IDValue;
109 | }
110 |
111 | /**
112 | * @brief Returns the 8-bit data stored in the Independent Data(ID) register
113 | * @param None
114 | * @retval 8-bit value of the ID register
115 | */
116 | uint8_t CRC_GetIDRegister(void)
117 | {
118 | return (CRC->IDR);
119 | }
120 |
121 | /**
122 | * @}
123 | */
124 |
125 | /**
126 | * @}
127 | */
128 |
129 | /**
130 | * @}
131 | */
132 |
133 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
134 |
--------------------------------------------------------------------------------
/lib/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_dbgmcu.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f4xx_dbgmcu.c
4 | * @author MCD Application Team
5 | * @version V1.0.2
6 | * @date 05-March-2012
7 | * @brief This file provides all the DBGMCU firmware functions.
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * © COPYRIGHT 2012 STMicroelectronics
12 | *
13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
14 | * You may not use this file except in compliance with the License.
15 | * You may obtain a copy of the License at:
16 | *
17 | * http://www.st.com/software_license_agreement_liberty_v2
18 | *
19 | * Unless required by applicable law or agreed to in writing, software
20 | * distributed under the License is distributed on an "AS IS" BASIS,
21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 | * See the License for the specific language governing permissions and
23 | * limitations under the License.
24 | *
25 | ******************************************************************************
26 | */
27 |
28 | /* Includes ------------------------------------------------------------------*/
29 | #include "stm32f4xx_dbgmcu.h"
30 |
31 | /** @addtogroup STM32F4xx_StdPeriph_Driver
32 | * @{
33 | */
34 |
35 | /** @defgroup DBGMCU
36 | * @brief DBGMCU driver modules
37 | * @{
38 | */
39 |
40 | /* Private typedef -----------------------------------------------------------*/
41 | /* Private define ------------------------------------------------------------*/
42 | #define IDCODE_DEVID_MASK ((uint32_t)0x00000FFF)
43 |
44 | /* Private macro -------------------------------------------------------------*/
45 | /* Private variables ---------------------------------------------------------*/
46 | /* Private function prototypes -----------------------------------------------*/
47 | /* Private functions ---------------------------------------------------------*/
48 |
49 | /** @defgroup DBGMCU_Private_Functions
50 | * @{
51 | */
52 |
53 | /**
54 | * @brief Returns the device revision identifier.
55 | * @param None
56 | * @retval Device revision identifier
57 | */
58 | uint32_t DBGMCU_GetREVID(void)
59 | {
60 | return(DBGMCU->IDCODE >> 16);
61 | }
62 |
63 | /**
64 | * @brief Returns the device identifier.
65 | * @param None
66 | * @retval Device identifier
67 | */
68 | uint32_t DBGMCU_GetDEVID(void)
69 | {
70 | return(DBGMCU->IDCODE & IDCODE_DEVID_MASK);
71 | }
72 |
73 | /**
74 | * @brief Configures low power mode behavior when the MCU is in Debug mode.
75 | * @param DBGMCU_Periph: specifies the low power mode.
76 | * This parameter can be any combination of the following values:
77 | * @arg DBGMCU_SLEEP: Keep debugger connection during SLEEP mode
78 | * @arg DBGMCU_STOP: Keep debugger connection during STOP mode
79 | * @arg DBGMCU_STANDBY: Keep debugger connection during STANDBY mode
80 | * @param NewState: new state of the specified low power mode in Debug mode.
81 | * This parameter can be: ENABLE or DISABLE.
82 | * @retval None
83 | */
84 | void DBGMCU_Config(uint32_t DBGMCU_Periph, FunctionalState NewState)
85 | {
86 | /* Check the parameters */
87 | assert_param(IS_DBGMCU_PERIPH(DBGMCU_Periph));
88 | assert_param(IS_FUNCTIONAL_STATE(NewState));
89 | if (NewState != DISABLE)
90 | {
91 | DBGMCU->CR |= DBGMCU_Periph;
92 | }
93 | else
94 | {
95 | DBGMCU->CR &= ~DBGMCU_Periph;
96 | }
97 | }
98 |
99 | /**
100 | * @brief Configures APB1 peripheral behavior when the MCU is in Debug mode.
101 | * @param DBGMCU_Periph: specifies the APB1 peripheral.
102 | * This parameter can be any combination of the following values:
103 | * @arg DBGMCU_TIM2_STOP: TIM2 counter stopped when Core is halted
104 | * @arg DBGMCU_TIM3_STOP: TIM3 counter stopped when Core is halted
105 | * @arg DBGMCU_TIM4_STOP: TIM4 counter stopped when Core is halted
106 | * @arg DBGMCU_TIM5_STOP: TIM5 counter stopped when Core is halted
107 | * @arg DBGMCU_TIM6_STOP: TIM6 counter stopped when Core is halted
108 | * @arg DBGMCU_TIM7_STOP: TIM7 counter stopped when Core is halted
109 | * @arg DBGMCU_TIM12_STOP: TIM12 counter stopped when Core is halted
110 | * @arg DBGMCU_TIM13_STOP: TIM13 counter stopped when Core is halted
111 | * @arg DBGMCU_TIM14_STOP: TIM14 counter stopped when Core is halted
112 | * @arg DBGMCU_RTC_STOP: RTC Calendar and Wakeup counter stopped when Core is halted.
113 | * @arg DBGMCU_WWDG_STOP: Debug WWDG stopped when Core is halted
114 | * @arg DBGMCU_IWDG_STOP: Debug IWDG stopped when Core is halted
115 | * @arg DBGMCU_I2C1_SMBUS_TIMEOUT: I2C1 SMBUS timeout mode stopped when Core is halted
116 | * @arg DBGMCU_I2C2_SMBUS_TIMEOUT: I2C2 SMBUS timeout mode stopped when Core is halted
117 | * @arg DBGMCU_I2C3_SMBUS_TIMEOUT: I2C3 SMBUS timeout mode stopped when Core is halted
118 | * @arg DBGMCU_CAN2_STOP: Debug CAN1 stopped when Core is halted
119 | * @arg DBGMCU_CAN1_STOP: Debug CAN2 stopped when Core is halted
120 | * This parameter can be: ENABLE or DISABLE.
121 | * @retval None
122 | */
123 | void DBGMCU_APB1PeriphConfig(uint32_t DBGMCU_Periph, FunctionalState NewState)
124 | {
125 | /* Check the parameters */
126 | assert_param(IS_DBGMCU_APB1PERIPH(DBGMCU_Periph));
127 | assert_param(IS_FUNCTIONAL_STATE(NewState));
128 |
129 | if (NewState != DISABLE)
130 | {
131 | DBGMCU->APB1FZ |= DBGMCU_Periph;
132 | }
133 | else
134 | {
135 | DBGMCU->APB1FZ &= ~DBGMCU_Periph;
136 | }
137 | }
138 |
139 | /**
140 | * @brief Configures APB2 peripheral behavior when the MCU is in Debug mode.
141 | * @param DBGMCU_Periph: specifies the APB2 peripheral.
142 | * This parameter can be any combination of the following values:
143 | * @arg DBGMCU_TIM1_STOP: TIM1 counter stopped when Core is halted
144 | * @arg DBGMCU_TIM8_STOP: TIM8 counter stopped when Core is halted
145 | * @arg DBGMCU_TIM9_STOP: TIM9 counter stopped when Core is halted
146 | * @arg DBGMCU_TIM10_STOP: TIM10 counter stopped when Core is halted
147 | * @arg DBGMCU_TIM11_STOP: TIM11 counter stopped when Core is halted
148 | * @param NewState: new state of the specified peripheral in Debug mode.
149 | * This parameter can be: ENABLE or DISABLE.
150 | * @retval None
151 | */
152 | void DBGMCU_APB2PeriphConfig(uint32_t DBGMCU_Periph, FunctionalState NewState)
153 | {
154 | /* Check the parameters */
155 | assert_param(IS_DBGMCU_APB2PERIPH(DBGMCU_Periph));
156 | assert_param(IS_FUNCTIONAL_STATE(NewState));
157 |
158 | if (NewState != DISABLE)
159 | {
160 | DBGMCU->APB2FZ |= DBGMCU_Periph;
161 | }
162 | else
163 | {
164 | DBGMCU->APB2FZ &= ~DBGMCU_Periph;
165 | }
166 | }
167 |
168 | /**
169 | * @}
170 | */
171 |
172 | /**
173 | * @}
174 | */
175 |
176 | /**
177 | * @}
178 | */
179 |
180 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
181 |
--------------------------------------------------------------------------------
/lib/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_flash.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zenglongGH/stm32f4-CANopen-project/3978d32dd86aadb9af3f4b475801d0a1d54c6231/lib/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_flash.c
--------------------------------------------------------------------------------
/lib/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_rcc.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zenglongGH/stm32f4-CANopen-project/3978d32dd86aadb9af3f4b475801d0a1d54c6231/lib/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_rcc.c
--------------------------------------------------------------------------------
/lib/od_config/inc/CO_config.h:
--------------------------------------------------------------------------------
1 | /*
2 | * config.h
3 | *
4 | * Created on: Dec 4, 2012
5 | * Author: Niklas Norin
6 | */
7 |
8 | #ifndef CONFIG_H_
9 | #define CONFIG_H_
10 |
11 | //#include "stm32f4_discovery.h"
12 | #include "stm32f4xx.h"
13 |
14 | /* LED interface */
15 | #define RCC_APB1Periph_GPIO_LED RCC_AHB1Periph_GPIOD
16 | #define GPIO_LEDS GPIOD
17 | #define GPIO_Pin_Led_GREEN GPIO_Pin_2
18 | #define GPIO_Pin_Led_RED GPIO_Pin_3
19 | #define LED_POSITIVE
20 |
21 | /* CAN interface */
22 | #define CLOCK_CAN RCC_APB1Periph_CAN1
23 | #define CLOCK_GPIO_CAN RCC_AHB1Periph_GPIOD
24 |
25 | #define GPIO_Pin_CAN_RX GPIO_Pin_0
26 | #define GPIO_Pin_CAN_TX GPIO_Pin_1
27 | #define GPIO_CAN GPIOD
28 | #define CAN_GPIO_CLK RCC_AHB1Periph_GPIOD
29 | #define CAN_AF_PORT GPIO_AF_CAN1
30 | #define CAN_RX_SOURCE GPIO_PinSource0
31 | #define CAN_TX_SOURCE GPIO_PinSource1
32 |
33 | /* Mailboxes definition - Taken from stm32f4xx_can.c */
34 | #define TMIDxR_TXRQ ((uint32_t)0x00000001) /* Transmit mailbox request */
35 | #define CAN_TXMAILBOX_0 ((uint8_t)0x00)
36 | #define CAN_TXMAILBOX_1 ((uint8_t)0x01)
37 | #define CAN_TXMAILBOX_2 ((uint8_t)0x02)
38 |
39 | /* Debug Interface */
40 | //#define USART_DBG USART2
41 | //#define USART_DBG_CLK RCC_APB1Periph_USART2
42 |
43 | //#define USART_DBG_GPIO GPIOA
44 | //#define USART_DBG_GPIO_CLK RCC_AHB1Periph_GPIOA
45 | //#define USART_DBG_RxPin GPIO_Pin_3
46 | //#define USART_DBG_TxPin GPIO_Pin_2
47 |
48 | #endif /* CONFIG_H_ */
49 |
--------------------------------------------------------------------------------
/stm32_flash.ld:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zenglongGH/stm32f4-CANopen-project/3978d32dd86aadb9af3f4b475801d0a1d54c6231/stm32_flash.ld
--------------------------------------------------------------------------------