Compare commits
4 Commits
47725a5b15
...
e0900f9b73
| Author | SHA1 | Date | |
|---|---|---|---|
| e0900f9b73 | |||
| bb7b6e452b | |||
| f135363861 | |||
| 48bc218fb1 |
@ -114,6 +114,8 @@ OF SUCH DAMAGE.
|
||||
#define ALICLOUD_TASK_PRIO TASK_PRIO_APP_BASE
|
||||
#endif
|
||||
|
||||
//#define CONFIG_TASK_LED
|
||||
|
||||
#ifdef CONFIG_IPERF_TEST
|
||||
#define IPERF_TASK_MAX 1
|
||||
|
||||
|
||||
@ -82,7 +82,7 @@ void do_ram_code_copy(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined (CONFIG_GY3513)
|
||||
#if defined (CONFIG_TASK_LED)
|
||||
static int32_t led_init(void)
|
||||
{
|
||||
gd_eval_led_init(LED1);
|
||||
@ -104,7 +104,7 @@ void led_task(void *p_arg)
|
||||
|
||||
sys_task_delete(NULL);
|
||||
}
|
||||
#endif // CONFIG_GY3513
|
||||
#endif // CONFIG_TASK_LED
|
||||
|
||||
/*!
|
||||
\brief initialize application
|
||||
@ -168,14 +168,14 @@ void start_task(void *p_arg)
|
||||
*/
|
||||
int main(void)
|
||||
{
|
||||
#if defined (CONFIG_GY3513)
|
||||
#if defined (CONFIG_TASK_LED)
|
||||
TaskHandle_t *stTaskHndl_led = NULL;
|
||||
#endif // CONFIG_GY3513
|
||||
#endif // CONFIG_TASK_LED
|
||||
|
||||
platform_init();
|
||||
#if defined (CONFIG_GY3513)
|
||||
#if defined (CONFIG_TASK_LED)
|
||||
led_init();
|
||||
#endif // CONFIG_GY3513
|
||||
#endif // CONFIG_TASK_LED
|
||||
|
||||
DEBUGPRINT("SDK git revision: "WIFI_GIT_REVISION" \r\n");
|
||||
DEBUGPRINT("SDK version: V%d.%d.%d\r\n", (RE_NSPE_VERSION >> 24), ((RE_NSPE_VERSION & 0xFF0000) >> 16), (RE_NSPE_VERSION & 0xFFFF));
|
||||
@ -187,7 +187,7 @@ int main(void)
|
||||
|
||||
systick_delay_init();
|
||||
|
||||
#if defined (CONFIG_GY3513)
|
||||
#if defined (CONFIG_TASK_LED)
|
||||
#define LED_TASK_STK_SIZE 256
|
||||
#define LED_TASK_PRIO (TASK_PRIO_APP_BASE + TASK_PRIO_HIGHER(1))
|
||||
|
||||
@ -195,7 +195,7 @@ int main(void)
|
||||
if (stTaskHndl_led == NULL) {
|
||||
DEBUG_ERROR("Error, task create failed.\r\n");
|
||||
}
|
||||
#endif // CONFIG_GY3513
|
||||
#endif // CONFIG_TASK_LED
|
||||
|
||||
if (NULL == sys_task_create(NULL, (const uint8_t *)"sub1g_task", NULL, START_TASK_STK_SIZE, 0, START_TASK_PRIO, sub1g_task, NULL)) {
|
||||
DEBUGPRINT("ERROR: create start task failed\r\n");
|
||||
|
||||
@ -735,6 +735,5 @@ void platform_init(void)
|
||||
gdm3210x_fpga_init();
|
||||
#elif CONFIG_PLATFORM == PLATFORM_ASIC_32W51X
|
||||
gd32w51x_asic_init();
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -23,6 +23,7 @@
|
||||
|
||||
/*= !!!<21><><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>Ӳ<EFBFBD><D3B2>ƽ̨ͷ<CCA8>ļ<EFBFBD> =======================================*/
|
||||
#include "board.h" //E15-EVB02 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#include "wrapper_os.h"
|
||||
/*==================================================================*/
|
||||
|
||||
/* !
|
||||
@ -77,22 +78,20 @@ void Ebyte_Port_SpiCsIoControl( uint8e_t cmd )
|
||||
void Ebyte_Port_DelayMs( uint16e_t time )
|
||||
{
|
||||
/* !<21><><EFBFBD><EFBFBD><EFBFBD>ṩ: <20><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD> */
|
||||
sys_ms_sleep(time);
|
||||
}
|
||||
|
||||
uint16e_t i,n;
|
||||
|
||||
while(time--)//<2F><><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>STM8L 16Mʱ<4D><CAB1>ǰ<EFBFBD><C7B0><EFBFBD>µĴ<C2B5><C4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ
|
||||
/* !
|
||||
* @brief <20><><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>Ӳ<EFBFBD><D3B2>ƽ̨<C6BD><CCA8>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>
|
||||
*
|
||||
* @param time <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>
|
||||
* @note <20><>ע<EFBFBD><D7A2>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD>ô˺<C3B4><CBBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><D7A2><EFBFBD>ж<EFBFBD><D0B6>Ƿ<EFBFBD><C7B7><EFBFBD>Ӱ<EFBFBD>쵽<EFBFBD>˺<EFBFBD><CBBA><EFBFBD>
|
||||
*/
|
||||
void Ebyte_Port_DelayUs( uint16e_t time )
|
||||
{
|
||||
for(i=900;i>0;i--)
|
||||
{
|
||||
for( n=1 ;n>0 ;n--) {
|
||||
__NOP();
|
||||
__NOP();
|
||||
__NOP();
|
||||
__NOP();
|
||||
}
|
||||
}
|
||||
}
|
||||
/* !<21><><EFBFBD><EFBFBD><EFBFBD>ṩ: <20><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD> */
|
||||
sys_us_delay(time);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -24,6 +24,7 @@ void Ebyte_Port_RstIoControl( uint8e_t cmd );
|
||||
void Ebyte_Port_TxenIoControl( uint8e_t cmd );
|
||||
void Ebyte_Port_RxenIoControl( uint8e_t cmd );
|
||||
void Ebyte_Port_DelayMs( uint16e_t time );
|
||||
void Ebyte_Port_DelayUs( uint16e_t time );
|
||||
void Ebyte_Port_SpiCsIoControl( uint8e_t cmd );
|
||||
|
||||
uint8e_t Ebyte_Port_BusyIoRead( void );
|
||||
|
||||
@ -59,11 +59,11 @@ static BSP_BTN_EVENT_t BTN_Event;
|
||||
int ebyte_main( void )
|
||||
{
|
||||
/* <20><><EFBFBD><EFBFBD>Ӳ<EFBFBD><D3B2><EFBFBD><EFBFBD>Դ <20><>ʼ<EFBFBD><CABC> */
|
||||
// Ebyte_BSP_Init();
|
||||
Ebyte_BSP_Init();
|
||||
/* (<28><>ѡ) <20><><EFBFBD><EFBFBD><EFBFBD>жϽ<D0B6><CFBD><EFBFBD>FIFO <20>ɸ<EFBFBD><C9B8><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD>д<EFBFBD><D0B4><EFBFBD> */
|
||||
// Ebyte_FIFO_Init( &hfifo, EBYTE_FIFO_SIZE );
|
||||
Ebyte_FIFO_Init( &hfifo, EBYTE_FIFO_SIZE );
|
||||
/* EBYTE <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC> */
|
||||
// Ebyte_RF.Init();
|
||||
Ebyte_RF.Init();
|
||||
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
||||
// Ebyte_RF.EnterReceiveMode( 0 );
|
||||
/* MCU <20><>ȫ<EFBFBD><C8AB><EFBFBD>ж<EFBFBD> */
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
#include "board.h"
|
||||
#include "ebyte_port.h"
|
||||
#include "ebyte_conf.h"
|
||||
#include "gd32w51x_gpio.h"
|
||||
#include "platform_def.h"
|
||||
|
||||
BSP_BTN_FIFO_t BSP_BTN_FIFO;
|
||||
@ -45,11 +46,13 @@ void Ebyte_BSP_HSI_Init(void)
|
||||
|
||||
void Ebyte_BSP_E48xGPIO_Init(void)
|
||||
{
|
||||
// GPIO_Init( BSP_GPIO_PORT_E48_GP0, BSP_GPIO_PIN_E48_GP0, GPIO_Mode_In_PU_No_IT );
|
||||
// GPIO_Init( BSP_GPIO_PORT_E48_NIRQ, BSP_GPIO_PIN_E48_NIRQ, GPIO_Mode_In_PU_No_IT );
|
||||
// GPIO_Init( BSP_GPIO_PORT_E48_GP3, BSP_GPIO_PIN_E48_GP3, GPIO_Mode_In_PU_No_IT );
|
||||
// GPIO_Init( BSP_GPIO_PORT_E48_GP4, BSP_GPIO_PIN_E48_GP4, GPIO_Mode_In_FL_No_IT );
|
||||
// GPIO_Init( BSP_GPIO_PORT_E48_GP5, BSP_GPIO_PIN_E48_GP5, GPIO_Mode_In_PU_No_IT );
|
||||
rcu_periph_clock_enable(BSP_GPIO_RCU_E48_GPIO);
|
||||
|
||||
gpio_mode_set( BSP_GPIO_PORT_E48_GP0, GPIO_MODE_INPUT, GPIO_PUPD_PULLUP, BSP_GPIO_PIN_E48_GP0);
|
||||
gpio_mode_set( BSP_GPIO_PORT_E48_NIRQ, GPIO_MODE_INPUT, GPIO_PUPD_PULLUP, BSP_GPIO_PIN_E48_NIRQ);
|
||||
gpio_mode_set( BSP_GPIO_PORT_E48_GP3, GPIO_MODE_INPUT, GPIO_PUPD_PULLUP, BSP_GPIO_PIN_E48_GP3);
|
||||
gpio_mode_set( BSP_GPIO_PORT_E48_GP4, GPIO_MODE_INPUT, GPIO_PUPD_NONE, BSP_GPIO_PIN_E48_GP4);
|
||||
gpio_mode_set( BSP_GPIO_PORT_E48_GP5, GPIO_MODE_INPUT, GPIO_PUPD_PULLUP, BSP_GPIO_PIN_E48_GP5);
|
||||
}
|
||||
/* !
|
||||
* @brief <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IO
|
||||
@ -58,15 +61,19 @@ void Ebyte_BSP_E48xGPIO_Init(void)
|
||||
*/
|
||||
void Ebyte_BSP_GPIO_Init(void)
|
||||
{
|
||||
// /* <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>״̬<D7B4><CCAC><EFBFBD><EFBFBD> */
|
||||
// Ebyte_BSP_E48xGPIO_Init();
|
||||
// /* LED */
|
||||
// GPIO_Init( BSP_GPIO_PORT_LED_1, BSP_GPIO_PIN_LED_1, GPIO_Mode_Out_PP_Low_Slow );
|
||||
// GPIO_Init( BSP_GPIO_PORT_LED_2, BSP_GPIO_PIN_LED_2, GPIO_Mode_Out_PP_Low_Slow );
|
||||
//
|
||||
// /* <20><><EFBFBD><EFBFBD> */
|
||||
// GPIO_Init( BSP_GPIO_PORT_BUTTON_1, BSP_GPIO_PIN_BUTTON_1, GPIO_Mode_In_PU_No_IT );
|
||||
//
|
||||
/* <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>״̬<D7B4><CCAC><EFBFBD><EFBFBD> */
|
||||
Ebyte_BSP_E48xGPIO_Init();
|
||||
|
||||
/* LED */
|
||||
rcu_periph_clock_enable(BSP_GPIO_RCU_E48_LED);
|
||||
gpio_mode_set( BSP_GPIO_PORT_LED_1, GPIO_MODE_OUTPUT, GPIO_PUPD_PULLUP, BSP_GPIO_PIN_LED_1 );
|
||||
gpio_mode_set( BSP_GPIO_PORT_LED_2, GPIO_MODE_OUTPUT, GPIO_PUPD_PULLUP, BSP_GPIO_PIN_LED_2 );
|
||||
gpio_output_options_set(BSP_GPIO_PORT_LED_1, GPIO_OTYPE_PP, GPIO_OSPEED_25MHZ, BSP_GPIO_PIN_LED_1);
|
||||
gpio_output_options_set(BSP_GPIO_PORT_LED_2, GPIO_OTYPE_PP, GPIO_OSPEED_25MHZ, BSP_GPIO_PIN_LED_2);
|
||||
|
||||
/* Button */
|
||||
rcu_periph_clock_enable(BSP_GPIO_RCU_E48_BUTTON);
|
||||
gpio_mode_set( BSP_GPIO_PORT_BUTTON_1, GPIO_MODE_INPUT, GPIO_PUPD_PULLUP, BSP_GPIO_PIN_BUTTON_1);
|
||||
// GPIO_Init( BSP_GPIO_PORT_BUTTON_2, BSP_GPIO_PIN_BUTTON_2, GPIO_Mode_In_PU_No_IT );
|
||||
}
|
||||
|
||||
@ -107,26 +114,36 @@ void Ebyte_BSP_ThreeLinesSPI_Init()
|
||||
*/
|
||||
void Ebyte_BSP_SPI_Init( void )
|
||||
{
|
||||
// /* ʱ<><CAB1> */
|
||||
// CLK_PeripheralClockConfig( CLK_Peripheral_SPI1, ENABLE);
|
||||
//
|
||||
// /* GPIO */
|
||||
// GPIO_Init( BSP_GPIO_PORT_SPI_NSS, BSP_GPIO_PIN_SPI_NSS, GPIO_Mode_Out_PP_High_Slow); //Ƭѡ CS
|
||||
spi_parameter_struct spi_init_struct;
|
||||
|
||||
/* ʱ<><CAB1> */
|
||||
rcu_periph_clock_enable(BSP_RF_SPI_CLOCK);
|
||||
rcu_periph_clock_enable(BSP_GPIO_RCU_E48_SPI);
|
||||
|
||||
/* SPI1 GPIO config: SCK/PB13, MISO/PB14, MOSI/PB15 */
|
||||
gpio_af_set(BSP_GPIO_PORT_SPI, GPIO_AF_5, GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15);
|
||||
gpio_mode_set(BSP_GPIO_PORT_SPI, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15);
|
||||
gpio_output_options_set(BSP_GPIO_PORT_SPI, GPIO_OTYPE_PP, GPIO_OSPEED_10MHZ, GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15);
|
||||
|
||||
/* SPI0_NSS */
|
||||
gpio_mode_set(BSP_GPIO_PORT_SPI, GPIO_MODE_OUTPUT, GPIO_PUPD_PULLUP, BSP_GPIO_PIN_SPI_NSS); //Ƭѡ CS
|
||||
gpio_output_options_set(BSP_GPIO_PORT_SPI, GPIO_OTYPE_PP, GPIO_OSPEED_25MHZ, BSP_GPIO_PIN_SPI_NSS);
|
||||
|
||||
// GPIO_ExternalPullUpConfig( BSP_GPIO_PORT_SPI_SCK, BSP_GPIO_PIN_SPI_MOSI | BSP_GPIO_PIN_SPI_MISO | BSP_GPIO_PIN_SPI_SCK, ENABLE); // MOSI MISO SCK
|
||||
//
|
||||
// /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
||||
// SPI_Init( BSP_RF_SPI,
|
||||
// SPI_FirstBit_MSB, //<2F>Ӹ<EFBFBD>λ<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// SPI_BaudRatePrescaler_8, //16M/2 SCK<43><4B><EFBFBD><EFBFBD>
|
||||
// SPI_Mode_Master, //<2F><><EFBFBD><EFBFBD>ģʽ
|
||||
// SPI_CPOL_Low, //<2F><><EFBFBD><EFBFBD> CPOL=0
|
||||
// SPI_CPHA_1Edge, //<EFBFBD><EFBFBD><EFBFBD><EFBFBD> CPHA=0 <20><>һ<EFBFBD><D2BB>ʱ<EFBFBD>ӱ<EFBFBD><D3B1>ز<EFBFBD><D8B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// SPI_Direction_2Lines_FullDuplex, //ȫ˫<EFBFBD><EFBFBD>
|
||||
// SPI_NSS_Soft, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƴӻ<C6B4>CSƬѡ
|
||||
// 0x07); //CRC<52><43><EFBFBD><EFBFBD>
|
||||
//
|
||||
// /* ʹ<EFBFBD><EFBFBD> */
|
||||
// SPI_Cmd( BSP_RF_SPI, ENABLE );
|
||||
|
||||
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
||||
spi_init_struct.trans_mode = SPI_TRANSMODE_FULLDUPLEX;
|
||||
spi_init_struct.device_mode = SPI_MASTER; //<2F><><EFBFBD><EFBFBD>ģʽ
|
||||
spi_init_struct.frame_size = SPI_FRAMESIZE_8BIT;
|
||||
spi_init_struct.clock_polarity_phase = SPI_CK_PL_LOW_PH_1EDGE; // Mode0 {CPOL=0, CPHA=0}
|
||||
spi_init_struct.nss = SPI_NSS_SOFT; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƴӻ<EFBFBD>CSƬѡ
|
||||
spi_init_struct.prescale = SPI_PSC_8; //16M/2 SCK<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
spi_init_struct.endian = SPI_ENDIAN_MSB; //<EFBFBD>Ӹ<EFBFBD>λ<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
spi_init(BSP_RF_SPI, &spi_init_struct);
|
||||
|
||||
/* ʹ<><CAB9> */
|
||||
/* SPI enable */
|
||||
spi_enable(BSP_RF_SPI);
|
||||
}
|
||||
|
||||
/* !
|
||||
@ -138,6 +155,12 @@ void Ebyte_BSP_SPI_Init( void )
|
||||
*/
|
||||
uint8_t Ebyte_BSP_SpiTransAndRecv( uint8_t data )
|
||||
{
|
||||
while(RESET == spi_i2s_flag_get(BSP_RF_SPI, SPI_FLAG_TBE));
|
||||
spi_i2s_data_transmit(BSP_RF_SPI, data);
|
||||
|
||||
while(RESET == spi_i2s_flag_get(BSP_RF_SPI, SPI_FLAG_RBNE));
|
||||
return spi_i2s_data_receive(BSP_RF_SPI);
|
||||
|
||||
// BSP_RF_SPI->DR = data;
|
||||
// while ((BSP_RF_SPI->SR & SPI_FLAG_TXE) == RESET);
|
||||
//
|
||||
@ -154,18 +177,35 @@ uint8_t Ebyte_BSP_SpiTransAndRecv( uint8_t data )
|
||||
*/
|
||||
void Ebyte_BSP_TIMER_Init( void )
|
||||
{
|
||||
// /* ʱ<><CAB1> */
|
||||
// CLK_PeripheralClockConfig( CLK_Peripheral_TIM3, ENABLE);
|
||||
//
|
||||
// /* <20><><EFBFBD><EFBFBD> */
|
||||
// TIM3_TimeBaseInit( TIM3_Prescaler_128 , TIM3_CounterMode_Up, 124);
|
||||
//
|
||||
// /* <20><><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD> */
|
||||
// TIM3_ClearFlag(TIM3_FLAG_Update);
|
||||
// TIM3_ITConfig(TIM3_IT_Update, ENABLE);
|
||||
//
|
||||
// /* ʹ<><CAB9> */
|
||||
// TIM3_Cmd(ENABLE);
|
||||
timer_parameter_struct timer_initpara;
|
||||
/**
|
||||
TIMER2 Configuration:
|
||||
TIMER2CLK = SystemCoreClock/180 = 1MHz.
|
||||
TIMER2 configuration is timing mode, and the timing is 1ms(1000/1 = 1ms).
|
||||
*/
|
||||
|
||||
/* enable the peripherals clock */
|
||||
rcu_timer_clock_prescaler_config(RCU_TIMER_PSC_MUL4);
|
||||
rcu_periph_clock_enable(BSP_RF_TIMER_RCU);
|
||||
|
||||
/* deinit a TIMER */
|
||||
timer_deinit(BSP_RF_TIMER);
|
||||
/* initialize TIMER init parameter struct */
|
||||
timer_struct_para_init(&timer_initpara);
|
||||
/* TIMER2 configuration */
|
||||
timer_initpara.prescaler = 179;
|
||||
timer_initpara.alignedmode = TIMER_COUNTER_EDGE;
|
||||
timer_initpara.counterdirection = TIMER_COUNTER_UP;
|
||||
timer_initpara.period = 1000;
|
||||
timer_initpara.clockdivision = TIMER_CKDIV_DIV1;
|
||||
timer_init(BSP_RF_TIMER, &timer_initpara);
|
||||
|
||||
/* clear interrupt bit */
|
||||
timer_interrupt_flag_clear(BSP_RF_TIMER, TIMER_INT_FLAG_UP);
|
||||
/* enable the TIMER interrupt */
|
||||
timer_interrupt_enable(BSP_RF_TIMER, TIMER_INT_UP);
|
||||
/* enable a TIMER */
|
||||
timer_enable(BSP_RF_TIMER);
|
||||
}
|
||||
|
||||
/* !
|
||||
@ -181,13 +221,13 @@ void Ebyte_BSP_TIMER_Init( void )
|
||||
void Ebyte_BSP_Init( void )
|
||||
{
|
||||
/* ʱ<><CAB1> <20><>ʼ<EFBFBD><CABC> */
|
||||
Ebyte_BSP_HSI_Init();
|
||||
// Ebyte_BSP_HSI_Init();
|
||||
|
||||
/* IO <20><>ʼ<EFBFBD><CABC> */
|
||||
Ebyte_BSP_GPIO_Init();
|
||||
|
||||
/* <20><><EFBFBD><EFBFBD> <20><>ʼ<EFBFBD><CABC> */
|
||||
Ebyte_BSP_UART_Init();
|
||||
// Ebyte_BSP_UART_Init();
|
||||
|
||||
/* SPI<50>ӿ<EFBFBD> <20><>ʼ<EFBFBD><CABC> */
|
||||
Ebyte_BSP_SPI_Init();
|
||||
@ -276,8 +316,8 @@ uint8_t Ebyte_BSP_ReadButton( BSP_BUTTON_t btn )
|
||||
|
||||
switch ( btn )
|
||||
{
|
||||
case BSP_BUTTON_1: result = GPIO_ReadInputDataBit( BSP_GPIO_PORT_BUTTON_1 , BSP_GPIO_PIN_BUTTON_1); break;
|
||||
case BSP_BUTTON_2: result = GPIO_ReadInputDataBit( BSP_GPIO_PORT_BUTTON_2 , BSP_GPIO_PIN_BUTTON_2); break;
|
||||
case BSP_BUTTON_1: result = gpio_input_bit_get( BSP_GPIO_PORT_BUTTON_1 , BSP_GPIO_PIN_BUTTON_1); break;
|
||||
// case BSP_BUTTON_2: result = GPIO_ReadInputDataBit( BSP_GPIO_PORT_BUTTON_2 , BSP_GPIO_PIN_BUTTON_2); break;
|
||||
default : break;
|
||||
}
|
||||
|
||||
|
||||
@ -28,31 +28,29 @@
|
||||
#include "board_mini_printf.h"
|
||||
|
||||
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> LED */
|
||||
#define BSP_GPIO_PORT_LED_1 GPIOC
|
||||
#define BSP_GPIO_RCU_E48_LED RCU_GPIOB
|
||||
#define BSP_GPIO_PORT_LED_1 GPIOB
|
||||
#define BSP_GPIO_PIN_LED_1 GPIO_PIN_6
|
||||
|
||||
#define BSP_GPIO_PORT_LED_2 GPIOC
|
||||
#define BSP_GPIO_PIN_LED_2 GPIO_PIN_5
|
||||
#define BSP_GPIO_PORT_LED_2 GPIOA
|
||||
#define BSP_GPIO_PIN_LED_2 GPIO_PIN_15
|
||||
|
||||
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> */
|
||||
#define BSP_GPIO_RCU_E48_BUTTON RCU_GPIOA
|
||||
#define BSP_GPIO_PORT_BUTTON_1 GPIOA
|
||||
#define BSP_GPIO_PIN_BUTTON_1 GPIO_PIN_4
|
||||
#define BSP_GPIO_PIN_BUTTON_1 GPIO_PIN_2
|
||||
|
||||
#define BSP_GPIO_PORT_BUTTON_2 GPIOA
|
||||
#define BSP_GPIO_PIN_BUTTON_2 GPIO_PIN_5
|
||||
//#define BSP_GPIO_PORT_BUTTON_2 GPIOA
|
||||
//#define BSP_GPIO_PIN_BUTTON_2 GPIO_PIN_5
|
||||
|
||||
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> SPIͨ<49>Žӿ<C5BD> */
|
||||
#define BSP_GPIO_PORT_SPI_NSS GPIOB
|
||||
#define BSP_GPIO_PIN_SPI_NSS GPIO_PIN_4
|
||||
#define BSP_GPIO_RCU_E48_SPI RCU_GPIOB
|
||||
|
||||
#define BSP_GPIO_PORT_SPI_MOSI GPIOB
|
||||
#define BSP_GPIO_PIN_SPI_MOSI GPIO_PIN_6
|
||||
|
||||
#define BSP_GPIO_PORT_SPI_MISO GPIOB
|
||||
#define BSP_GPIO_PIN_SPI_MISO GPIO_PIN_7
|
||||
|
||||
#define BSP_GPIO_PORT_SPI_SCK GPIOB
|
||||
#define BSP_GPIO_PIN_SPI_SCK GPIO_PIN_5
|
||||
#define BSP_GPIO_PORT_SPI GPIOB
|
||||
#define BSP_GPIO_PIN_SPI_NSS GPIO_PIN_12
|
||||
#define BSP_GPIO_PIN_SPI_SCK GPIO_PIN_13
|
||||
#define BSP_GPIO_PIN_SPI_MISO GPIO_PIN_14
|
||||
#define BSP_GPIO_PIN_SPI_MOSI GPIO_PIN_15
|
||||
|
||||
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ͨ<>Ŵ<EFBFBD><C5B4><EFBFBD> */
|
||||
#define BSP_GPIO_PORT_UART_TX GPIOA
|
||||
@ -65,24 +63,28 @@
|
||||
|
||||
|
||||
/* E48 */
|
||||
#define BSP_GPIO_RCU_E48_GPIO RCU_GPIOC
|
||||
|
||||
#define BSP_GPIO_PORT_E48_GP0 GPIOC
|
||||
#define BSP_GPIO_PIN_E48_GP0 GPIO_PIN_1
|
||||
#define BSP_GPIO_PORT_E48_NIRQ GPIOD
|
||||
#define BSP_GPIO_PIN_E48_NIRQ GPIO_PIN_4
|
||||
#define BSP_GPIO_PIN_E48_GP0 GPIO_PIN_0
|
||||
#define BSP_GPIO_PORT_E48_NIRQ GPIOC
|
||||
#define BSP_GPIO_PIN_E48_NIRQ GPIO_PIN_1
|
||||
#define BSP_GPIO_PORT_E48_GP3 GPIOC
|
||||
#define BSP_GPIO_PIN_E48_GP3 GPIO_PIN_3
|
||||
#define BSP_GPIO_PORT_E48_GP4 GPIOC
|
||||
#define BSP_GPIO_PIN_E48_GP4 GPIO_PIN_1
|
||||
#define BSP_GPIO_PIN_E48_GP4 GPIO_PIN_4
|
||||
#define BSP_GPIO_PORT_E48_GP5 GPIOC
|
||||
#define BSP_GPIO_PIN_E48_GP5 GPIO_PIN_2
|
||||
|
||||
|
||||
#define BSP_GPIO_PIN_E48_GP5 GPIO_PIN_5
|
||||
|
||||
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> SPI */
|
||||
#define BSP_RF_SPI SPI1
|
||||
#define BSP_RF_SPI_CLOCK CLK_Peripheral_SPI1
|
||||
#define Ebyte_BSP_RfSpiSelected() gpio_bit_write( BSP_GPIO_PORT_SPI_NSS , BSP_GPIO_PIN_SPI_NSS, RESET )
|
||||
#define Ebyte_BSP_RfSpiUnselected() gpio_bit_write( BSP_GPIO_PORT_SPI_NSS , BSP_GPIO_PIN_SPI_NSS, SET )
|
||||
#define BSP_RF_SPI_CLOCK RCU_SPI1
|
||||
#define Ebyte_BSP_RfSpiSelected() gpio_bit_write( BSP_GPIO_PORT_SPI, BSP_GPIO_PIN_SPI_NSS, RESET )
|
||||
#define Ebyte_BSP_RfSpiUnselected() gpio_bit_write( BSP_GPIO_PORT_SPI, BSP_GPIO_PIN_SPI_NSS, SET )
|
||||
|
||||
/* <20><><EFBFBD><EFBFBD> Timer */
|
||||
#define BSP_RF_TIMER TIMER2
|
||||
#define BSP_RF_TIMER_RCU RCU_TIMER2
|
||||
|
||||
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IO */
|
||||
|
||||
|
||||
@ -7,13 +7,7 @@ void delay1ms(uint16_t cnt)
|
||||
|
||||
void delay10us(uint32_t cnt)
|
||||
{
|
||||
uint8_t i;
|
||||
|
||||
while( cnt-- ) {
|
||||
i = 20;
|
||||
while(i--)
|
||||
__NOP();
|
||||
}
|
||||
Ebyte_Port_DelayUs(cnt * 10);
|
||||
}
|
||||
|
||||
/******************************
|
||||
|
||||
Reference in New Issue
Block a user