Skip to content

STM32F4 Discovery program used to demostrate the CubeMonitor VUE interface. Includes libraries for input/output manipulation (double/long/short click detection etc.). Check the second part https://github.com/panvicka/CubeMonitor-VUE-Demo-MCU

Notifications You must be signed in to change notification settings

panvicka/CubeMonitor-VUE-Demo-MCU

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CubeMonitor+Vue Demo (MCU program part)

This project is a part of a larger project CubeMonitor+Vue Demo. This part contains the code for MCU created with HAL libraries, in this for STM32F407 evaluation board (code is quite portable if you do not have exactly this board).

Check this project github page for more info and Doxygen build documentation.

Check the UI Vue part for integration with CubeMonitor

Setup to use with the VUE interface

You will need: - STM32F407 Discovery board or any other evaluation board - STM IDE (turns out the Atollic and STM IDE are not really back-compatible, the configuration is broken...)

Steps:

  1. Fork and clone this repository
  2. Import the project into STM IDE
  3. (if you have the STM32F407 Discovery board) flash it with the program_VX.X.hex from the Release folder
  4. (build yourself for a different MCU) The project setting should be imported as well but just to be sure this is the build command used:
-mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32F407xx -c -I../Core/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb
  1. Continue with the VUE part setup

Libraries usage

This project was created to demonstrate the possibilities of the CubeMonitor Vue UI, but it also contains libraries that can be used separately.

Digital input

  1. make sure to define your HW correctly, if you are not using STM HAL, redefine the weak function input_get_hw_HAL
  2. define symbol LIB_DI
  3. create an enum listing all inputs you would like to use, do not forget to include one extra named DI_NONE
typedef enum digInputs {
	YOUR_INPUT_1,
	YOUR_INPUT_2,
	DI_NONE,
}digInputs;
  1. initialize your inputs using input_init and digitalInputInitData structure. Check the documentation for more info on the types.
digitalInputInitData digital_input_init;
digital_input_init.debounc_time = DI_DEBOUNC_MS;
digital_input_init.double_press_spacing = DI_DOUBLE_PRESS_SPACING;
digital_input_init.long_press_ms = DI_LONG_PRESS_MIN_DURATION;
digital_input_init.input_get_hw_state = NULL;
digital_input_init.mcu_pin = BUTTON_Pin;
digital_input_init.mcu_port = BUTTON_GPIO_Port;
digital_input_init.sw_type = INPUT_SW_BUTTON;
digital_input_init.hw_type = INPUT_HW_ACTIVE_HIGH;
input_init(DI_BUTTON, digital_input_init);
  1. call the input_handle every 1ms
  2. then you can use input_get_action to fetch input actions:
INPUT_ACT_FALLING_EDGE
INPUT_ACT_RISING_EDGE
INPUT_ACT_SHORT_PRESS
INPUT_ACT_LONG_PRESS
INPUT_ACT_DOUBLE_PRESS

Analog input

  1. make sure to define your HW correctly
  2. define symbol LIB_AI
  3. create an enum listing all analog inputs you would like to use, do not forget to include one extra named AI_NONE
typedef enum anaInputs {
	YOUR_ANALOG_INPUT_1,
	YOUR_ANALOG_INPUT_2,
	AI_NONE
}anaInputs;
  1. initialize your inputs using analog_input_init Check the documentation for more info on the types.
analog_input_init(AI_1, AI_SAMPLING_AI1,
			lin_adc_no_scaling_no_corrections);
  1. call analog_input_start
  2. place analog_input_handle into HAL_ADC_ConvCpltCallback
  3. fetch current value, averaged current value or directly scaled voltage with analog_input_get

About

STM32F4 Discovery program used to demostrate the CubeMonitor VUE interface. Includes libraries for input/output manipulation (double/long/short click detection etc.). Check the second part https://github.com/panvicka/CubeMonitor-VUE-Demo-MCU

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages