From fb89de5354dca067a795d14cb66358d21ac63d3f Mon Sep 17 00:00:00 2001 From: kachelto100370 Date: Mon, 9 Mar 2026 12:14:02 +0100 Subject: [PATCH] =?UTF-8?q?potentieller=20L=C3=B6sungsweg,=20kann=20ihn=20?= =?UTF-8?q?nicht=20ausprobieren?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../task1.1727452765701.pdom | Bin 1658880 -> 1662976 bytes .../37/c0ca9ea2a71b00111e1997f66d7c19f4 | 202 ++ .../6/506794a2a31b00111e1997f66d7c19f4 | 158 + .../78/10112b68a61b00111e1997f66d7c19f4 | 198 ++ .../9a/00f5864da51b00111e1997f66d7c19f4 | 179 + .../ba/50da93c8a61b00111e1997f66d7c19f4 | 202 ++ .../e5/302d8a9fa61b00111e1997f66d7c19f4 | 200 ++ .../f7/007e02b9a81b00111e1997f66d7c19f4 | 205 ++ .../.projects/task1/.markers.snap | Bin 217 -> 1085 bytes .../.projects/task1/.syncinfo.snap | Bin 16 -> 80 bytes .../.projects/task2/.markers.snap | Bin 16 -> 80 bytes .../.projects/task2/.syncinfo.snap | Bin 16 -> 80 bytes .../.projects/task3/.markers.snap | Bin 16 -> 80 bytes .../.projects/task3/.syncinfo.snap | Bin 16 -> 80 bytes .../.projects/task4/.markers.snap | Bin 16 -> 80 bytes .../.projects/task4/.syncinfo.snap | Bin 16 -> 80 bytes .../.root/.markers.snap | Bin 16 -> 80 bytes .../org.eclipse.core.resources/63.snap | Bin 130 -> 650 bytes .../org.eclipse.e4.workbench/workbench.xmi | 2870 ++++++++--------- task1/Src/task1.c | 49 +- 20 files changed, 2827 insertions(+), 1436 deletions(-) create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/37/c0ca9ea2a71b00111e1997f66d7c19f4 create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/6/506794a2a31b00111e1997f66d7c19f4 create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/78/10112b68a61b00111e1997f66d7c19f4 create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/9a/00f5864da51b00111e1997f66d7c19f4 create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ba/50da93c8a61b00111e1997f66d7c19f4 create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e5/302d8a9fa61b00111e1997f66d7c19f4 create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f7/007e02b9a81b00111e1997f66d7c19f4 diff --git a/.metadata/.plugins/org.eclipse.cdt.core/task1.1727452765701.pdom b/.metadata/.plugins/org.eclipse.cdt.core/task1.1727452765701.pdom index b3202ecb0a992be1ca3650329d1042eb5d3f1726..eee0593386906161139e01e7374018fd8741ed6f 100644 GIT binary patch delta 13616 zcma)@dz2K_oyYHV&A<%I;0zAf?ZR|3%=AlS5z&J#Di|aZQPE(0tO6>yqCoH!RySIp zqUb>nm`H`3h`|jW@dOuiu_cOtQ4@4EKBD3qlf#MviV+=DWcKs>-CNZ))BLgboSN>g z@9*)w@8A7Z&Ai`EpSNjxvw6=La}F_4GFIpY`&<^ zl<<~(E*X8?Es5GvqPA-HXP#GhDERE_s-KlE@2GnAghX*?Y3MPDs<)Kq`_qNaw@qNY9z7bVhbgS+qVlMMDO@6$6l zW_h186Y15_o$BC$<$bP5q*vYE=l(uihj2A=HF5PV^|}Ahi?(`R+n2!=bDM7n7LRYN zzJ1r+X0Co*{Y$&%9=891MD~r+r-vucs7hon4zBn|)qv7Z1|<6?64_US8`d8-pmbYH zGBGHTZ7kh+QnIC2BHJ7s{-b2Nv}Jtq7b_CQj$rc6NEl9Lm;x?s6}HU$Ut zvptx+oBP>Mf~R*UXD2f61VcaLGuIF-|19}gBG)gt`*VJ0cb5))o*Y_zeDPztcPE`q zcNae}Ud!FaB=}MFo7Ya8zs-IA@8W;H=9Bx*>N)D({~2|Lh#D{ZTyWXm3y5!xb&N3CK76Y(U`N}LTD61PnLy((cdH=ilo{Ox78i|8d7NVUSmy_YQIfps-}h> z)Aw4B>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@{v%0kV2v-nSX{A5XYwPK@N>YKgz*$U>-WF_5|d=pg)g)>@SDIP>CF<-N&547JX{65ThLwXvx+?O*YF)e zi2F&~LvVP!@Cb2+kn!I~1ys`eSt_^`g%9N`kTGU>ToKv(Yw#i9EYo-kq+1ypGXy^c zmm!GvP(ScyWdxoJ&K$_&GX8WcBqr+~XoukP*bqSK_p?KAAp|l9;y9#m7y(1AfH)4P z|5IfITxJD?cve~nsei5&aD^3cLregq{y;0>YAYa)LkfoxFv1Fm<8b;zl@T!73b43N z8huFp%dCKLR>1u+0g(DvSOF8PfH)2*97ez-D5ouGz*H;1;90%Qd`SJ#R={*C zfcF{EDuC1lUy8v&BV$XOtt7b5|X`ga)tyr$EW zupJI599jTNOs|4=_+s#Tl@`Df)vG{o=D+R%*;ZX2lDY@kkf=zm?gLCfqGXajO1bnB zf18){j98-A;t8s%OmMbwmk3BMx0x6xO=|_uf=Bzn3fn`gu#?e8&OAmjTNvFo27!2NwgzaYX!WH0cr~f zs91k^J)&ExD*BVJ#T)Rd6}TCH8pD^L_WT>Iz_-C^OhvY%!RuDxRt#uO0l{WvdgwiH zT2p|(Z3TP)z7Cu(N9_b|wE{i?M{Ksh;5{o~2L`Auz&}t%z!%_%Ex#aQX1AS>7qjr9avi;9U`3XYrjJQXT!fS>dE;K8+My>d#kDt6y$Q zkz2nVgMU^h%8y7uLcbiBBK^_60Ph9fCNMZc3vka4%`gNojC^jB^`FmZ=yJV&Ggo22 zILi09b~t@2@qXqSaK^C!@1xAnjKYTAD8Nb8i4~2&*T9MY7{!pQ^-u?WR9E}>X~e=GQ6ixY}fXFFDK0S3%^E***$5D)>7uZ1pdLf2e9=1kx&-vjyK=nylylbp|J0maMC`VU_zgRaNG+t?9SH`9D70 B3O)b; diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/37/c0ca9ea2a71b00111e1997f66d7c19f4 b/.metadata/.plugins/org.eclipse.core.resources/.history/37/c0ca9ea2a71b00111e1997f66d7c19f4 new file mode 100644 index 0000000..a4056ed --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/37/c0ca9ea2a71b00111e1997f66d7c19f4 @@ -0,0 +1,202 @@ +/* *************************************************************************************** + * Project: task1 - C:GPIO + * File: task1.c + * + * Language: C + * + * Hardware: STefi Light v1.1 + * Processor: STM32G431KBT6U + * + * Author: Manuel Lederhofer + * Datum: 10.09.2021 + * + * Version: 2.1 + * History: + * 10.09.2021 ML create project + * 09.03.2022 ML port from STM32F042K6T6 to STM32G431KBT6U + * 18.02.2025 TK changed projectname to "C: GPIO) + * + * Status: under development + * + * Description: + * Blinks the red LED of STefi Light, currently. + * This file contains the main routine and the initialization. + * + * Notes: + * - MCU speed at startup is 16 MHz + * + * Todo: + * - Change the example code to match the description and requirements + * of the requested application in the lab exercise guide. + * + ************************************************************************************** */ + +/* ------------------------------------ INCLUDES -------------------------------------- */ +#include "stm32g431xx.h" +#include "STefi-Light.h" + + +/* ------------------------------------ DEFINES --------------------------------------- */ +#define LOOPS_PER_MS 1244 // NOP-loops for delay() +#define WAITTIME 500 +#define FIRST_LED 0 +#define LAST_LED 3 +#define UP 1 +#define DOWN -1 + + +/* ------------------------------------ TYPE DEFINITIONS ------------------------------ */ +/* ------------------------------------ GLOBAL VARIABLES ------------------------------ */ +int state = 0; +/* ------------------------------------ PRIVATE VARIABLES ----------------------------- */ + + +/* ------------------------------------ PROTOTYPES ------------------------------------ */ +static void GPIO_init(void); +static void delay(const uint16_t ms); +static void blink(const unint numLED); + + +/* ------------------------------------ M A I N --------------------------------------- */ +int main(void) +{ + /* --- initialization --- */ + __disable_irq(); // disable interrupts globally + + GPIO_init(); + + __enable_irq(); // enable interrupts globally + + + /* --- one time tasks --- */ + + + /* --- infinite processing loop --- */ + while (1) + { + /* ... add your code to implement the lab assignment ... */ + int direction; + int i = 0; + while(1){ + if(i == FIRST_LED){ + direction = UP; + } + else if(i == LAST_LED){ + direction = DOWN; + } + blink(i); + if(direction == UP){ + i++; + } + else if(direction == DOWN){ + i--; + } + } + + + + switch (state) { + case 0: + GPIOA->ODR &= ~(1 << 0); // LED0 on + GPIOA->ODR &= ~(1 << 1); + GPIOA->ODR &= ~(1 << 2); + GPIOA->ODR &= ~(1 << 3); + + state++; + break; + case 1: + delay(WAITTIME); // wait + state++; + break; + case 2: + GPIOA->ODR |= (1 << 0); // LED0 off + GPIOA->ODR |= (1 << 1); + GPIOA->ODR |= (1 << 2); + GPIOA->ODR |= (1 << 3); + delay(WAITTIME); // wait + state = 0; + break; + default: + break; + } + } + + return 1; +} + + +/* ------------------------------------ GLOBAL FUNCTIONS ------------------------------ */ + + +/* ------------------------------------ PRIVATE FUNCTIONS ----------------------------- */ + +/* ------------------------------------------------------------------------------------ *\ + * method: static void GPIO_init(void) + * + * Initializes GPIOs on STefi Light for pins with peripherals attached. + * + * requires: - nothing - + * parameters: - none - + * returns: - nothing - +\* ------------------------------------------------------------------------------------ */ +static void GPIO_init(void) +{ + /* enable port clocks */ + RCC->AHB2ENR |= RCC_AHB2ENR_GPIOAEN; // LEDs: A + + + /* --- LEDs --- */ + GPIOA->ODR |= MASK_LED_ALL; + GPIOA->MODER &= ~(3 << 0); + GPIOA->MODER &= ~(3 << 2); + GPIOA->MODER &= ~(3 << 4); + GPIOA->MODER &= ~(3 << 6); + GPIOA->MODER |= (1 << 0); // set LED pin to output + GPIOA->MODER |= (1 << 2); + GPIOA->MODER |= (1 << 4); + GPIOA->MODER |= (1 << 6); +} + + +/* ------------------------------------------------------------------------------------ *\ + * method: static void delay(const uint16_t ms) + * + * Realizes a millisecond delay by very bad busy-wait. + * + * requires: - nothing - + * parameters: ms - delay time in milliseconds + * returns: - nothing - +\* ------------------------------------------------------------------------------------ */ +static void delay(const uint16_t ms) +{ + for (uint16_t i = 0; i < ms; ++i) + { + for (uint16_t j = 0; j < LOOPS_PER_MS; ++j) + { + __asm("NOP"); + } + } +} + +static void blink(const uint numLED) +{ + switch (state) { + case 0: + GPIOA->ODR &= ~(1 << numLED); // LEDX on + state++; + break; + case 1: + delay(WAITTIME); // wait + state++; + break; + case 2: + GPIOA->ODR |= (1 << numLED); // LEDX off + delay(WAITTIME); // wait + state = 0; + break; + default: + break; +} + + +/* ************************************ E O F ***************************************** */ diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/6/506794a2a31b00111e1997f66d7c19f4 b/.metadata/.plugins/org.eclipse.core.resources/.history/6/506794a2a31b00111e1997f66d7c19f4 new file mode 100644 index 0000000..7e3d2e2 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/6/506794a2a31b00111e1997f66d7c19f4 @@ -0,0 +1,158 @@ +/* *************************************************************************************** + * Project: task1 - C:GPIO + * File: task1.c + * + * Language: C + * + * Hardware: STefi Light v1.1 + * Processor: STM32G431KBT6U + * + * Author: Manuel Lederhofer + * Datum: 10.09.2021 + * + * Version: 2.1 + * History: + * 10.09.2021 ML create project + * 09.03.2022 ML port from STM32F042K6T6 to STM32G431KBT6U + * 18.02.2025 TK changed projectname to "C: GPIO) + * + * Status: under development + * + * Description: + * Blinks the red LED of STefi Light, currently. + * This file contains the main routine and the initialization. + * + * Notes: + * - MCU speed at startup is 16 MHz + * + * Todo: + * - Change the example code to match the description and requirements + * of the requested application in the lab exercise guide. + * + ************************************************************************************** */ + +/* ------------------------------------ INCLUDES -------------------------------------- */ +#include "stm32g431xx.h" +#include "STefi-Light.h" + + +/* ------------------------------------ DEFINES --------------------------------------- */ +#define LOOPS_PER_MS 1244 // NOP-loops for delay() +#define WAITTIME 500 + + +/* ------------------------------------ TYPE DEFINITIONS ------------------------------ */ +/* ------------------------------------ GLOBAL VARIABLES ------------------------------ */ +int state = 0; +/* ------------------------------------ PRIVATE VARIABLES ----------------------------- */ + + +/* ------------------------------------ PROTOTYPES ------------------------------------ */ +static void GPIO_init(void); +static void delay(const uint16_t ms); + + +/* ------------------------------------ M A I N --------------------------------------- */ +int main(void) +{ + /* --- initialization --- */ + __disable_irq(); // disable interrupts globally + + GPIO_init(); + + __enable_irq(); // enable interrupts globally + + + /* --- one time tasks --- */ + + + /* --- infinite processing loop --- */ + while (1) + { + /* ... add your code to implement the lab assignment ... */ + + switch (state) { + case 0: + GPIOA->ODR &= ~(1 << 0); // LED0 on + GPIOA->ODR &= ~(1 << 1); + GPIOA->ODR &= ~(1 << 2); + GPIOA->ODR &= ~(1 << 3); + + state++; + break; + case 1: + delay(WAITTIME); // wait + state++; + break; + case 2: + GPIOA->ODR |= (1 << 0); // LED0 off + GPIOA->ODR |= (1 << 1); + GPIOA->ODR |= (1 << 2); + GPIOA->ODR |= (1 << 3); + delay(WAITTIME); // wait + state = 0; + break; + default: + break; + } + } + + return 1; +} + + +/* ------------------------------------ GLOBAL FUNCTIONS ------------------------------ */ + + +/* ------------------------------------ PRIVATE FUNCTIONS ----------------------------- */ + +/* ------------------------------------------------------------------------------------ *\ + * method: static void GPIO_init(void) + * + * Initializes GPIOs on STefi Light for pins with peripherals attached. + * + * requires: - nothing - + * parameters: - none - + * returns: - nothing - +\* ------------------------------------------------------------------------------------ */ +static void GPIO_init(void) +{ + /* enable port clocks */ + RCC->AHB2ENR |= RCC_AHB2ENR_GPIOAEN; // LEDs: A + + + /* --- LEDs --- */ + GPIOA->ODR |= MASK_LED_ALL; + GPIOA->MODER &= ~(3 << 0); + GPIOA->MODER &= ~(3 << 2); + GPIOA->MODER &= ~(3 << 4); + GPIOA->MODER &= ~(3 << 6); + GPIOA->MODER |= (1 << 0); // set LED pin to output + GPIOA->MODER |= (1 << 2); + GPIOA->MODER |= (1 << 4); + GPIOA->MODER |= (1 << 6); +} + + +/* ------------------------------------------------------------------------------------ *\ + * method: static void delay(const uint16_t ms) + * + * Realizes a millisecond delay by very bad busy-wait. + * + * requires: - nothing - + * parameters: ms - delay time in milliseconds + * returns: - nothing - +\* ------------------------------------------------------------------------------------ */ +static void delay(const uint16_t ms) +{ + for (uint16_t i = 0; i < ms; ++i) + { + for (uint16_t j = 0; j < LOOPS_PER_MS; ++j) + { + __asm("NOP"); + } + } +} + + +/* ************************************ E O F ***************************************** */ diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/78/10112b68a61b00111e1997f66d7c19f4 b/.metadata/.plugins/org.eclipse.core.resources/.history/78/10112b68a61b00111e1997f66d7c19f4 new file mode 100644 index 0000000..e4c0cde --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/78/10112b68a61b00111e1997f66d7c19f4 @@ -0,0 +1,198 @@ +/* *************************************************************************************** + * Project: task1 - C:GPIO + * File: task1.c + * + * Language: C + * + * Hardware: STefi Light v1.1 + * Processor: STM32G431KBT6U + * + * Author: Manuel Lederhofer + * Datum: 10.09.2021 + * + * Version: 2.1 + * History: + * 10.09.2021 ML create project + * 09.03.2022 ML port from STM32F042K6T6 to STM32G431KBT6U + * 18.02.2025 TK changed projectname to "C: GPIO) + * + * Status: under development + * + * Description: + * Blinks the red LED of STefi Light, currently. + * This file contains the main routine and the initialization. + * + * Notes: + * - MCU speed at startup is 16 MHz + * + * Todo: + * - Change the example code to match the description and requirements + * of the requested application in the lab exercise guide. + * + ************************************************************************************** */ + +/* ------------------------------------ INCLUDES -------------------------------------- */ +#include "stm32g431xx.h" +#include "STefi-Light.h" + + +/* ------------------------------------ DEFINES --------------------------------------- */ +#define LOOPS_PER_MS 1244 // NOP-loops for delay() +#define WAITTIME 500 + + +/* ------------------------------------ TYPE DEFINITIONS ------------------------------ */ +/* ------------------------------------ GLOBAL VARIABLES ------------------------------ */ +int state = 0; +/* ------------------------------------ PRIVATE VARIABLES ----------------------------- */ + + +/* ------------------------------------ PROTOTYPES ------------------------------------ */ +static void GPIO_init(void); +static void delay(const uint16_t ms); +static void blink(const unint numLED); + + +/* ------------------------------------ M A I N --------------------------------------- */ +int main(void) +{ + /* --- initialization --- */ + __disable_irq(); // disable interrupts globally + + GPIO_init(); + + __enable_irq(); // enable interrupts globally + + + /* --- one time tasks --- */ + + + /* --- infinite processing loop --- */ + while (1) + { + /* ... add your code to implement the lab assignment ... */ + int direction; + while(1){ + int i; + if(i == 0){ + direction = 1; + } + else if(i == 4){ + direction = -1; + } + blink(1); + if(direction > 0){ + i++; + } + else if(direction < 0){ + i--; + } + } + + + + switch (state) { + case 0: + GPIOA->ODR &= ~(1 << 0); // LED0 on + GPIOA->ODR &= ~(1 << 1); + GPIOA->ODR &= ~(1 << 2); + GPIOA->ODR &= ~(1 << 3); + + state++; + break; + case 1: + delay(WAITTIME); // wait + state++; + break; + case 2: + GPIOA->ODR |= (1 << 0); // LED0 off + GPIOA->ODR |= (1 << 1); + GPIOA->ODR |= (1 << 2); + GPIOA->ODR |= (1 << 3); + delay(WAITTIME); // wait + state = 0; + break; + default: + break; + } + } + + return 1; +} + + +/* ------------------------------------ GLOBAL FUNCTIONS ------------------------------ */ + + +/* ------------------------------------ PRIVATE FUNCTIONS ----------------------------- */ + +/* ------------------------------------------------------------------------------------ *\ + * method: static void GPIO_init(void) + * + * Initializes GPIOs on STefi Light for pins with peripherals attached. + * + * requires: - nothing - + * parameters: - none - + * returns: - nothing - +\* ------------------------------------------------------------------------------------ */ +static void GPIO_init(void) +{ + /* enable port clocks */ + RCC->AHB2ENR |= RCC_AHB2ENR_GPIOAEN; // LEDs: A + + + /* --- LEDs --- */ + GPIOA->ODR |= MASK_LED_ALL; + GPIOA->MODER &= ~(3 << 0); + GPIOA->MODER &= ~(3 << 2); + GPIOA->MODER &= ~(3 << 4); + GPIOA->MODER &= ~(3 << 6); + GPIOA->MODER |= (1 << 0); // set LED pin to output + GPIOA->MODER |= (1 << 2); + GPIOA->MODER |= (1 << 4); + GPIOA->MODER |= (1 << 6); +} + + +/* ------------------------------------------------------------------------------------ *\ + * method: static void delay(const uint16_t ms) + * + * Realizes a millisecond delay by very bad busy-wait. + * + * requires: - nothing - + * parameters: ms - delay time in milliseconds + * returns: - nothing - +\* ------------------------------------------------------------------------------------ */ +static void delay(const uint16_t ms) +{ + for (uint16_t i = 0; i < ms; ++i) + { + for (uint16_t j = 0; j < LOOPS_PER_MS; ++j) + { + __asm("NOP"); + } + } +} + +static void blink(const uint numLED) +{ + switch (state) { + case 0: + GPIOA->ODR &= ~(1 << numLED); // LED0 on + state++; + break; + case 1: + delay(WAITTIME); // wait + state++; + break; + case 2: + GPIOA->ODR |= (1 << numLED); // LED0 off + delay(WAITTIME); // wait + state = 0; + break; + default: + break; +} + + +/* ************************************ E O F ***************************************** */ diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/9a/00f5864da51b00111e1997f66d7c19f4 b/.metadata/.plugins/org.eclipse.core.resources/.history/9a/00f5864da51b00111e1997f66d7c19f4 new file mode 100644 index 0000000..ab469f2 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/9a/00f5864da51b00111e1997f66d7c19f4 @@ -0,0 +1,179 @@ +/* *************************************************************************************** + * Project: task1 - C:GPIO + * File: task1.c + * + * Language: C + * + * Hardware: STefi Light v1.1 + * Processor: STM32G431KBT6U + * + * Author: Manuel Lederhofer + * Datum: 10.09.2021 + * + * Version: 2.1 + * History: + * 10.09.2021 ML create project + * 09.03.2022 ML port from STM32F042K6T6 to STM32G431KBT6U + * 18.02.2025 TK changed projectname to "C: GPIO) + * + * Status: under development + * + * Description: + * Blinks the red LED of STefi Light, currently. + * This file contains the main routine and the initialization. + * + * Notes: + * - MCU speed at startup is 16 MHz + * + * Todo: + * - Change the example code to match the description and requirements + * of the requested application in the lab exercise guide. + * + ************************************************************************************** */ + +/* ------------------------------------ INCLUDES -------------------------------------- */ +#include "stm32g431xx.h" +#include "STefi-Light.h" + + +/* ------------------------------------ DEFINES --------------------------------------- */ +#define LOOPS_PER_MS 1244 // NOP-loops for delay() +#define WAITTIME 500 + + +/* ------------------------------------ TYPE DEFINITIONS ------------------------------ */ +/* ------------------------------------ GLOBAL VARIABLES ------------------------------ */ +int state = 0; +/* ------------------------------------ PRIVATE VARIABLES ----------------------------- */ + + +/* ------------------------------------ PROTOTYPES ------------------------------------ */ +static void GPIO_init(void); +static void delay(const uint16_t ms); +static void blink(const unint numLED); + + +/* ------------------------------------ M A I N --------------------------------------- */ +int main(void) +{ + /* --- initialization --- */ + __disable_irq(); // disable interrupts globally + + GPIO_init(); + + __enable_irq(); // enable interrupts globally + + + /* --- one time tasks --- */ + + + /* --- infinite processing loop --- */ + while (1) + { + /* ... add your code to implement the lab assignment ... */ + + switch (state) { + case 0: + GPIOA->ODR &= ~(1 << 0); // LED0 on + GPIOA->ODR &= ~(1 << 1); + GPIOA->ODR &= ~(1 << 2); + GPIOA->ODR &= ~(1 << 3); + + state++; + break; + case 1: + delay(WAITTIME); // wait + state++; + break; + case 2: + GPIOA->ODR |= (1 << 0); // LED0 off + GPIOA->ODR |= (1 << 1); + GPIOA->ODR |= (1 << 2); + GPIOA->ODR |= (1 << 3); + delay(WAITTIME); // wait + state = 0; + break; + default: + break; + } + } + + return 1; +} + + +/* ------------------------------------ GLOBAL FUNCTIONS ------------------------------ */ + + +/* ------------------------------------ PRIVATE FUNCTIONS ----------------------------- */ + +/* ------------------------------------------------------------------------------------ *\ + * method: static void GPIO_init(void) + * + * Initializes GPIOs on STefi Light for pins with peripherals attached. + * + * requires: - nothing - + * parameters: - none - + * returns: - nothing - +\* ------------------------------------------------------------------------------------ */ +static void GPIO_init(void) +{ + /* enable port clocks */ + RCC->AHB2ENR |= RCC_AHB2ENR_GPIOAEN; // LEDs: A + + + /* --- LEDs --- */ + GPIOA->ODR |= MASK_LED_ALL; + GPIOA->MODER &= ~(3 << 0); + GPIOA->MODER &= ~(3 << 2); + GPIOA->MODER &= ~(3 << 4); + GPIOA->MODER &= ~(3 << 6); + GPIOA->MODER |= (1 << 0); // set LED pin to output + GPIOA->MODER |= (1 << 2); + GPIOA->MODER |= (1 << 4); + GPIOA->MODER |= (1 << 6); +} + + +/* ------------------------------------------------------------------------------------ *\ + * method: static void delay(const uint16_t ms) + * + * Realizes a millisecond delay by very bad busy-wait. + * + * requires: - nothing - + * parameters: ms - delay time in milliseconds + * returns: - nothing - +\* ------------------------------------------------------------------------------------ */ +static void delay(const uint16_t ms) +{ + for (uint16_t i = 0; i < ms; ++i) + { + for (uint16_t j = 0; j < LOOPS_PER_MS; ++j) + { + __asm("NOP"); + } + } +} + +static void blink(const uint numLED) +{ + switch (state) { + case 0: + GPIOA->ODR &= ~(1 << numLED); // LED0 on + state++; + break; + case 1: + delay(WAITTIME); // wait + state++; + break; + case 2: + GPIOA->ODR |= (1 << numLED); // LED0 off + delay(WAITTIME); // wait + state = 0; + break; + default: + break; +} + + +/* ************************************ E O F ***************************************** */ diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ba/50da93c8a61b00111e1997f66d7c19f4 b/.metadata/.plugins/org.eclipse.core.resources/.history/ba/50da93c8a61b00111e1997f66d7c19f4 new file mode 100644 index 0000000..8987db6 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/ba/50da93c8a61b00111e1997f66d7c19f4 @@ -0,0 +1,202 @@ +/* *************************************************************************************** + * Project: task1 - C:GPIO + * File: task1.c + * + * Language: C + * + * Hardware: STefi Light v1.1 + * Processor: STM32G431KBT6U + * + * Author: Manuel Lederhofer + * Datum: 10.09.2021 + * + * Version: 2.1 + * History: + * 10.09.2021 ML create project + * 09.03.2022 ML port from STM32F042K6T6 to STM32G431KBT6U + * 18.02.2025 TK changed projectname to "C: GPIO) + * + * Status: under development + * + * Description: + * Blinks the red LED of STefi Light, currently. + * This file contains the main routine and the initialization. + * + * Notes: + * - MCU speed at startup is 16 MHz + * + * Todo: + * - Change the example code to match the description and requirements + * of the requested application in the lab exercise guide. + * + ************************************************************************************** */ + +/* ------------------------------------ INCLUDES -------------------------------------- */ +#include "stm32g431xx.h" +#include "STefi-Light.h" + + +/* ------------------------------------ DEFINES --------------------------------------- */ +#define LOOPS_PER_MS 1244 // NOP-loops for delay() +#define WAITTIME 500 +#define FIRST_LED 0 +#define LAST_LED 3 +#define UP 1 +#define DOWN -1 + + +/* ------------------------------------ TYPE DEFINITIONS ------------------------------ */ +/* ------------------------------------ GLOBAL VARIABLES ------------------------------ */ +int state = 0; +/* ------------------------------------ PRIVATE VARIABLES ----------------------------- */ + + +/* ------------------------------------ PROTOTYPES ------------------------------------ */ +static void GPIO_init(void); +static void delay(const uint16_t ms); +static void blink(const unint numLED); + + +/* ------------------------------------ M A I N --------------------------------------- */ +int main(void) +{ + /* --- initialization --- */ + __disable_irq(); // disable interrupts globally + + GPIO_init(); + + __enable_irq(); // enable interrupts globally + + + /* --- one time tasks --- */ + + + /* --- infinite processing loop --- */ + while (1) + { + /* ... add your code to implement the lab assignment ... */ + int direction; + int i = 0; + while(1){ + if(i == FIRST_LED){ + direction = UP; + } + else if(i == LAST_LED){ + direction = DOWN; + } + blink(i); + if(direction == UP){ + i++; + } + else if(direction == DOWN){ + i--; + } + } + + + + switch (state) { + case 0: + GPIOA->ODR &= ~(1 << 0); // LED0 on + GPIOA->ODR &= ~(1 << 1); + GPIOA->ODR &= ~(1 << 2); + GPIOA->ODR &= ~(1 << 3); + + state++; + break; + case 1: + delay(WAITTIME); // wait + state++; + break; + case 2: + GPIOA->ODR |= (1 << 0); // LED0 off + GPIOA->ODR |= (1 << 1); + GPIOA->ODR |= (1 << 2); + GPIOA->ODR |= (1 << 3); + delay(WAITTIME); // wait + state = 0; + break; + default: + break; + } + } + + return 1; +} + + +/* ------------------------------------ GLOBAL FUNCTIONS ------------------------------ */ + + +/* ------------------------------------ PRIVATE FUNCTIONS ----------------------------- */ + +/* ------------------------------------------------------------------------------------ *\ + * method: static void GPIO_init(void) + * + * Initializes GPIOs on STefi Light for pins with peripherals attached. + * + * requires: - nothing - + * parameters: - none - + * returns: - nothing - +\* ------------------------------------------------------------------------------------ */ +static void GPIO_init(void) +{ + /* enable port clocks */ + RCC->AHB2ENR |= RCC_AHB2ENR_GPIOAEN; // LEDs: A + + + /* --- LEDs --- */ + GPIOA->ODR |= MASK_LED_ALL; + GPIOA->MODER &= ~(3 << 0); + GPIOA->MODER &= ~(3 << 2); + GPIOA->MODER &= ~(3 << 4); + GPIOA->MODER &= ~(3 << 6); + GPIOA->MODER |= (1 << 0); // set LED pin to output + GPIOA->MODER |= (1 << 2); + GPIOA->MODER |= (1 << 4); + GPIOA->MODER |= (1 << 6); +} + + +/* ------------------------------------------------------------------------------------ *\ + * method: static void delay(const uint16_t ms) + * + * Realizes a millisecond delay by very bad busy-wait. + * + * requires: - nothing - + * parameters: ms - delay time in milliseconds + * returns: - nothing - +\* ------------------------------------------------------------------------------------ */ +static void delay(const uint16_t ms) +{ + for (uint16_t i = 0; i < ms; ++i) + { + for (uint16_t j = 0; j < LOOPS_PER_MS; ++j) + { + __asm("NOP"); + } + } +} + +static void blink(const uint numLED) +{ + switch (state) { + case 0: + GPIOA->ODR &= ~(1 << numLED); // LED0 on + state++; + break; + case 1: + delay(WAITTIME); // wait + state++; + break; + case 2: + GPIOA->ODR |= (1 << numLED); // LED0 off + delay(WAITTIME); // wait + state = 0; + break; + default: + break; +} + + +/* ************************************ E O F ***************************************** */ diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e5/302d8a9fa61b00111e1997f66d7c19f4 b/.metadata/.plugins/org.eclipse.core.resources/.history/e5/302d8a9fa61b00111e1997f66d7c19f4 new file mode 100644 index 0000000..acf8dc8 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/e5/302d8a9fa61b00111e1997f66d7c19f4 @@ -0,0 +1,200 @@ +/* *************************************************************************************** + * Project: task1 - C:GPIO + * File: task1.c + * + * Language: C + * + * Hardware: STefi Light v1.1 + * Processor: STM32G431KBT6U + * + * Author: Manuel Lederhofer + * Datum: 10.09.2021 + * + * Version: 2.1 + * History: + * 10.09.2021 ML create project + * 09.03.2022 ML port from STM32F042K6T6 to STM32G431KBT6U + * 18.02.2025 TK changed projectname to "C: GPIO) + * + * Status: under development + * + * Description: + * Blinks the red LED of STefi Light, currently. + * This file contains the main routine and the initialization. + * + * Notes: + * - MCU speed at startup is 16 MHz + * + * Todo: + * - Change the example code to match the description and requirements + * of the requested application in the lab exercise guide. + * + ************************************************************************************** */ + +/* ------------------------------------ INCLUDES -------------------------------------- */ +#include "stm32g431xx.h" +#include "STefi-Light.h" + + +/* ------------------------------------ DEFINES --------------------------------------- */ +#define LOOPS_PER_MS 1244 // NOP-loops for delay() +#define WAITTIME 500 +#define FIRST_LED 0 +#define LAST_LED 3 + + +/* ------------------------------------ TYPE DEFINITIONS ------------------------------ */ +/* ------------------------------------ GLOBAL VARIABLES ------------------------------ */ +int state = 0; +/* ------------------------------------ PRIVATE VARIABLES ----------------------------- */ + + +/* ------------------------------------ PROTOTYPES ------------------------------------ */ +static void GPIO_init(void); +static void delay(const uint16_t ms); +static void blink(const unint numLED); + + +/* ------------------------------------ M A I N --------------------------------------- */ +int main(void) +{ + /* --- initialization --- */ + __disable_irq(); // disable interrupts globally + + GPIO_init(); + + __enable_irq(); // enable interrupts globally + + + /* --- one time tasks --- */ + + + /* --- infinite processing loop --- */ + while (1) + { + /* ... add your code to implement the lab assignment ... */ + int direction; + int i = 0; + while(1){ + if(i == FIRST_LED){ + direction = 1; + } + else if(i == LAST_LED){ + direction = -1; + } + blink(i); + if(direction > 0){ + i++; + } + else if(direction < 0){ + i--; + } + } + + + + switch (state) { + case 0: + GPIOA->ODR &= ~(1 << 0); // LED0 on + GPIOA->ODR &= ~(1 << 1); + GPIOA->ODR &= ~(1 << 2); + GPIOA->ODR &= ~(1 << 3); + + state++; + break; + case 1: + delay(WAITTIME); // wait + state++; + break; + case 2: + GPIOA->ODR |= (1 << 0); // LED0 off + GPIOA->ODR |= (1 << 1); + GPIOA->ODR |= (1 << 2); + GPIOA->ODR |= (1 << 3); + delay(WAITTIME); // wait + state = 0; + break; + default: + break; + } + } + + return 1; +} + + +/* ------------------------------------ GLOBAL FUNCTIONS ------------------------------ */ + + +/* ------------------------------------ PRIVATE FUNCTIONS ----------------------------- */ + +/* ------------------------------------------------------------------------------------ *\ + * method: static void GPIO_init(void) + * + * Initializes GPIOs on STefi Light for pins with peripherals attached. + * + * requires: - nothing - + * parameters: - none - + * returns: - nothing - +\* ------------------------------------------------------------------------------------ */ +static void GPIO_init(void) +{ + /* enable port clocks */ + RCC->AHB2ENR |= RCC_AHB2ENR_GPIOAEN; // LEDs: A + + + /* --- LEDs --- */ + GPIOA->ODR |= MASK_LED_ALL; + GPIOA->MODER &= ~(3 << 0); + GPIOA->MODER &= ~(3 << 2); + GPIOA->MODER &= ~(3 << 4); + GPIOA->MODER &= ~(3 << 6); + GPIOA->MODER |= (1 << 0); // set LED pin to output + GPIOA->MODER |= (1 << 2); + GPIOA->MODER |= (1 << 4); + GPIOA->MODER |= (1 << 6); +} + + +/* ------------------------------------------------------------------------------------ *\ + * method: static void delay(const uint16_t ms) + * + * Realizes a millisecond delay by very bad busy-wait. + * + * requires: - nothing - + * parameters: ms - delay time in milliseconds + * returns: - nothing - +\* ------------------------------------------------------------------------------------ */ +static void delay(const uint16_t ms) +{ + for (uint16_t i = 0; i < ms; ++i) + { + for (uint16_t j = 0; j < LOOPS_PER_MS; ++j) + { + __asm("NOP"); + } + } +} + +static void blink(const uint numLED) +{ + switch (state) { + case 0: + GPIOA->ODR &= ~(1 << numLED); // LED0 on + state++; + break; + case 1: + delay(WAITTIME); // wait + state++; + break; + case 2: + GPIOA->ODR |= (1 << numLED); // LED0 off + delay(WAITTIME); // wait + state = 0; + break; + default: + break; +} + + +/* ************************************ E O F ***************************************** */ diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f7/007e02b9a81b00111e1997f66d7c19f4 b/.metadata/.plugins/org.eclipse.core.resources/.history/f7/007e02b9a81b00111e1997f66d7c19f4 new file mode 100644 index 0000000..d3cd1f5 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/f7/007e02b9a81b00111e1997f66d7c19f4 @@ -0,0 +1,205 @@ +/* *************************************************************************************** + * Project: task1 - C:GPIO + * File: task1.c + * + * Language: C + * + * Hardware: STefi Light v1.1 + * Processor: STM32G431KBT6U + * + * Author: Manuel Lederhofer + * Datum: 10.09.2021 + * + * Version: 2.1 + * History: + * 10.09.2021 ML create project + * 09.03.2022 ML port from STM32F042K6T6 to STM32G431KBT6U + * 18.02.2025 TK changed projectname to "C: GPIO) + * + * Status: under development + * + * Description: + * Blinks the red LED of STefi Light, currently. + * This file contains the main routine and the initialization. + * + * Notes: + * - MCU speed at startup is 16 MHz + * + * Todo: + * - Change the example code to match the description and requirements + * of the requested application in the lab exercise guide. + * + ************************************************************************************** */ + +/* ------------------------------------ INCLUDES -------------------------------------- */ +#include "stm32g431xx.h" +#include "STefi-Light.h" + + +/* ------------------------------------ DEFINES --------------------------------------- */ +#define LOOPS_PER_MS 1244 // NOP-loops for delay() +#define WAITTIME 500 +#define FIRST_LED 0 +#define LAST_LED 3 +#define UP 1 +#define DOWN -1 + + +/* ------------------------------------ TYPE DEFINITIONS ------------------------------ */ +/* ------------------------------------ GLOBAL VARIABLES ------------------------------ */ +int state = 0; +/* ------------------------------------ PRIVATE VARIABLES ----------------------------- */ + + +/* ------------------------------------ PROTOTYPES ------------------------------------ */ +static void GPIO_init(void); +static void delay(const uint16_t ms); +static void blink(const unint numLED); + + +/* ------------------------------------ M A I N --------------------------------------- */ +int main(void) +{ + /* --- initialization --- */ + __disable_irq(); // disable interrupts globally + + GPIO_init(); + + __enable_irq(); // enable interrupts globally + + + /* --- one time tasks --- */ + + + /* --- infinite processing loop --- */ + + while (1) + { + /* ... add your code to implement the lab assignment ... */ + int direction; + + while(1){ + if(i == FIRST_LED){ + direction = UP; + } + else if(i == LAST_LED){ + direction = DOWN; + } + + blink(i); //One full LED blink cylce + + if(direction == UP){ + i++; + } + else if(direction == DOWN){ + i--; + } + } + + + + switch (state) { + case 0: + GPIOA->ODR &= ~(1 << 0); // LED0 on + GPIOA->ODR &= ~(1 << 1); + GPIOA->ODR &= ~(1 << 2); + GPIOA->ODR &= ~(1 << 3); + + state++; + break; + case 1: + delay(WAITTIME); // wait + state++; + break; + case 2: + GPIOA->ODR |= (1 << 0); // LED0 off + GPIOA->ODR |= (1 << 1); + GPIOA->ODR |= (1 << 2); + GPIOA->ODR |= (1 << 3); + delay(WAITTIME); // wait + state = 0; + break; + default: + break; + } + } + + return 1; +} + + +/* ------------------------------------ GLOBAL FUNCTIONS ------------------------------ */ + + +/* ------------------------------------ PRIVATE FUNCTIONS ----------------------------- */ + +/* ------------------------------------------------------------------------------------ *\ + * method: static void GPIO_init(void) + * + * Initializes GPIOs on STefi Light for pins with peripherals attached. + * + * requires: - nothing - + * parameters: - none - + * returns: - nothing - +\* ------------------------------------------------------------------------------------ */ +static void GPIO_init(void) +{ + /* enable port clocks */ + RCC->AHB2ENR |= RCC_AHB2ENR_GPIOAEN; // LEDs: A + int i = FIRST_LED; + + /* --- LEDs --- */ + GPIOA->ODR |= MASK_LED_ALL; + GPIOA->MODER &= ~(3 << 0); + GPIOA->MODER &= ~(3 << 2); + GPIOA->MODER &= ~(3 << 4); + GPIOA->MODER &= ~(3 << 6); + GPIOA->MODER |= (1 << 0); // set LED pin to output + GPIOA->MODER |= (1 << 2); + GPIOA->MODER |= (1 << 4); + GPIOA->MODER |= (1 << 6); +} + + +/* ------------------------------------------------------------------------------------ *\ + * method: static void delay(const uint16_t ms) + * + * Realizes a millisecond delay by very bad busy-wait. + * + * requires: - nothing - + * parameters: ms - delay time in milliseconds + * returns: - nothing - +\* ------------------------------------------------------------------------------------ */ +static void delay(const uint16_t ms) +{ + for (uint16_t i = 0; i < ms; ++i) + { + for (uint16_t j = 0; j < LOOPS_PER_MS; ++j) + { + __asm("NOP"); + } + } +} + +static void blink(const uint numLED) +{ + switch (state) { + case 0: + GPIOA->ODR &= ~(1 << numLED); // LEDX on + state++; + break; + case 1: + delay(WAITTIME); // wait + state++; + break; + case 2: + GPIOA->ODR |= (1 << numLED); // LEDX off + delay(WAITTIME); // wait + state = 0; + break; + default: + break; +} + + +/* ************************************ E O F ***************************************** */ diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/task1/.markers.snap b/.metadata/.plugins/org.eclipse.core.resources/.projects/task1/.markers.snap index 6594120816cb1b8f9c3f52eafdd272f237b4e449..9bd290e5f994b9832054d1aa6c27d4cf2075838a 100644 GIT binary patch delta 114 zcmcb~xR+zX%?ZYgtrJZq32SLp9EkY+S$PkGh*aR`p6cD@$AD68ASqLcax7AvASt^u PQ?W>Ofuvj#`_QETPIEJv delta 6 NcmdnXag%YvO#lh}0|@{C diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/task1/.syncinfo.snap b/.metadata/.plugins/org.eclipse.core.resources/.projects/task1/.syncinfo.snap index 91d6c541512db06197e1b732473d567ce4b92d6a..414a6b37c4de976cc65a3e6047ebd48c8e896c47 100644 GIT binary patch literal 80 bcmZ?R*xjhShe1S2b=vdAllRFvP{;=WNU|Zf literal 16 YcmZ?R*xjhShe1S2b=vdAllRF105-b@zW@LL diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/task2/.markers.snap b/.metadata/.plugins/org.eclipse.core.resources/.projects/task2/.markers.snap index 91d6c541512db06197e1b732473d567ce4b92d6a..414a6b37c4de976cc65a3e6047ebd48c8e896c47 100644 GIT binary patch literal 80 bcmZ?R*xjhShe1S2b=vdAllRFvP{;=WNU|Zf literal 16 YcmZ?R*xjhShe1S2b=vdAllRF105-b@zW@LL diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/task2/.syncinfo.snap b/.metadata/.plugins/org.eclipse.core.resources/.projects/task2/.syncinfo.snap index 91d6c541512db06197e1b732473d567ce4b92d6a..414a6b37c4de976cc65a3e6047ebd48c8e896c47 100644 GIT binary patch literal 80 bcmZ?R*xjhShe1S2b=vdAllRFvP{;=WNU|Zf literal 16 YcmZ?R*xjhShe1S2b=vdAllRF105-b@zW@LL diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/task3/.markers.snap b/.metadata/.plugins/org.eclipse.core.resources/.projects/task3/.markers.snap index 91d6c541512db06197e1b732473d567ce4b92d6a..414a6b37c4de976cc65a3e6047ebd48c8e896c47 100644 GIT binary patch literal 80 bcmZ?R*xjhShe1S2b=vdAllRFvP{;=WNU|Zf literal 16 YcmZ?R*xjhShe1S2b=vdAllRF105-b@zW@LL diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/task3/.syncinfo.snap b/.metadata/.plugins/org.eclipse.core.resources/.projects/task3/.syncinfo.snap index 91d6c541512db06197e1b732473d567ce4b92d6a..414a6b37c4de976cc65a3e6047ebd48c8e896c47 100644 GIT binary patch literal 80 bcmZ?R*xjhShe1S2b=vdAllRFvP{;=WNU|Zf literal 16 YcmZ?R*xjhShe1S2b=vdAllRF105-b@zW@LL diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/task4/.markers.snap b/.metadata/.plugins/org.eclipse.core.resources/.projects/task4/.markers.snap index 91d6c541512db06197e1b732473d567ce4b92d6a..414a6b37c4de976cc65a3e6047ebd48c8e896c47 100644 GIT binary patch literal 80 bcmZ?R*xjhShe1S2b=vdAllRFvP{;=WNU|Zf literal 16 YcmZ?R*xjhShe1S2b=vdAllRF105-b@zW@LL diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/task4/.syncinfo.snap b/.metadata/.plugins/org.eclipse.core.resources/.projects/task4/.syncinfo.snap index 91d6c541512db06197e1b732473d567ce4b92d6a..414a6b37c4de976cc65a3e6047ebd48c8e896c47 100644 GIT binary patch literal 80 bcmZ?R*xjhShe1S2b=vdAllRFvP{;=WNU|Zf literal 16 YcmZ?R*xjhShe1S2b=vdAllRF105-b@zW@LL diff --git a/.metadata/.plugins/org.eclipse.core.resources/.root/.markers.snap b/.metadata/.plugins/org.eclipse.core.resources/.root/.markers.snap index 91d6c541512db06197e1b732473d567ce4b92d6a..414a6b37c4de976cc65a3e6047ebd48c8e896c47 100644 GIT binary patch literal 80 bcmZ?R*xjhShe1S2b=vdAllRFvP{;=WNU|Zf literal 16 YcmZ?R*xjhShe1S2b=vdAllRF105-b@zW@LL diff --git a/.metadata/.plugins/org.eclipse.core.resources/63.snap b/.metadata/.plugins/org.eclipse.core.resources/63.snap index 0be2b7bf426869903c5f5ecf14b5a97c43890c41..afe7740c400d9816eb65a0d5a9afde4d0a4b534d 100644 GIT binary patch literal 650 zcmZ?R*xjhShe1S2b=vdAllRH7Ff%bRfPsn(gocrftsoX75HT_`u$CkiXB#pzGB5`h zB?BpTFkdejD8(WOG=Oo=C8fkCP_5!XS^~mmoX&6{;`e8;je(zgs&|(kb0FRYZ6HI4 zcY&6c8^l%ykP9RsY$gs$T+j|Ogm@R2N(4e|1-n2B!e)L%i3_?&bAjENQY071Lf9 - + activeSchemeId:org.eclipse.ui.defaultAcceleratorConfiguration - + @@ -11,9 +11,9 @@ topLevel shellMaximized - - - + + + persp.actionSet:com.st.stm32cube.ide.mcu.informationcenter.actionSet3 persp.actionSet:org.eclipse.ui.cheatsheets.actionSet @@ -67,70 +67,70 @@ persp.viewSC:com.st.stm32cube.ide.mcu.buildanalyzer.view persp.viewSC:com.st.stm32cube.ide.mcu.stackanalyzer.stackanalyzer.view persp.viewSC:com.st.stm32cube.ide.mcu.sfrview - - - + + + View categoryTag:General - + View categoryTag:C/C++ - + View categoryTag:General - - - - - - + + + + + + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + General - + View categoryTag:C/C++ - + View categoryTag:C/C++ - + View categoryTag:General - - + + View categoryTag:General - + View categoryTag:General - + View categoryTag:Make @@ -138,7 +138,7 @@ - + persp.actionSet:com.st.stm32cube.ide.mcu.informationcenter.actionSet3 persp.actionSet:org.eclipse.ui.cheatsheets.actionSet @@ -192,121 +192,121 @@ persp.editorOnboardingCommand:Step Over$$$F6 persp.editorOnboardingCommand:Step Return$$$F7 persp.editorOnboardingCommand:Resume$$$F8 - - - + + + org.eclipse.e4.primaryNavigationStack - + View categoryTag:Debug - + View categoryTag:General - - + + View categoryTag:Debug - - - - + + + + org.eclipse.e4.secondaryNavigationStack - + View categoryTag:Debug - + View categoryTag:Debug - + View categoryTag:Debug - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:Debug - + View categoryTag:Debug - + View categoryTag:Debug - + View categoryTag:Debug - + View categoryTag:Debug - + View categoryTag:Debug - + Debug noFocus - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:Debug - + View categoryTag:Debug - + View categoryTag:Debug - + View categoryTag:Debug - + View categoryTag:Debug @@ -315,76 +315,76 @@ - - + + View categoryTag:Help - + View categoryTag:General - + View categoryTag:Help - + View categoryTag:Help - + View categoryTag:General - + ViewMenu menuContribution:menu - + - + View categoryTag:Help - - + + org.eclipse.e4.primaryDataStack EditorStack active - + Editor removeOnHide org.eclipse.cdt.ui.editor.asm.AsmEditor - + Editor removeOnHide org.eclipse.cdt.ui.editor.CEditor - + Editor removeOnHide org.eclipse.cdt.ui.editor.CEditor - + Editor removeOnHide org.eclipse.cdt.ui.editor.CEditor - - + + Editor removeOnHide org.eclipse.cdt.ui.editor.CEditor @@ -392,2102 +392,2102 @@ - + View categoryTag:General - + ViewMenu menuContribution:menu - + - + View categoryTag:C/C++ - + View categoryTag:General - + View categoryTag:General - + ViewMenu menuContribution:menu - + - + View categoryTag:General - + ViewMenu menuContribution:menu - + - + View categoryTag:General - + ViewMenu menuContribution:menu - + - + View categoryTag:General - + ViewMenu menuContribution:menu - + - + View categoryTag:General - + ViewMenu menuContribution:menu - + - + View categoryTag:General - + View categoryTag:Make - + ViewMenu menuContribution:menu - + - + View categoryTag:C/C++ - + ViewMenu menuContribution:menu - + - + View categoryTag:C/C++ - + ViewMenu menuContribution:menu - + - + View categoryTag:Debug - + ViewMenu menuContribution:menu - + - + View categoryTag:Debug - + ViewMenu menuContribution:menu - + - + View categoryTag:General - + View categoryTag:Debug - + ViewMenu menuContribution:menu - + - + View categoryTag:Debug - + ViewMenu menuContribution:menu - + - + View categoryTag:Debug - + ViewMenu menuContribution:menu - + - + View categoryTag:General - + View categoryTag:Debug - + View categoryTag:Debug - + ViewMenu menuContribution:menu - + - + View categoryTag:Debug - + ViewMenu menuContribution:menu - + - + View categoryTag:Debug - + View categoryTag:Debug - + View categoryTag:Debug - + View categoryTag:Debug - + ViewMenu menuContribution:menu - + - + View categoryTag:Debug - + View categoryTag:Debug - + ViewMenu menuContribution:menu - + - + View categoryTag:Debug activeOnClose - + ViewMenu menuContribution:menu - + - + View categoryTag:Debug - + ViewMenu menuContribution:menu - + - + View categoryTag:General - + ViewMenu menuContribution:menu - + - - + + toolbarSeparator - + - + Draggable - + - + toolbarSeparator - + - + Draggable - - + + - + toolbarSeparator - + - + Draggable - + Draggable - + Draggable - + Draggable - + toolbarSeparator - + - + Draggable - + - + Draggable - + toolbarSeparator - + - + toolbarSeparator - + - + Draggable - + stretch SHOW_RESTORE_MENU - + Draggable HIDEABLE SHOW_RESTORE_MENU - - + + stretch - + Draggable - + Draggable - - + + TrimStack Draggable - + TrimStack Draggable - + TrimStack Draggable - - + + TrimStack Draggable - + TrimStack Draggable - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + platform:gtk - + platform:gtk - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + - - - - - - - + + + + + + + - - + + - - - - + + + + - - - - + + + + - - - - - + + + + + - - + + - - + + - - - - - - - - - - - + + + + + + + + + + + - - + + - - - - - - + + + + + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + type:user - + type:user - - + + - - - - - - - - - - + + + + + + + + + + - - - - - - - + + + + + + + - - - + + + - - - - + + + + - - - - - - + + + + + + - - - - - - - + + + + + + + - - - - + + + + - - - + + + - - + + - - - - - - + + + + + + - - - - + + + + - - + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - - - - + + + + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Editor removeOnHide - + View categoryTag:Device Configuration Tool - + View categoryTag:C/C++ - + View categoryTag:SWV - + View categoryTag:SWV - + View categoryTag:SWV - + View categoryTag:SWV - + View categoryTag:SWV - + View categoryTag:SWV - + View categoryTag:Debug - + View categoryTag:FreeRTOS - + View categoryTag:FreeRTOS - + View categoryTag:FreeRTOS - + View categoryTag:FreeRTOS - + View categoryTag:Debug - + View categoryTag:Debug - + View categoryTag:C/C++ - + View categoryTag:ThreadX - + View categoryTag:ThreadX - + View categoryTag:ThreadX - + View categoryTag:ThreadX - + View categoryTag:ThreadX - + View categoryTag:ThreadX - + View categoryTag:ThreadX - + View categoryTag:ThreadX - + View categoryTag:C/C++ - + View categoryTag:Debug - + View categoryTag:Debug - + View categoryTag:Debug - + View categoryTag:Debug - + View categoryTag:Debug - + View categoryTag:Debug - + View categoryTag:Debug - + View categoryTag:Debug - + View categoryTag:Make - + View categoryTag:C/C++ - + View categoryTag:C/C++ - + View categoryTag:C/C++ - + View categoryTag:C/C++ - + View categoryTag:C/C++ - + View categoryTag:General - + View categoryTag:Debug - + View categoryTag:Debug - + View categoryTag:Debug - + View categoryTag:Debug - + View categoryTag:Debug - + View categoryTag:Debug - + View categoryTag:Debug - + View categoryTag:Help - + View categoryTag:Connections - + View categoryTag:General - + View categoryTag:Version Control (Team) - + View categoryTag:Version Control (Team) - + View categoryTag:General - + View categoryTag:General - + View categoryTag:Help - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:C/C++ - + View categoryTag:Debug - + View categoryTag:Other - - + + glue move_after:PerspectiveSpacer SHOW_RESTORE_MENU - + move_after:Spacer Glue HIDEABLE SHOW_RESTORE_MENU - + glue move_after:SearchField SHOW_RESTORE_MENU - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - + + + - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - + + + + - - - - - - - + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + - - - - + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - + + + - - + + - - - - - + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/task1/Src/task1.c b/task1/Src/task1.c index 7e3d2e2..0e54182 100644 --- a/task1/Src/task1.c +++ b/task1/Src/task1.c @@ -39,6 +39,10 @@ /* ------------------------------------ DEFINES --------------------------------------- */ #define LOOPS_PER_MS 1244 // NOP-loops for delay() #define WAITTIME 500 +#define FIRST_LED 0 +#define LAST_LED 3 +#define UP 1 +#define DOWN -1 /* ------------------------------------ TYPE DEFINITIONS ------------------------------ */ @@ -50,6 +54,7 @@ int state = 0; /* ------------------------------------ PROTOTYPES ------------------------------------ */ static void GPIO_init(void); static void delay(const uint16_t ms); +static void blink(const unint numLED); /* ------------------------------------ M A I N --------------------------------------- */ @@ -67,9 +72,31 @@ int main(void) /* --- infinite processing loop --- */ + while (1) { /* ... add your code to implement the lab assignment ... */ + int direction; + + while(1){ + if(i == FIRST_LED){ + direction = UP; + } + else if(i == LAST_LED){ + direction = DOWN; + } + + blink(i); //One full LED blink cylce + + if(direction == UP){ + i++; + } + else if(direction == DOWN){ + i--; + } + } + + switch (state) { case 0: @@ -119,7 +146,7 @@ static void GPIO_init(void) { /* enable port clocks */ RCC->AHB2ENR |= RCC_AHB2ENR_GPIOAEN; // LEDs: A - + int i = FIRST_LED; /* --- LEDs --- */ GPIOA->ODR |= MASK_LED_ALL; @@ -154,5 +181,25 @@ static void delay(const uint16_t ms) } } +static void blink(const uint numLED) +{ + switch (state) { + case 0: + GPIOA->ODR &= ~(1 << numLED); // LEDX on + state++; + break; + case 1: + delay(WAITTIME); // wait + state++; + break; + case 2: + GPIOA->ODR |= (1 << numLED); // LEDX off + delay(WAITTIME); // wait + state = default; + break; + default: + break; +} + /* ************************************ E O F ***************************************** */