59 lines
1.5 KiB
C
59 lines
1.5 KiB
C
/*
|
|
* Copyright (c) 2006-2024, RT-Thread Development Team
|
|
* Copyright (c) 2019-2020, Arm Limited. All rights reserved.
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*
|
|
* Change Logs:
|
|
* Date Author Notes
|
|
* 2019-10-24 Magicoe first version
|
|
* 2020-01-10 Kevin/Karl Add PS demo
|
|
* 2020-09-21 supperthomas fix the main.c
|
|
*
|
|
*/
|
|
|
|
#include <rtdevice.h>
|
|
#include <rtthread.h>
|
|
#include "drv_pin.h"
|
|
|
|
#define LED_PIN ((4*32)+31)
|
|
#define BUTTON_PIN ((2*32)+3)
|
|
|
|
static void sw2_pin_cb(void *args);
|
|
|
|
int main(void)
|
|
{
|
|
#if defined(__CC_ARM)
|
|
rt_kprintf("using armcc, version: %d\n", __ARMCC_VERSION);
|
|
#elif defined(__clang__)
|
|
rt_kprintf("using armclang, version: %d\n", __ARMCC_VERSION);
|
|
#elif defined(__ICCARM__)
|
|
rt_kprintf("using iccarm, version: %d\n", __VER__);
|
|
#elif defined(__GNUC__)
|
|
rt_kprintf("using gcc, version: %d.%d\n", __GNUC__, __GNUC_MINOR__);
|
|
#endif
|
|
|
|
rt_pin_mode(LED_PIN, PIN_MODE_OUTPUT); /* Set GPIO as Output */
|
|
|
|
rt_pin_mode(BUTTON_PIN, PIN_MODE_INPUT_PULLUP);
|
|
rt_pin_attach_irq(BUTTON_PIN, PIN_IRQ_MODE_FALLING, sw2_pin_cb, RT_NULL);
|
|
rt_pin_irq_enable(BUTTON_PIN, 1);
|
|
|
|
rt_kprintf("NXP MCXC444\r\n");
|
|
|
|
while (1)
|
|
{
|
|
rt_pin_write(LED_PIN, PIN_HIGH); /* Set GPIO output 1 */
|
|
rt_thread_mdelay(500); /* Delay 500mS */
|
|
rt_pin_write(LED_PIN, PIN_LOW); /* Set GPIO output 0 */
|
|
rt_thread_mdelay(500); /* Delay 500mS */
|
|
}
|
|
}
|
|
|
|
static void sw2_pin_cb(void *args)
|
|
{
|
|
rt_kprintf("sw2 pressed\r\n");
|
|
}
|
|
|
|
// end file
|