ChipTest/PAN159/PAN159-Template/SampleCode/Template/bsp.c

51 lines
1.4 KiB
C
Raw Normal View History

2021-09-26 09:18:47 +00:00
/*******************************************************************************
* @note Copyright (C) 2021 Terry.Xu
* All rights reserved.
*
* @file bsp.h
* @brief bsp for demo board
*
* @history - V1.0, 2021.9.26
*******************************************************************************/
#include "bsp.h"
#define bsp_led_io P26
#define C_LED_ON 1
#define C_LED_OFF 0
/*******************************************************************************
* @brief LED<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>
* @param[in] <EFBFBD><EFBFBD>
* @param[out] <EFBFBD><EFBFBD>
* @return <EFBFBD><EFBFBD>
******************************************************************************/
void bsp_led_init(void)
{
SYS->P2_MFP |= SYS_MFP_P26_GPIO; // P26->led
GPIO_SetMode(P2, BIT6, GPIO_MODE_OUTPUT); //led output
bsp_led_io = C_LED_OFF;
}
/*******************************************************************************
* @brief LED<EFBFBD><EFBFBD><EFBFBD>øߵ<EFBFBD>
* @param[in] <EFBFBD><EFBFBD>
* @param[out] <EFBFBD><EFBFBD>
* @return <EFBFBD><EFBFBD>
******************************************************************************/
void bsp_led_set(uint8_t dat)
{
dat=dat>0?C_LED_ON:C_LED_OFF;
bsp_led_io = dat;
}
/*******************************************************************************
* @brief LED<EFBFBD><EFBFBD>˸
* @param[in] <EFBFBD><EFBFBD>
* @param[out] <EFBFBD><EFBFBD>
* @return <EFBFBD><EFBFBD>
******************************************************************************/
void bsp_led_blink(void)
{
bsp_led_io = !bsp_led_io;
}