[Bak] 备份 驱动移植 23.07.22

This commit is contained in:
gaoyang3513
2024-07-22 23:29:57 +08:00
parent ad41b080e9
commit e1549ed7f3
12 changed files with 253 additions and 253 deletions

View File

@ -1,24 +1,25 @@
/**
**********************************************************************************
* @file ebyte_core.h
* @brief EBYTE<54><45><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϲ<EFBFBD>API<50><49>װ<EFBFBD><D7B0> <20><><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ײ<EFBFBD><D7B2>߼<EFBFBD>
* @details <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>μ<EFBFBD> https://www.ebyte.com/
* @author JiangHeng
* @date 2021-05-13
* @version 1.0.0
* @brief EBYTE<54><45><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϲ<EFBFBD>API<50><49>װ<EFBFBD><D7B0> <20><><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ײ<EFBFBD><D7B2>߼<EFBFBD>
* @details <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>μ<EFBFBD> https://www.ebyte.com/
* @author JiangHeng
* @date 2021-05-13
* @version 1.0.0
**********************************************************************************
* @copyright BSD License
* <20>ɶ<EFBFBD><C9B6>ڰ<EFBFBD><DAB0>ص<EFBFBD><D8B5>ӿƼ<D3BF><C6BC><EFBFBD><EFBFBD>޹<EFBFBD>˾
* ______ ____ __ __ _______ ______
* @copyright BSD License
* <20>ɶ<EFBFBD><C9B6>ڰ<EFBFBD><DAB0>ص<EFBFBD><D8B5>ӿƼ<D3BF><C6BC><EFBFBD><EFBFBD>޹<EFBFBD>˾
* ______ ____ __ __ _______ ______
* | ____| | _ \ \ \ / / |__ __| | ____|
* | |__ | |_) | \ \_/ / | | | |__
* | __| | _ < \ / | | | __|
* | |____ | |_) | | | | | | |____
* |______| |____/ |_| |_| |______|
* | |__ | |_) | \ \_/ / | | | |__
* | __| | _ < \ / | | | __|
* | |____ | |_) | | | | | | |____
* |______| |____/ |_| |_| |______|
*
**********************************************************************************
*/
#include <stdint.h>
#include "ebyte_conf.h"
#if defined(EBYTE_E48_433M20S)||defined(EBYTE_E48_900M20S)
@ -31,13 +32,13 @@ typedef struct
{
void ( *Init )( void );
void ( *Send )( uint8e_t *buffer, uint8e_t size , uint32e_t timeout);
void ( *EnterSleepMode )( uint8e_t command);
void ( *EnterReceiveMode )( uint32e_t timeout );
void ( *EnterSleepMode )( uint8e_t command);
void ( *EnterReceiveMode )( uint32e_t timeout );
void ( *StartPollTask)( void );
void ( *InterruptTrigger)( void );
uint32e_t ( *GetName ) (void );
uint8e_t ( *GetDriverVersion ) (void );
}Ebyte_RF_t;
}Ebyte_RF_t;
extern const Ebyte_RF_t Ebyte_RF;

View File

@ -1,5 +1,5 @@
#include "ebyte_conf.h"
#include "stm8l15x.h"
//#include "stm8l15x.h"
//typedef unsigned char uint8e_t;
//typedef unsigned short uint16e_t;
//typedef unsigned long uint32e_t;

View File

@ -1,20 +1,20 @@
/**
**********************************************************************************
* @file board.c
* @brief E15-EVB02 <20><EFBFBD><E5BCB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @details <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>μ<EFBFBD> https://www.ebyte.com/
* @author JiangHeng
* @date 2021-05-06
* @version 1.0.0
* @brief E15-EVB02 <20><EFBFBD><E5BCB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @details <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>μ<EFBFBD> https://www.ebyte.com/
* @author JiangHeng
* @date 2021-05-06
* @version 1.0.0
**********************************************************************************
* @copyright BSD License
* <20>ɶ<EFBFBD><C9B6>ڰ<EFBFBD><DAB0>ص<EFBFBD><D8B5>ӿƼ<D3BF><C6BC><EFBFBD><EFBFBD>޹<EFBFBD>˾
* ______ ____ __ __ _______ ______
* @copyright BSD License
* <20>ɶ<EFBFBD><C9B6>ڰ<EFBFBD><DAB0>ص<EFBFBD><D8B5>ӿƼ<D3BF><C6BC><EFBFBD><EFBFBD>޹<EFBFBD>˾
* ______ ____ __ __ _______ ______
* | ____| | _ \ \ \ / / |__ __| | ____|
* | |__ | |_) | \ \_/ / | | | |__
* | __| | _ < \ / | | | __|
* | |____ | |_) | | | | | | |____
* |______| |____/ |_| |_| |______|
* | |__ | |_) | \ \_/ / | | | |__
* | __| | _ < \ / | | | __|
* | |____ | |_) | | | | | | |____
* |______| |____/ |_| |_| |______|
*
**********************************************************************************
*/
@ -22,8 +22,8 @@
#include "board.h"
#include "ebyte_conf.h"
BSP_BTN_FIFO_t BSP_BTN_FIFO;
BSP_BTN_FIFO_t BSP_BTN_FIFO;
/*!< @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD> <20><><EFBFBD>ڶ<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>ж<EFBFBD> <20>ݼ<EFBFBD> */
volatile uint32_t Ebyte_TimerDelayCounter = 0;
@ -33,70 +33,64 @@ volatile uint32_t Ebyte_TimerDelayCounter = 0;
*/
void Ebyte_BSP_HSI_Init(void)
{
/* <20>ڲ<EFBFBD> 16M HSI ʱ<><CAB1> */
/* <20>ڲ<EFBFBD> 16M HSI ʱ<><CAB1> */
CLK_SYSCLKSourceConfig( CLK_SYSCLKSource_HSI );
/* 1<><31>Ƶ 16M/1 */
CLK_SYSCLKDivConfig( CLK_SYSCLKDiv_1 );
}
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_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_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 );
}
/* !
* @brief <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IO
*
* @note Ŀ<><C4BF>Ӳ<EFBFBD><D3B2>: EBYTE E15-EVB02
*
* @note Ŀ<><C4BF>Ӳ<EFBFBD><D3B2>: EBYTE E15-EVB02
*/
void Ebyte_BSP_GPIO_Init(void)
{
/* <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>״̬<D7B4><CCAC><EFBFBD><EFBFBD> */
Ebyte_BSP_E48xGPIO_Init();
/* <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 );
GPIO_Init( BSP_GPIO_PORT_LED_2, BSP_GPIO_PIN_LED_2, GPIO_Mode_Out_PP_Low_Slow );
GPIO_Init( BSP_GPIO_PORT_BUTTON_2, BSP_GPIO_PIN_BUTTON_2, GPIO_Mode_In_PU_No_IT );
/* <20><><EFBFBD><EFBFBD> */
GPIO_Init( BSP_GPIO_PORT_BUTTON_1, BSP_GPIO_PIN_BUTTON_1, GPIO_Mode_In_PU_No_IT );
GPIO_Init( BSP_GPIO_PORT_BUTTON_2, BSP_GPIO_PIN_BUTTON_2, GPIO_Mode_In_PU_No_IT );
}
/* !
* @brief ͨ<>Ŵ<EFBFBD><C5B4>ڳ<EFBFBD>ʼ<EFBFBD><CABC>
*
*
* @note <20><>ע<EFBFBD><EFBFBD><E2A3AC>ͬ<EFBFBD><CDAC>MCU<43><55><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD>ӳ<EFBFBD><D3B3>
*/
void Ebyte_BSP_UART_Init( void )
{
/* ʱ<><CAB1> */
CLK_PeripheralClockConfig( BSP_USER_UART_CLOCK, ENABLE);
/* GPIO */
GPIO_ExternalPullUpConfig( BSP_GPIO_PORT_UART_TX, BSP_GPIO_PIN_UART_TX, ENABLE );
GPIO_ExternalPullUpConfig( BSP_GPIO_PORT_UART_RX, BSP_GPIO_PIN_UART_RX, ENABLE );
/* <20>˿<EFBFBD><CBBF><EFBFBD>ӳ<EFBFBD><D3B3> */
SYSCFG_REMAPPinConfig( REMAP_Pin_USART1TxRxPortA, ENABLE );
SYSCFG_REMAPPinConfig( REMAP_Pin_USART1TxRxPortA, ENABLE );
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> E15-EVB02Ĭ<32>ϲ<EFBFBD><CFB2><EFBFBD><EFBFBD><EFBFBD>9600 8N1 */
USART_Init( BSP_USER_UART, BSP_USER_UART_BAUDRATE, USART_WordLength_8b, USART_StopBits_1, BSP_USER_UART_PARITY, (USART_Mode_TypeDef)(USART_Mode_Rx | USART_Mode_Tx ));//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>պͷ<D5BA><CDB7><EFBFBD>
/* <20>򿪽<EFBFBD><F2BFAABD><EFBFBD><EFBFBD>ж<EFBFBD> */;
USART_ITConfig( BSP_USER_UART, USART_IT_RXNE, ENABLE );
/* <20><><EFBFBD><EFBFBD> ʹ<><CAB9> */
USART_Cmd( BSP_USER_UART, ENABLE);
}
@ -113,38 +107,38 @@ 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
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
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_Init( BSP_RF_SPI,
SPI_FirstBit_MSB, //<2F>Ӹ<EFBFBD>λ<EFBFBD><CEBB>ʼ<EFBFBD><CABC><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_CPOL_Low, //<2F><><EFBFBD><EFBFBD> CPOL=0
SPI_CPHA_1Edge, //<2F><><EFBFBD><EFBFBD> CPHA=0 <20><>һ<EFBFBD><D2BB>ʱ<EFBFBD>ӱ<EFBFBD><D3B1>ز<EFBFBD><D8B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
SPI_Direction_2Lines_FullDuplex, //ȫ˫<C8AB><CBAB>
SPI_NSS_Soft, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƴӻ<C6B4>CSƬѡ
0x07); //CRC<52><43><EFBFBD><EFBFBD>
/* ʹ<><CAB9> */
SPI_Cmd( BSP_RF_SPI, ENABLE );
}
/* !
* @brief RFģ<46><C4A3>SPIͨ<49><CDA8><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*
* @param data <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @return <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*
* @param data <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @return <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @note stm8l SPI<50><EFBFBD><E2BAAF><EFBFBD>е<EFBFBD>SPI_SendData()/SPI_ReceiveData() <20><><EFBFBD><EFBFBD>ֱ<EFBFBD><D6B1>ʹ<EFBFBD><CAB9>
*/
uint8_t Ebyte_BSP_SpiTransAndRecv( uint8_t data )
{
BSP_RF_SPI->DR = data;
while ((BSP_RF_SPI->SR & SPI_FLAG_TXE) == RESET);
while ((BSP_RF_SPI->SR & SPI_FLAG_RXNE) == RESET);
return BSP_RF_SPI->DR;
}
@ -154,27 +148,27 @@ uint8_t Ebyte_BSP_SpiTransAndRecv( uint8_t data )
*
* @note ʹ<><CAB9><EFBFBD><EFBFBD>TIM3<4D><33><EFBFBD><EFBFBD>1ms<6D><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
* TIM3<4D><33><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>ΪHSI 16MHz, 128<32><38>Ƶ<EFBFBD><C6B5>Ϊ 16 MHz / 128 = 125 000 Hz
* Ŀ<>궨ʱ1ms <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>Ϊ ( 0.001 x 125000 - 1) = 124
* Ŀ<>궨ʱ1ms <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>Ϊ ( 0.001 x 125000 - 1) = 124
*/
void Ebyte_BSP_TIMER_Init( void )
{
/* ʱ<><CAB1> */
CLK_PeripheralClockConfig( CLK_Peripheral_TIM3, ENABLE);
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);
}
}
/* !
* @brief E15-EVB02 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><D4B4>ʼ<EFBFBD><CABC>
*
*
* @note <20>ڲ<EFBFBD>ʱ<EFBFBD><CAB1>HSI x 16MHz
* <20>û<EFBFBD>ͨ<EFBFBD>Ŵ<EFBFBD><C5B4><EFBFBD> x USART1
* <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>ͨ<EFBFBD>Žӿ<C5BD> x SPI1
@ -186,39 +180,39 @@ void Ebyte_BSP_Init( void )
{
/* ʱ<><CAB1> <20><>ʼ<EFBFBD><CABC> */
Ebyte_BSP_HSI_Init();
/* IO <20><>ʼ<EFBFBD><CABC> */
Ebyte_BSP_GPIO_Init();
/* <20><><EFBFBD><EFBFBD> <20><>ʼ<EFBFBD><CABC> */
Ebyte_BSP_UART_Init();
/* SPI<50>ӿ<EFBFBD> <20><>ʼ<EFBFBD><CABC> */
Ebyte_BSP_SPI_Init();
/* <20><>ʱ<EFBFBD><CAB1> <20><>ʼ<EFBFBD><CABC> */
Ebyte_BSP_TIMER_Init();
/* <20><><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD> <20><>ʼ<EFBFBD><CABC> */
Ebyte_BTN_FIFO_Init( &BSP_BTN_FIFO );
}
/* !
* @brief <20><><EFBFBD><EFBFBD>LED <20><>/<2F><>/<2F><>ת
*
*
* @param LEDx <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŷ<EFBFBD><C5B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @arg BSP_LED_1 : LED1
* @arg BSP_LED_2 : LED2
*
* @arg BSP_LED_2 : LED2
*
* @param ctl <20><> / <20><>
* @arg OFF : <20><>
* @arg ON : <20><>
* @arg TOGGLE : <20><>ת
* @arg ON : <20><>
* @arg TOGGLE : <20><>ת
*/
void Ebyte_BSP_LedControl( BSP_LED_t LEDx , BSP_LED_Ctl_t ctl)
{
@ -229,7 +223,7 @@ void Ebyte_BSP_LedControl( BSP_LED_t LEDx , BSP_LED_Ctl_t ctl)
case BSP_LED_1 : GPIO_ToggleBits( BSP_GPIO_PORT_LED_1, BSP_GPIO_PIN_LED_1); break;
case BSP_LED_2 : GPIO_ToggleBits( BSP_GPIO_PORT_LED_2, BSP_GPIO_PIN_LED_2); break;
default: break;
}
}
}
else
{
@ -238,7 +232,7 @@ void Ebyte_BSP_LedControl( BSP_LED_t LEDx , BSP_LED_Ctl_t ctl)
case BSP_LED_1 : GPIO_WriteBit( BSP_GPIO_PORT_LED_1, BSP_GPIO_PIN_LED_1, (BitAction)ctl); break;
case BSP_LED_2 : GPIO_WriteBit( BSP_GPIO_PORT_LED_2, BSP_GPIO_PIN_LED_2, (BitAction)ctl); break;
default: break;
}
}
}
}
@ -246,13 +240,13 @@ void Ebyte_BSP_LedControl( BSP_LED_t LEDx , BSP_LED_Ctl_t ctl)
/* !
* @brief <20><><EFBFBD>ڶ<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>ĺ<EFBFBD><C4BA><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>
*
*
* @param nTime <20><>λ:<3A><><EFBFBD><EFBFBD>
*/
void Ebyte_BSP_DelayMs( volatile uint32_t nTime )
{
Ebyte_TimerDelayCounter = nTime;
while( Ebyte_TimerDelayCounter !=0 );
}
@ -262,8 +256,8 @@ void Ebyte_BSP_DelayMs( volatile uint32_t nTime )
void Ebyte_BSP_TimerDecrement(void)
{
if( Ebyte_TimerDelayCounter != 0 )
if( Ebyte_TimerDelayCounter != 0 )
{
Ebyte_TimerDelayCounter--;
}
@ -272,24 +266,24 @@ void Ebyte_BSP_TimerDecrement(void)
/* !
* @brief <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>״̬
*
*
* @param btn <20><>Ӧ<EFBFBD>İ<EFBFBD><C4B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @arg BSP_BUTTON_1 :<3A><><EFBFBD><EFBFBD>1
* @arg BSP_BUTTON_1 :<3A><><EFBFBD><EFBFBD>1
* @arg BSP_BUTTON_2 :<3A><><EFBFBD><EFBFBD>2
* @return 0:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>0:<3A><><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD>
* @return 0:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>0:<3A><><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD>
* @note <20><><EFBFBD>ذ<EFBFBD><D8B0><EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD>ʱ IO<49><4F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬ <20><>Ϊ1<CEAA><31><EFBFBD><EFBFBD><EFBFBD>º<EFBFBD>IO<49>ӵ<EFBFBD> <20><>Ϊ0
*/
uint8_t Ebyte_BSP_ReadButton( BSP_BUTTON_t btn )
{
BitStatus result = RESET;
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;
default : break;
}
return result;
}
@ -299,13 +293,13 @@ uint8_t Ebyte_BSP_ReadButton( BSP_BUTTON_t btn )
*/
void Ebyte_BSP_UartTransmit( uint8_t *buffer , uint16_t length )
{
uint8_t i;
for( i = 0; i < length; i++ )
{
while ( USART_GetFlagStatus( USART1, USART_FLAG_TXE ) == RESET );
while ( USART_GetFlagStatus( USART1, USART_FLAG_TBE ) == RESET );
USART_SendData8( USART1, *buffer++ );
}
}
}

View File

@ -1,75 +1,77 @@
/**
**********************************************************************************
* @file board.h
* @brief E15-EVB02 <20><EFBFBD><E5BCB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @details <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>μ<EFBFBD> https://www.ebyte.com/
* @author JiangHeng
* @date 2021-05-06
* @version 1.0.0
* @brief E15-EVB02 <20><EFBFBD><E5BCB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @details <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>μ<EFBFBD> https://www.ebyte.com/
* @author JiangHeng
* @date 2021-05-06
* @version 1.0.0
**********************************************************************************
* @copyright BSD License
* <20>ɶ<EFBFBD><C9B6>ڰ<EFBFBD><DAB0>ص<EFBFBD><D8B5>ӿƼ<D3BF><C6BC><EFBFBD><EFBFBD>޹<EFBFBD>˾
* ______ ____ __ __ _______ ______
* @copyright BSD License
* <20>ɶ<EFBFBD><C9B6>ڰ<EFBFBD><DAB0>ص<EFBFBD><D8B5>ӿƼ<D3BF><C6BC><EFBFBD><EFBFBD>޹<EFBFBD>˾
* ______ ____ __ __ _______ ______
* | ____| | _ \ \ \ / / |__ __| | ____|
* | |__ | |_) | \ \_/ / | | | |__
* | __| | _ < \ / | | | __|
* | |____ | |_) | | | | | | |____
* |______| |____/ |_| |_| |______|
* | |__ | |_) | \ \_/ / | | | |__
* | __| | _ < \ / | | | __|
* | |____ | |_) | | | | | | |____
* |______| |____/ |_| |_| |______|
*
**********************************************************************************
*/
#include "stm8l15x_conf.h"
#include <stdint.h>
//#include "stm8l15x_conf.h"
#include "gd32w51x.h"
#include "board_mini_printf.h"
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> LED */
#define BSP_GPIO_PORT_LED_1 GPIOC
#define BSP_GPIO_PIN_LED_1 GPIO_Pin_6
#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_PIN_LED_2 GPIO_PIN_5
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> */
#define BSP_GPIO_PORT_BUTTON_1 GPIOA
#define BSP_GPIO_PIN_BUTTON_1 GPIO_Pin_4
#define BSP_GPIO_PIN_BUTTON_1 GPIO_PIN_4
#define BSP_GPIO_PORT_BUTTON_2 GPIOA
#define BSP_GPIO_PIN_BUTTON_2 GPIO_Pin_5
#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_PIN_SPI_NSS GPIO_PIN_4
#define BSP_GPIO_PORT_SPI_MOSI GPIOB
#define BSP_GPIO_PIN_SPI_MOSI GPIO_Pin_6
#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_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_PIN_SPI_SCK GPIO_PIN_5
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ͨ<>Ŵ<EFBFBD><C5B4><EFBFBD> */
#define BSP_GPIO_PORT_UART_TX GPIOA
#define BSP_GPIO_PIN_UART_TX GPIO_Pin_2
#define BSP_GPIO_PIN_UART_TX GPIO_PIN_2
#define BSP_GPIO_PORT_UART_RX GPIOA
#define BSP_GPIO_PIN_UART_RX GPIO_Pin_3
#define BSP_GPIO_PIN_UART_RX GPIO_PIN_3
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> EBYTE<54><45><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
/* E48 */
#define BSP_GPIO_PORT_E48_GP0 GPIOC
#define BSP_GPIO_PIN_E48_GP0 GPIO_Pin_1
#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_NIRQ GPIO_PIN_4
#define BSP_GPIO_PORT_E48_GP3 GPIOC
#define BSP_GPIO_PIN_E48_GP3 GPIO_Pin_3
#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_1
#define BSP_GPIO_PORT_E48_GP5 GPIOC
#define BSP_GPIO_PIN_E48_GP5 GPIO_Pin_2
#define BSP_GPIO_PIN_E48_GP5 GPIO_PIN_2
@ -92,22 +94,22 @@
#define Ebyte_BSP_E10SdnIoLow() GPIO_WriteBit( BSP_GPIO_PORT_E10_SDN , BSP_GPIO_PIN_E10_SDN, RESET )
#define Ebyte_BSP_E10SdnIoHigh() GPIO_WriteBit( BSP_GPIO_PORT_E10_SDN , BSP_GPIO_PIN_E10_SDN, SET )
/* E49 */
#define Ebyte_BSP_E49Dio1IoRead() GPIO_ReadInputDataBit( BSP_GPIO_PORT_E49_DIO1 , BSP_GPIO_PIN_E49_DIO1)
#define Ebyte_BSP_E49Dio2IoRead() GPIO_ReadInputDataBit( BSP_GPIO_PORT_E49_DIO2 , BSP_GPIO_PIN_E49_DIO2)
#define Ebyte_BSP_E49FcsbIoLow() GPIO_WriteBit( BSP_GPIO_PORT_E49_FCSB , BSP_GPIO_PIN_E49_FCSB, RESET )
#define Ebyte_BSP_E49FcsbIoHigh() GPIO_WriteBit( BSP_GPIO_PORT_E49_FCSB , BSP_GPIO_PIN_E49_FCSB, SET )
#define Ebyte_BSP_E49Dio1IoRead() GPIO_ReadInputDataBit( BSP_GPIO_PORT_E49_DIO1 , BSP_GPIO_PIN_E49_DIO1)
#define Ebyte_BSP_E49Dio2IoRead() GPIO_ReadInputDataBit( BSP_GPIO_PORT_E49_DIO2 , BSP_GPIO_PIN_E49_DIO2)
#define Ebyte_BSP_E49FcsbIoLow() GPIO_WriteBit( BSP_GPIO_PORT_E49_FCSB , BSP_GPIO_PIN_E49_FCSB, RESET )
#define Ebyte_BSP_E49FcsbIoHigh() GPIO_WriteBit( BSP_GPIO_PORT_E49_FCSB , BSP_GPIO_PIN_E49_FCSB, SET )
#define Ebyte_BSP_E49CsbIoLow() GPIO_WriteBit( BSP_GPIO_PORT_E49_CSB , BSP_GPIO_PIN_E49_CSB, RESET )
#define Ebyte_BSP_E49CsbIoHigh() GPIO_WriteBit( BSP_GPIO_PORT_E49_CSB , BSP_GPIO_PIN_E49_CSB, SET )
#define Ebyte_BSP_E49SlckIoLow() GPIO_WriteBit( BSP_GPIO_PORT_E49_SLCK , BSP_GPIO_PIN_E49_SLCK, RESET )
#define Ebyte_BSP_E49SlckIoHigh() GPIO_WriteBit( BSP_GPIO_PORT_E49_SLCK , BSP_GPIO_PIN_E49_SLCK, SET )
#define Ebyte_BSP_E49SdioIoLow() GPIO_WriteBit( BSP_GPIO_PORT_E49_SDIO , BSP_GPIO_PIN_E49_SDIO, RESET )
#define Ebyte_BSP_E49SdioIoHigh() GPIO_WriteBit( BSP_GPIO_PORT_E49_SDIO , BSP_GPIO_PIN_E49_SDIO, SET )
#define Ebyte_BSP_E49CsbIoHigh() GPIO_WriteBit( BSP_GPIO_PORT_E49_CSB , BSP_GPIO_PIN_E49_CSB, SET )
#define Ebyte_BSP_E49SlckIoLow() GPIO_WriteBit( BSP_GPIO_PORT_E49_SLCK , BSP_GPIO_PIN_E49_SLCK, RESET )
#define Ebyte_BSP_E49SlckIoHigh() GPIO_WriteBit( BSP_GPIO_PORT_E49_SLCK , BSP_GPIO_PIN_E49_SLCK, SET )
#define Ebyte_BSP_E49SdioIoLow() GPIO_WriteBit( BSP_GPIO_PORT_E49_SDIO , BSP_GPIO_PIN_E49_SDIO, RESET )
#define Ebyte_BSP_E49SdioIoHigh() GPIO_WriteBit( BSP_GPIO_PORT_E49_SDIO , BSP_GPIO_PIN_E49_SDIO, SET )
#define Ebyte_BSP_E49SdioIoOutput() GPIO_Init( BSP_GPIO_PORT_E49_SDIO, BSP_GPIO_PIN_E49_SDIO, GPIO_Mode_Out_PP_High_Fast )
#define Ebyte_BSP_E49SdioIoInput() GPIO_Init( BSP_GPIO_PORT_E49_SDIO, BSP_GPIO_PIN_E49_SDIO, GPIO_Mode_In_FL_No_IT )
#define Ebyte_BSP_E49SdioIoRead() GPIO_ReadInputDataBit( BSP_GPIO_PORT_E49_SDIO , BSP_GPIO_PIN_E49_SDIO)
#define Ebyte_BSP_E49SdioIoRead() GPIO_ReadInputDataBit( BSP_GPIO_PORT_E49_SDIO , BSP_GPIO_PIN_E49_SDIO)
/* E48 */
#define Ebyte_BSP_E48GPIO4Read() GPIO_ReadInputDataBit( BSP_GPIO_PORT_E48_GP4 , BSP_GPIO_PIN_E48_GP4)
#define Ebyte_BSP_E48GPIO4Read() GPIO_ReadInputDataBit( BSP_GPIO_PORT_E48_GP4 , BSP_GPIO_PIN_E48_GP4)
/* ȫ<><C8AB><EFBFBD>ж<EFBFBD> */
#define Ebyte_BSP_GlobalIntEnable() __enable_interrupt()
@ -117,7 +119,7 @@
#define BSP_USER_UART USART1
#define BSP_USER_UART_CLOCK CLK_Peripheral_USART1
#define BSP_USER_UART_BAUDRATE 9600 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define BSP_USER_UART_PARITY USART_Parity_No //USART_Parity_No:<3A><>У<EFBFBD><D0A3> USART_Parity_Even:<3A><>У<EFBFBD><D0A3> USART_Parity_Odd:żУ<C5BC><D0A3>
#define BSP_USER_UART_PARITY USART_Parity_No //USART_Parity_No:<3A><>У<EFBFBD><D0A3> USART_Parity_Even:<3A><>У<EFBFBD><D0A3> USART_Parity_Odd:żУ<C5BC><D0A3>
#define BSP_USER_UART_IRQ USART1_RX_IRQn //<2F>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD>
#define BSP_USER_UART_IRQ_LEVEL ITC_PriorityLevel_2 //<2F><><EFBFBD>ȼ<EFBFBD>
@ -126,14 +128,14 @@
#define BSP_BTN_FIFO_LENGTH 16
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>Դ<EFBFBD>ӡ<EFBFBD><D3A1>Ϣ <20>رմ<D8B1>ӡ<EFBFBD><D3A1>Ҫע<D2AA>͵<EFBFBD><CDB5><EFBFBD><EAB6A8> EBYTE_DEBUG */
#define EBYTE_DEBUG
#define EBYTE_DEBUG
#ifdef EBYTE_DEBUG
#define DEBUG(format, ...) mprintf(format, ##__VA_ARGS__)
#define DEBUG(format, ...) mprintf(format, ##__VA_ARGS__)
#else
#define DEBUG(...)
#define DEBUG(...)
#endif
typedef enum { BSP_LED_1 = 0, BSP_LED_2 } BSP_LED_t;
typedef enum { OFF = 0, ON , TOGGLE} BSP_LED_Ctl_t;
typedef enum { UART_8N1 = 0, UART_8O1, UART_8E1 } BSP_UART_Parity_t;
@ -141,10 +143,10 @@ typedef enum { UART_8N1 = 0, UART_8O1, UART_8E1 } BSP_UART_Parity_t;
typedef enum { BSP_BUTTON_1 = 0, BSP_BUTTON_2 } BSP_BUTTON_t;
typedef enum
{
BTN_1_SHORT, //<2F><><EFBFBD><EFBFBD>1 <20>̰<EFBFBD>
BTN_1_LONG, //<2F><><EFBFBD><EFBFBD>1 <20><><EFBFBD><EFBFBD>
BTN_2_SHORT, //<2F><><EFBFBD><EFBFBD>2 <20>̰<EFBFBD>
BTN_2_LONG, //<2F><><EFBFBD><EFBFBD>2 <20><><EFBFBD><EFBFBD>
BTN_1_SHORT, //<2F><><EFBFBD><EFBFBD>1 <20>̰<EFBFBD>
BTN_1_LONG, //<2F><><EFBFBD><EFBFBD>1 <20><><EFBFBD><EFBFBD>
BTN_2_SHORT, //<2F><><EFBFBD><EFBFBD>2 <20>̰<EFBFBD>
BTN_2_LONG, //<2F><><EFBFBD><EFBFBD>2 <20><><EFBFBD><EFBFBD>
}BSP_BTN_EVENT_t;
typedef struct

View File

@ -1,10 +1,10 @@
#include "stdarg.h"
#include "stm8l15x_usart.h"
//#include "stm8l15x_usart.h"
#include "board_mini_printf.h"
/* !
* @brief Ŀ<><C4BF>Ӳ<EFBFBD><D3B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD>Žӿ<C5BD>
*
*
* @param data д<><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1 Byte
*/
static void send_uart_data(uint8_t data)
@ -12,7 +12,7 @@ static void send_uart_data(uint8_t data)
while (USART_GetFlagStatus(USART1, USART_FLAG_TXE) == RESET);
USART_SendData8(USART1,data);
}
/*
<20><><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD>int<6E><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD>תΪ2<CEAA><32>8<EFBFBD><38>10<31><30>16<31><36><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>value --- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>int<6E><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
@ -57,7 +57,7 @@ static char *sky_itoa(int value, char *str, unsigned int radix)
}
return str;
}
/*
<20><><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD>double<6C><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD>תΪ<D7AA>ַ<EFBFBD><D6B7><EFBFBD>
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>value --- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>double<6C><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
@ -98,7 +98,7 @@ static void sky_ftoa(double value, char *str, unsigned int eps)
if (eps < 1 || eps > 4) {
eps = 4;
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E2A3AC>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD>1.2<EFBFBD><EFBFBD><EFBFBD><EFBFBD>1.19<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
double pp = 0.1;
for (j = 0; j <= eps; j++) {
@ -126,25 +126,25 @@ static void sky_ftoa(double value, char *str, unsigned int eps)
}
str[i] = '\0';
}
void mprintf(char * Data, ...)
{
const char *s;
int d;
int d;
char buf[16];
uint8_t txdata;
va_list ap;
va_start(ap, Data);
while ( * Data != 0 ) {
if ( * Data == 0x5c ) {
while ( * Data != 0 ) {
if ( * Data == 0x5c ) {
switch ( *++Data ) {
case 'r':
case 'r':
txdata = 0x0d;
send_uart_data(txdata);
Data ++;
break;
case 'n':
case 'n':
txdata = 0x0a;
send_uart_data(txdata);
Data ++;
@ -152,46 +152,46 @@ void mprintf(char * Data, ...)
default:
Data ++;
break;
}
} else if ( * Data == '%') {
switch ( *++Data ) {
case 's':
}
} else if ( * Data == '%') {
switch ( *++Data ) {
case 's':
s = va_arg(ap, const char *);
for ( ; *s; s++) {
send_uart_data(*((uint8_t *)s));
}
Data++;
}
Data++;
break;
case 'd':
d = va_arg(ap, int);
sky_itoa(d, buf, 10);
case 'd':
d = va_arg(ap, int);
sky_itoa(d, buf, 10);
for (s = buf; *s; s++) {
send_uart_data(*((uint8_t *)s));
}
Data++;
}
Data++;
break;
case 'x': {
d = va_arg(ap, int);
sky_itoa(d, buf, 16);
d = va_arg(ap, int);
sky_itoa(d, buf, 16);
for (s = buf; *s; s++) {
send_uart_data(*((uint8_t *)s));
}
Data++;
}
Data++;
break;
}
case 'f': {
double num = va_arg(ap, double);
double num = va_arg(ap, double);
sky_ftoa(num, buf, 4);
for (s = buf; *s; s++) {
send_uart_data(*((uint8_t *)s));
}
Data++;
}
Data++;
break;
}
default:
Data++;
break;
}
Data++;
break;
}
} else {
send_uart_data(*((uint8_t *)Data));
Data++;

View File

@ -4,6 +4,7 @@
#define __RADIO_H
#include <stdint.h>
#include "radio_phy.h"
#include "radio_mac.h"
#include "CMT2310A_def.h"

View File

@ -4,7 +4,7 @@
#define __RADIO_HAL_H
#include "stm8l15x.h"
//#include "stm8l15x.h"
#include "ebyte_port.h"

View File

@ -1,7 +1,8 @@
#ifndef __RADIO_PHY_H
#define __RADIO_PHY_H
#include "stm8l15x.h"
//#include "stm8l15x.h"
#include "gd32w51x.h"
#include "radio_hal.h"
#include "CMT2310A_def.h"
#include "CMT2310A_reg.h"
@ -47,12 +48,12 @@ extern void vRadioFifoGetStatus( FIFO_STATUS_FLG* fifo_status );
extern void vRadioClearTxFifo( void );
extern void vRadioClearRxFifo( void );
extern void vRadioManualResetTxFifoPointer( void );
extern void vRadioInterruptSoucreCfg( INT_SRC_CFG* int_src_ctrl );
extern void vRadioInterruptSoucreFlag( INT_SRC_FLG* int_src_flag );
extern void vRadioInterruptSoucreClear( INT_SRC_CLR* int_src_clr );
extern void vRadioConfigPageReg( byte page_sel, uint8_t const reg_ptr[], uint8_t reg_len );
extern void vRadioReadPageReg( byte page_sel, uint8_t reg_ptr[], uint8_t reg_len );
extern boolean_t bRadioIsExist( void );

View File

@ -2,7 +2,8 @@
#define __RADIO_SPI_H
#include "stm8l15x.h"
//#include "stm8l15x.h"
#include "gd32w51x.h"
#include "ebyte_port.h"
extern void vSpiMasterInit( void );

View File

@ -14,13 +14,13 @@
*
* http://www.st.com/software_license_agreement_liberty_v2
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
@ -29,7 +29,7 @@
/** @addtogroup STM8L15x_StdPeriph_Driver
* @{
*/
*/
/* Uncomment the line below according to the target STM8L15x device used in your
application
*/
@ -47,7 +47,7 @@
devices, you can define the device in your toolchain compiler preprocessor.
- Low density STM8L15x devices are STM8L151C3, STM8L151K3, STM8L151G3, STM8L151F3,
STM8L151C2, STM8L151K2, STM8L151G2 and STM8L151F2 microcontrollers where the
STM8L151C2, STM8L151K2, STM8L151G2 and STM8L151F2 microcontrollers where the
Flash memory density ranges between 4 and 8 Kbytes.
- Medium density STM8L15x devices are STM8L151C4, STM8L151C6, STM8L152C4,
STM8L152C6, STM8L151K4, STM8L151K6, STM8L152K4, STM8L152K6, STM8L151G4,
@ -57,16 +57,16 @@
the Flash memory density is fixed and equal to 32 Kbytes and a wider range of
peripheral than the medium density devices.
- High density STM8L15x devices are STM8L151x8, STM8L152x8, STM8L162R8 and STM8L162M8
microcontrollers where the Flash memory density is fixed and equal to 64 Kbytes with
microcontrollers where the Flash memory density is fixed and equal to 64 Kbytes with
the same peripheral set than Medium Density Plus devices.
- Value line low density STM8L05xx devices are STM8L051x3 microcontrollers
with 8-KB Flash
- Value line medium density STM8L05xx devices are STM8L052x6 microcontrollers
- Value line medium density STM8L05xx devices are STM8L052x6 microcontrollers
with 32-KB Flash
- Value line high density STM8L05xx devices: STM8L052x8 microcontrollers
with 64-KB Flash
- Medium density STM8AL31xx/STM8AL3Lxx devices: STM8AL3168, STM8AL3166,
STM8AL3148,STM8AL3146, STM8AL3138, STM8AL3136, STM8AL3L68, STM8AL3L66,
- Medium density STM8AL31xx/STM8AL3Lxx devices: STM8AL3168, STM8AL3166,
STM8AL3148,STM8AL3146, STM8AL3138, STM8AL3136, STM8AL3L68, STM8AL3L66,
STM8AL3L48, STM8AL3L46 microcontrollers with 8-KB, 16-KB or 32-KB Flash
*/
@ -93,7 +93,7 @@
/* Comment the line below if you will not use the peripherals drivers.
In this case, these drivers will not be included and the application code will be
based on direct access to peripherals registers */
#define USE_STDPERIPH_DRIVER
// #define USE_STDPERIPH_DRIVER
#endif
/**
@ -116,7 +116,7 @@
/**
* @brief Definition of Device on-chip RC oscillator frequencies
*/
#if !defined HSI_VALUE
#if !defined HSI_VALUE
#define HSI_VALUE ((uint32_t)16000000) /*!< Typical Value of the HSI in Hz */
#endif /* HSI_VALUE */
@ -143,7 +143,7 @@
#elif defined (STM8L15X_HD) || defined (STM8L05X_HD_VL)
/*!< Used with memory Models for code higher than 64K */
#define MEMCPY fmemcpy
#endif /* STM8L15X_MD or STM8L15X_MDP or STM8L05X_MD_VL or STM8AL31_L_MD*/
#endif /* STM8L15X_MD or STM8L15X_MDP or STM8L05X_MD_VL or STM8AL31_L_MD*/
#else /*_IAR_*/
#define FAR __far
#define NEAR __near
@ -182,15 +182,15 @@ defined (STM8L05X_LD_VL) || defined (STM8L05X_MD_VL) || defined (STM8AL31_L_MD)
#else /*_IAR_*/
#define IN_RAM(a) __ramfunc a
#endif /* _COSMIC_ */
#else
#else
#define IN_RAM(a) a
#endif /* RAM_EXECUTION */
/*!< [31:16] STM8L15X Standard Peripheral Library main version */
#define __STM8L15X_STDPERIPH_VERSION_MAIN ((uint8_t)0x01) /*!< [31:24] main version */
#define __STM8L15X_STDPERIPH_VERSION_MAIN ((uint8_t)0x01) /*!< [31:24] main version */
#define __STM8L15X_STDPERIPH_VERSION_SUB1 ((uint8_t)0x06) /*!< [23:16] sub1 version */
#define __STM8L15X_STDPERIPH_VERSION_SUB2 ((uint8_t)0x00) /*!< [15:8] sub2 version */
#define __STM8L15X_STDPERIPH_VERSION_RC ((uint8_t)0x00) /*!< [7:0] release candidate */
#define __STM8L15X_STDPERIPH_VERSION_RC ((uint8_t)0x00) /*!< [7:0] release candidate */
#define __STM8L15X_STDPERIPH_VERSION ( (__STM8L15X_STDPERIPH_VERSION_MAIN << 24)\
|(__STM8L15X_STDPERIPH_VERSION_SUB1 << 16)\
|(__STM8L15X_STDPERIPH_VERSION_SUB2 << 8)\
@ -2889,7 +2889,7 @@ AES_TypeDef;
#define CFG ((CFG_TypeDef *) CFG_BASE)
#define OPT ((OPT_TypeDef *) OPT_BASE)
#ifdef USE_STDPERIPH_DRIVER
#ifdef USE_STDPERIPH_DRIVER
#include "stm8l15x_conf.h"
#endif
@ -2950,7 +2950,7 @@ AES_TypeDef;
__interrupt void (a)( void )
#define INTERRUPT_HANDLER_TRAP(a) \
_Pragma( VECTOR_ID( 1 ) ) \
__interrupt void (a) (void)
__interrupt void (a) (void)
#endif /* _IAR_ */
/*============================== Interrupt Handler declaration ========================*/
@ -2959,7 +2959,7 @@ AES_TypeDef;
#elif defined(_IAR_)
#define INTERRUPT __interrupt
#endif /* _COSMIC_ */
/*============================== Handling bits ====================================*/
/*-----------------------------------------------------------------------------
Method : I

View File

@ -14,13 +14,13 @@
*
* http://www.st.com/software_license_agreement_liberty_v2
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
@ -28,16 +28,16 @@
#define __STM8L15x_USART_H
/* Includes ------------------------------------------------------------------*/
#include "stm8l15x.h"
#include "stm8l15x_clk.h"
//#include "stm8l15x.h"
//#include "stm8l15x_clk.h"
/** @addtogroup STM8L15x_StdPeriph_Driver
* @{
*/
/** @addtogroup USART
* @{
*/
*/
/* Exported types ------------------------------------------------------------*/
/** @defgroup USART_Exported_Types
@ -47,8 +47,8 @@
/** @defgroup USART_Flags
* @{
*/
typedef enum
{
typedef enum
{
USART_FLAG_TXE = (uint16_t)0x0080, /*!< Transmit Data Register Empty flag */
USART_FLAG_TC = (uint16_t)0x0040, /*!< Transmission Complete flag */
USART_FLAG_RXNE = (uint16_t)0x0020, /*!< Read Data Register Not Empty flag */
@ -70,9 +70,9 @@ typedef enum
((Flag) == USART_FLAG_FE) || \
((Flag) == USART_FLAG_PE) || \
((Flag) == USART_FLAG_SBK))
#define IS_USART_CLEAR_FLAG(Flag) (((Flag) == USART_FLAG_TC))
/**
* @}
*/
@ -80,7 +80,7 @@ typedef enum
/** @defgroup USART_Interrupts
* @{
*/
/**
* @brief USART Interrupt definition
* USART_IT possible values
@ -89,8 +89,8 @@ typedef enum
* Y: Flag position
* Z: Register index
*/
typedef enum
{
typedef enum
{
USART_IT_TXE = (uint16_t)0x0277, /*!< Transmit interrupt */
USART_IT_TC = (uint16_t)0x0266, /*!< Transmission Complete interrupt */
USART_IT_RXNE = (uint16_t)0x0255, /*!< Receive interrupt */
@ -123,7 +123,7 @@ typedef enum
/**
* @}
*/
/** @defgroup USART_Wakeup_Modes
* @{
*/
@ -138,7 +138,7 @@ typedef enum
/**
* @}
*/
/** @defgroup USART_Stop_Bits
* @{
*/
@ -155,7 +155,7 @@ typedef enum
/**
* @}
*/
/** @defgroup USART_Parity
* @{
*/
@ -172,8 +172,8 @@ typedef enum
/**
* @}
*/
/** @defgroup USART_Lin_Break_Detection_Length
/** @defgroup USART_Lin_Break_Detection_Length
* @{
*/
typedef enum
@ -185,8 +185,8 @@ typedef enum
/**
* @}
*/
/** @defgroup USART_Word_Length
/** @defgroup USART_Word_Length
* @{
*/
typedef enum
@ -197,12 +197,12 @@ typedef enum
#define IS_USART_WORDLENGTH(WordLength) (((WordLength) == USART_WordLength_8b) || \
((WordLength) == USART_WordLength_9b))
/**
* @}
*/
/** @defgroup USART_Mode
/** @defgroup USART_Mode
* @{
*/
typedef enum
@ -215,8 +215,8 @@ typedef enum
/**
* @}
*/
/** @defgroup USART_DMA_Requests
/** @defgroup USART_DMA_Requests
* @{
*/
typedef enum
@ -229,8 +229,8 @@ typedef enum
/**
* @}
*/
/** @defgroup USART_IrDA_Mode
/** @defgroup USART_IrDA_Mode
* @{
*/
typedef enum
@ -244,8 +244,8 @@ typedef enum
/**
* @}
*/
/** @defgroup USART_Clock
/** @defgroup USART_Clock
* @{
*/
typedef enum
@ -258,8 +258,8 @@ typedef enum
/**
* @}
*/
/** @defgroup USART_Clock_Polarity
/** @defgroup USART_Clock_Polarity
* @{
*/
typedef enum
@ -272,8 +272,8 @@ typedef enum
/**
* @}
*/
/** @defgroup USART_Clock_Phase
/** @defgroup USART_Clock_Phase
* @{
*/
typedef enum
@ -286,8 +286,8 @@ typedef enum
/**
* @}
*/
/** @defgroup USART_LastBit
/** @defgroup USART_LastBit
* @{
*/
typedef enum
@ -305,7 +305,7 @@ typedef enum
/**
* @}
*/
/* Exported constants --------------------------------------------------------*/
/* Exported macros -----------------------------------------------------------*/
/** @defgroupUSART_Exported_Macros
@ -325,8 +325,8 @@ typedef enum
*/
/* Exported functions ------------------------------------------------------- */
/* Function used to set the USART configuration to the default reset state ***/
/* Function used to set the USART configuration to the default reset state ***/
void USART_DeInit(USART_TypeDef* USARTx);
/* Initialization and Configuration functions *********************************/
@ -340,7 +340,7 @@ void USART_Cmd(USART_TypeDef* USARTx, FunctionalState NewState);
void USART_SetPrescaler(USART_TypeDef* USARTx, uint8_t USART_Prescaler);
void USART_SendBreak(USART_TypeDef* USARTx);
/* Data transfers functions ***************************************************/
/* Data transfers functions ***************************************************/
void USART_SendData8(USART_TypeDef* USARTx, uint8_t Data);
void USART_SendData9(USART_TypeDef* USARTx, uint16_t Data);
uint8_t USART_ReceiveData8(USART_TypeDef* USARTx);
@ -382,7 +382,7 @@ void USART_ClearITPendingBit(USART_TypeDef* USARTx, USART_IT_TypeDef USART_IT);
/**
* @}
*/
/**
* @}
*/

View File

@ -13,14 +13,14 @@
*
* http://www.st.com/software_license_agreement_liberty_v2
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************
*/
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM8L15x_CONF_H
@ -61,9 +61,9 @@
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/* Uncomment the line below to expanse the "assert_param" macro in the
/* Uncomment the line below to expanse the "assert_param" macro in the
Standard Peripheral Library drivers code */
/* #define USE_FULL_ASSERT (1) */
/* #define USE_FULL_ASSERT (1) */
/* Exported macro ------------------------------------------------------------*/
#ifdef USE_FULL_ASSERT
@ -72,7 +72,7 @@
* @brief The assert_param macro is used for function's parameters check.
* @param expr: If expr is false, it calls assert_failed function
* which reports the name of the source file and the source
* line number of the call that failed.
* line number of the call that failed.
* If expr is true, it returns no value.
* @retval : None
*/