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"
|
2021-10-07 01:32:05 +00:00
|
|
|
|
#define bsp_led_io2 P31
|
|
|
|
|
#define bsp_led_io1 P26
|
2021-09-26 09:18:47 +00:00
|
|
|
|
#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
|
2021-10-07 01:32:05 +00:00
|
|
|
|
SYS->P3_MFP |= SYS_MFP_P31_GPIO; // P31->led
|
2021-09-26 09:18:47 +00:00
|
|
|
|
GPIO_SetMode(P2, BIT6, GPIO_MODE_OUTPUT); //led output
|
2021-10-07 01:32:05 +00:00
|
|
|
|
GPIO_SetMode(P3, BIT1, GPIO_MODE_OUTPUT); //led output
|
|
|
|
|
bsp_led_io1 = C_LED_OFF;
|
|
|
|
|
bsp_led_io2 = C_LED_OFF;
|
2021-09-26 09:18:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
|
* @brief LED<EFBFBD><EFBFBD><EFBFBD>øߵ<EFBFBD>
|
2021-10-07 01:32:05 +00:00
|
|
|
|
* @param[in] dat:<EFBFBD><EFBFBD><EFBFBD><EFBFBD>λled1,<EFBFBD><EFBFBD>led0
|
2021-09-26 09:18:47 +00:00
|
|
|
|
* @param[out] <EFBFBD><EFBFBD>
|
|
|
|
|
* @return <EFBFBD><EFBFBD>
|
|
|
|
|
******************************************************************************/
|
|
|
|
|
void bsp_led_set(uint8_t dat)
|
|
|
|
|
{
|
2021-10-07 01:32:05 +00:00
|
|
|
|
uint8_t temp;
|
|
|
|
|
temp=dat&0x01;
|
|
|
|
|
temp=temp>0?C_LED_ON:C_LED_OFF;
|
|
|
|
|
bsp_led_io1 = temp;
|
|
|
|
|
temp=(dat>>4)&0x01;
|
|
|
|
|
temp=temp>0?C_LED_ON:C_LED_OFF;
|
|
|
|
|
bsp_led_io2 = temp;
|
2021-09-26 09:18:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
|
* @brief LED<EFBFBD><EFBFBD>˸
|
2021-10-07 01:32:05 +00:00
|
|
|
|
* @param[in] dat:<EFBFBD><EFBFBD><EFBFBD><EFBFBD>λled1,<EFBFBD><EFBFBD>led0
|
2021-09-26 09:18:47 +00:00
|
|
|
|
* @param[out] <EFBFBD><EFBFBD>
|
|
|
|
|
* @return <EFBFBD><EFBFBD>
|
|
|
|
|
******************************************************************************/
|
2021-10-07 01:32:05 +00:00
|
|
|
|
void bsp_led_blink(uint8_t dat)
|
2021-09-26 09:18:47 +00:00
|
|
|
|
{
|
2021-10-07 01:32:05 +00:00
|
|
|
|
if(dat&0x01) bsp_led_io1 = !bsp_led_io1;
|
|
|
|
|
if(dat&0x02) bsp_led_io2 = !bsp_led_io2;
|
2021-09-26 09:18:47 +00:00
|
|
|
|
}
|