1234567891011121314151617181920212223242526272829303132333435363738 |
- #include "at32f403a_407.h"
- #include "common_gpio.h"
- #include "FreeRTOS.h"
- #include "task.h"
- #include <stdbool.h>
- //
- void cm_gpio_init(void)
- {
- gpio_init_type gpio_initstructure;
-
- crm_periph_clock_enable(CRM_GPIOC_PERIPH_CLOCK, TRUE);
-
- // WDT
- gpio_initstructure.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
- gpio_initstructure.gpio_pull = GPIO_PULL_NONE;
- gpio_initstructure.gpio_mode = GPIO_MODE_OUTPUT;
- gpio_initstructure.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
- gpio_initstructure.gpio_pins = GPIO_PINS_7;
- gpio_init(GPIOC, &gpio_initstructure);
- }
- //
- void extern_wdt_togle(void)
- {
- static bool toogle = false;
-
- if (!toogle) {
- toogle = true;
- gpio_bits_set(GPIOC, GPIO_PINS_7);
- }
- else {
- toogle = false;
- gpio_bits_reset(GPIOC, GPIO_PINS_7);
- }
- }
|