some minimal progress
This commit is contained in:
@ -1,4 +1,4 @@
|
|||||||
# Processed by ../tools/insertMyCode.sh
|
# Processed by ../tools/insertMyCode.sh
|
||||||
##########################################################################################################################
|
##########################################################################################################################
|
||||||
# File automatically-generated by tool: [projectgenerator] version: [3.10.0-B14] date: [Sun Oct 18 22:15:54 CEST 2020]
|
# File automatically-generated by tool: [projectgenerator] version: [3.10.0-B14] date: [Sun Oct 18 22:15:54 CEST 2020]
|
||||||
##########################################################################################################################
|
##########################################################################################################################
|
||||||
@ -36,36 +36,36 @@ BUILD_DIR = build
|
|||||||
# source
|
# source
|
||||||
######################################
|
######################################
|
||||||
# C sources
|
# C sources
|
||||||
C_SOURCES = \
|
C_SOURCES = \
|
||||||
User/Src/main2.c hottislib/PontCoopScheduler.c \
|
User/Src/main2.c User/Src/led.c User/Src/loopCtrl.c hottislib/PontCoopScheduler.c \
|
||||||
Core/Src/main.c \
|
Core/Src/main.c \
|
||||||
Core/Src/gpio.c \
|
Core/Src/gpio.c \
|
||||||
Core/Src/adc.c \
|
Core/Src/adc.c \
|
||||||
Core/Src/spi.c \
|
Core/Src/spi.c \
|
||||||
Core/Src/usart.c \
|
Core/Src/usart.c \
|
||||||
Core/Src/stm32f1xx_it.c \
|
Core/Src/stm32f1xx_it.c \
|
||||||
Core/Src/stm32f1xx_hal_msp.c \
|
Core/Src/stm32f1xx_hal_msp.c \
|
||||||
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c \
|
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c \
|
||||||
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc.c \
|
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc.c \
|
||||||
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc_ex.c \
|
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc_ex.c \
|
||||||
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c \
|
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c \
|
||||||
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c \
|
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c \
|
||||||
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c \
|
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c \
|
||||||
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c \
|
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c \
|
||||||
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c \
|
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c \
|
||||||
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c \
|
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c \
|
||||||
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c \
|
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c \
|
||||||
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c \
|
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c \
|
||||||
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c \
|
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c \
|
||||||
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c \
|
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c \
|
||||||
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi.c \
|
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi.c \
|
||||||
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c \
|
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c \
|
||||||
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c \
|
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c \
|
||||||
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c \
|
Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c \
|
||||||
Core/Src/system_stm32f1xx.c
|
Core/Src/system_stm32f1xx.c
|
||||||
|
|
||||||
# ASM sources
|
# ASM sources
|
||||||
ASM_SOURCES = \
|
ASM_SOURCES = \
|
||||||
startup_stm32f103xe.s
|
startup_stm32f103xe.s
|
||||||
|
|
||||||
|
|
||||||
@ -109,8 +109,8 @@ MCU = $(CPU) -mthumb $(FPU) $(FLOAT-ABI)
|
|||||||
AS_DEFS =
|
AS_DEFS =
|
||||||
|
|
||||||
# C defines
|
# C defines
|
||||||
C_DEFS = \
|
C_DEFS = \
|
||||||
-DUSE_HAL_DRIVER \
|
-DUSE_HAL_DRIVER \
|
||||||
-DSTM32F103xE
|
-DSTM32F103xE
|
||||||
|
|
||||||
|
|
||||||
@ -118,14 +118,14 @@ C_DEFS = \
|
|||||||
AS_INCLUDES =
|
AS_INCLUDES =
|
||||||
|
|
||||||
# C includes
|
# C includes
|
||||||
C_INCLUDES = \
|
C_INCLUDES = \
|
||||||
-Ihottislib \
|
-Ihottislib \
|
||||||
-IUser/Inc \
|
-IUser/Inc \
|
||||||
-ICore/Inc \
|
-ICore/Inc \
|
||||||
-IDrivers/STM32F1xx_HAL_Driver/Inc \
|
-IDrivers/STM32F1xx_HAL_Driver/Inc \
|
||||||
-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy \
|
-IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy \
|
||||||
-IDrivers/CMSIS/Device/ST/STM32F1xx/Include \
|
-IDrivers/CMSIS/Device/ST/STM32F1xx/Include \
|
||||||
-IDrivers/CMSIS/Include \
|
-IDrivers/CMSIS/Include \
|
||||||
-IDrivers/CMSIS/Include
|
-IDrivers/CMSIS/Include
|
||||||
|
|
||||||
|
|
||||||
|
9
cube/User/Inc/led.h
Normal file
9
cube/User/Inc/led.h
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#ifndef _LED_H_
|
||||||
|
#define _LED_H_
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
void ledRed(bool on);
|
||||||
|
void ledGreen(bool on);
|
||||||
|
|
||||||
|
#endif // _LED_H_
|
8
cube/User/Inc/loopCtrl.h
Normal file
8
cube/User/Inc/loopCtrl.h
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#ifndef _LOOPCTRL_H_
|
||||||
|
#define _LOOPCTRL_H_
|
||||||
|
|
||||||
|
void loopEnable();
|
||||||
|
void loopDisable();
|
||||||
|
|
||||||
|
|
||||||
|
#endif // _LOOPCTRL_H_
|
10
cube/User/Src/led.c
Normal file
10
cube/User/Src/led.c
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#include <main.h>
|
||||||
|
#include <led.h>
|
||||||
|
|
||||||
|
void ledRed(bool on) {
|
||||||
|
HAL_GPIO_WritePin(LED_Red_GPIO_Port, LED_Red_Pin, on ? GPIO_PIN_SET : GPIO_PIN_RESET);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ledGreen(bool on) {
|
||||||
|
HAL_GPIO_WritePin(LED_Green_GPIO_Port, LED_Green_Pin, on ? GPIO_PIN_SET : GPIO_PIN_RESET);
|
||||||
|
}
|
12
cube/User/Src/loopCtrl.c
Normal file
12
cube/User/Src/loopCtrl.c
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#include <main.h>
|
||||||
|
#include <loopCtrl.h>
|
||||||
|
|
||||||
|
void loopEnable() {
|
||||||
|
HAL_GPIO_WritePin(Loop_Enable_GPIO_Port, Loop_Enable_Pin, GPIO_PIN_SET);
|
||||||
|
HAL_GPIO_WritePin(Loop_Enable_GPIO_Port, Loop_Enable_Pin, GPIO_PIN_RESET);
|
||||||
|
}
|
||||||
|
|
||||||
|
void loopDisable() {
|
||||||
|
HAL_GPIO_WritePin(Loop_Disable_GPIO_Port, Loop_Disable_Pin, GPIO_PIN_SET);
|
||||||
|
HAL_GPIO_WritePin(Loop_Disable_GPIO_Port, Loop_Disable_Pin, GPIO_PIN_RESET);
|
||||||
|
}
|
@ -7,72 +7,66 @@
|
|||||||
#include <main.h>
|
#include <main.h>
|
||||||
#include <usart.h>
|
#include <usart.h>
|
||||||
|
|
||||||
|
#include <led.h>
|
||||||
|
#include <loopCtrl.h>
|
||||||
|
|
||||||
void my_setup_1() {
|
void my_setup_1() {
|
||||||
schInit();
|
schInit();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void my_errorHandler() {
|
void my_errorHandler() {
|
||||||
|
ledRed(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void blinkRed(void *handle) {
|
void blinkRed(void *handle) {
|
||||||
HAL_GPIO_TogglePin(LED_Red_GPIO_Port, LED_Red_Pin);
|
static bool on = false;
|
||||||
|
ledRed(on);
|
||||||
|
on ^= true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void blinkGreen(void *handle) {
|
void blinkGreen(void *handle) {
|
||||||
HAL_GPIO_TogglePin(LED_Green_GPIO_Port, LED_Green_Pin);
|
static bool on = false;
|
||||||
|
ledGreen(on);
|
||||||
|
on ^= true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void helloWorld(void *handle) {
|
void helloWorld(void *handle) {
|
||||||
static char hello[] = "Hello World\n\r";
|
static char hello[] = "Hello World\n\r";
|
||||||
HAL_UART_Transmit_IT(&debugUart, (uint8_t*) hello, strlen(hello));
|
HAL_UART_Transmit_IT(&debugUart, (uint8_t*) hello, strlen(hello));
|
||||||
}
|
}
|
||||||
|
|
||||||
void helloMeterbus(void *handle) {
|
void helloMeterbus(void *handle) {
|
||||||
static char hello[] = "Hello Meterbus\n\r";
|
static char hello[] = "Hello Meterbus\n\r";
|
||||||
HAL_UART_Transmit_IT(&mbusUart, (uint8_t*) hello, strlen(hello));
|
HAL_UART_Transmit_IT(&mbusUart, (uint8_t*) hello, strlen(hello));
|
||||||
}
|
|
||||||
|
|
||||||
void enableLoop(void *handle) {
|
|
||||||
HAL_GPIO_WritePin(Loop_Enable_GPIO_Port, Loop_Enable_Pin, GPIO_PIN_SET);
|
|
||||||
HAL_GPIO_WritePin(Loop_Enable_GPIO_Port, Loop_Enable_Pin, GPIO_PIN_RESET);
|
|
||||||
}
|
|
||||||
|
|
||||||
void disableLoop(void *handle) {
|
|
||||||
HAL_GPIO_WritePin(Loop_Disable_GPIO_Port, Loop_Disable_Pin, GPIO_PIN_SET);
|
|
||||||
HAL_GPIO_WritePin(Loop_Disable_GPIO_Port, Loop_Disable_Pin, GPIO_PIN_RESET);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void toggleLoop(void *handle) {
|
void toggleLoop(void *handle) {
|
||||||
static bool state = false;
|
static bool state = false;
|
||||||
|
|
||||||
if (state) {
|
if (state) {
|
||||||
disableLoop(NULL);
|
loopDisable();
|
||||||
} else {
|
} else {
|
||||||
enableLoop(NULL);
|
loopEnable();
|
||||||
}
|
}
|
||||||
state ^= true;
|
state ^= true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void my_setup_2() {
|
void my_setup_2() {
|
||||||
schAdd(blinkRed, NULL, 0, 500);
|
ledRed(false);
|
||||||
schAdd(blinkGreen, NULL, 0, 1000);
|
ledGreen(true);
|
||||||
schAdd(helloWorld, NULL, 0, 5000);
|
|
||||||
// schAdd(enableLoop, NULL, 10000, 0);
|
schAdd(helloWorld, NULL, 0, 5000);
|
||||||
// schAdd(disableLoop, NULL, 20000, 0);
|
schAdd(toggleLoop, NULL, 0, 10000);
|
||||||
schAdd(toggleLoop, NULL, 0, 10000);
|
schAdd(helloMeterbus, NULL, 0, 1000);
|
||||||
schAdd(helloMeterbus, NULL, 0, 1000);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void my_loop() {
|
void my_loop() {
|
||||||
schExec();
|
schExec();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SYSTICK_Callback() {
|
void SYSTICK_Callback() {
|
||||||
schUpdate();
|
schUpdate();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user