Commit 18c3c815 authored by Мирошниченко Лев Игоревич's avatar Мирошниченко Лев Игоревич
Browse files

Add partially task 1

parent 67924088
No related merge requests found
Showing with 74 additions and 0 deletions
+74 -0
.gitignore 0 → 100644
**/bin
# name of your application
APPLICATION = blinky
# If no BOARD is found in the environment, use this default:
BOARD ?= nucleo-f401re
# This has to be the absolute path to the RIOT base directory:
RIOTBASE ?= $(CURDIR)/../../deps/RIOT
# Comment this out to disable code in RIOT that does safety checking
# which is not needed in a production environment but helps in the
# development process:
DEVELHELP ?= 1
# Change this to 0 show compiler invocation lines by default:
QUIET ?= 1
# Use a peripheral timer for the delay, if available
FEATURES_REQUIRED += periph_timer
FEATURES_REQUIRED += periph_gpio_irq
USEMODULE += ztimer
USEMODULE += ztimer_usec
USEMODULE += periph_gpio
include $(RIOTBASE)/Makefile.include
#include <stdio.h>
#include "board.h"
#include "periph/gpio.h"
#include "ztimer.h"
void timer_cb (void *arg) {
(void)arg;
gpio_toggle(LED0_PIN);
gpio_irq_enable(BTN0_PIN);
}
void button_irq_handler(void *arg) {
(void)arg;
static ztimer_t timer_handler = {
.callback = timer_cb,
.arg = NULL
};
gpio_irq_disable(BTN0_PIN);
ztimer_set(ZTIMER_USEC, &timer_handler, 300 * US_PER_MS);
}
int main(void) {
gpio_init(LED0_PIN, GPIO_OUT);
gpio_init(BTN0_PIN, GPIO_IN_PU);
gpio_init_int(BTN0_PIN, GPIO_IN_PU, GPIO_BOTH, button_irq_handler, NULL);
for (;;) {
ztimer_sleep(ZTIMER_USEC, US_PER_SEC);
}
}
#include <stdio.h>
#include "board.h"
#include "periph/gpio.h"
#include "ztimer.h"
int main(void) {
gpio_t led = LED0_PIN;// GPIO_PIN(0, 2);
gpio_init(led, GPIO_OUT);
while (1) {
gpio_toggle(led);
LED0_TOGGLE;
puts("Blink! (No LED present or configured...)");
ztimer_sleep(ZTIMER_USEC, 1 * US_PER_SEC);
}
return 0;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment