/* * Copyright (C) 2014 Infineon Technologies AG. All rights reserved. * * Infineon Technologies AG (Infineon) is supplying this software for use with * Infineon's microcontrollers. * This file can be freely distributed within development tools that are * supporting such microcontrollers. * * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. * INFINEON SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. * */ /** * @file * @date 04 Dec, 2014 * @version 1.0.0 * * @brief XMC4500 Relax kit GPIO toggle example * * GPIO toggle example flashes the leds of the board with a periodic rate. * LED1 is connected to P1.1 * LED2 is connected to P1.0 * * History
* * Version 1.0.0 Initial
* */ #include #define TICKS_PER_SECOND 1000 #define TICKS_WAIT 500 #define LED1 P1_1 #define LED2 P1_0 void SysTick_Handler(void) { static uint32_t ticks = 0; ticks++; if (ticks == TICKS_WAIT) { XMC_GPIO_ToggleOutput(LED1); XMC_GPIO_ToggleOutput(LED2); ticks = 0; } } int main(void) { XMC_GPIO_CONFIG_t config; config.mode = XMC_GPIO_MODE_OUTPUT_PUSH_PULL; config.output_level = XMC_GPIO_OUTPUT_LEVEL_HIGH; config.output_strength = XMC_GPIO_OUTPUT_STRENGTH_MEDIUM; XMC_GPIO_Init(LED1, &config); config.output_level = XMC_GPIO_OUTPUT_LEVEL_LOW; XMC_GPIO_Init(LED2, &config); /* System timer configuration */ SysTick_Config(SystemCoreClock / TICKS_PER_SECOND); while(1) { /* Infinite loop */ } }