Format new content

This commit is contained in:
Ben V. Brown
2021-05-03 22:10:14 +10:00
parent e3deb33d7f
commit dd5daf51e3
24 changed files with 14097 additions and 15594 deletions

View File

@@ -17,16 +17,14 @@ volatile uint8_t pendingPWM = 0;
uint16_t totalPWM = 255; uint16_t totalPWM = 255;
const uint16_t powerPWM = 255; const uint16_t powerPWM = 255;
history<uint16_t, PID_TIM_HZ> rawTempFilter = { { 0 }, 0, 0 }; history<uint16_t, PID_TIM_HZ> rawTempFilter = {{0}, 0, 0};
void resetWatchdog() { void resetWatchdog() { HAL_IWDG_Refresh(&hiwdg); }
HAL_IWDG_Refresh(&hiwdg);
}
#ifdef TEMP_NTC #ifdef TEMP_NTC
// Lookup table for the NTC // Lookup table for the NTC
// Stored as ADCReading,Temp in degC // Stored as ADCReading,Temp in degC
static const uint16_t NTCHandleLookup[] = { static const uint16_t NTCHandleLookup[] = {
// ADC Reading , Temp in Cx10 // ADC Reading , Temp in Cx10
808, 1600, // 808, 1600, //
832, 1590, // 832, 1590, //
848, 1580, // 848, 1580, //
@@ -187,9 +185,8 @@ static const uint16_t NTCHandleLookup[] = {
28920, 30, // 28920, 30, //
29104, 20, // 29104, 20, //
29272, 10, // 29272, 10, //
}; };
const int NTCHandleLookupItems = sizeof(NTCHandleLookup) const int NTCHandleLookupItems = sizeof(NTCHandleLookup) / (2 * sizeof(uint16_t));
/ (2 * sizeof(uint16_t));
#endif #endif
// These are called by the HAL after the corresponding events from the system // These are called by the HAL after the corresponding events from the system
@@ -204,13 +201,10 @@ void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) {
} }
uint16_t getHandleTemperature() { uint16_t getHandleTemperature() {
int32_t result = getADC(0); int32_t result = getADC(0);
return Utils::InterpolateLookupTable(NTCHandleLookup, NTCHandleLookupItems, return Utils::InterpolateLookupTable(NTCHandleLookup, NTCHandleLookupItems, result);
result);
} }
uint16_t getTipInstantTemperature() { uint16_t getTipInstantTemperature() { return getADC(2); }
return getADC(2);
}
uint16_t getTipRawTemp(uint8_t refresh) { uint16_t getTipRawTemp(uint8_t refresh) {
if (refresh) { if (refresh) {
@@ -328,26 +322,14 @@ void unstick_I2C() {
HAL_I2C_Init(&hi2c1); HAL_I2C_Init(&hi2c1);
} }
uint8_t getButtonA() { uint8_t getButtonA() { return HAL_GPIO_ReadPin(KEY_A_GPIO_Port, KEY_A_Pin) == GPIO_PIN_RESET ? 1 : 0; }
return HAL_GPIO_ReadPin(KEY_A_GPIO_Port, KEY_A_Pin) == GPIO_PIN_RESET ? uint8_t getButtonB() { return HAL_GPIO_ReadPin(KEY_B_GPIO_Port, KEY_B_Pin) == GPIO_PIN_RESET ? 1 : 0; }
1 : 0;
}
uint8_t getButtonB() {
return HAL_GPIO_ReadPin(KEY_B_GPIO_Port, KEY_B_Pin) == GPIO_PIN_RESET ?
1 : 0;
}
void BSPInit(void) { void BSPInit(void) { WS2812::init(); }
WS2812::init();
}
void reboot() { void reboot() { NVIC_SystemReset(); }
NVIC_SystemReset();
}
void delay_ms(uint16_t count) { void delay_ms(uint16_t count) { HAL_Delay(count); }
HAL_Delay(count);
}
void setPlatePullup(bool pullingUp) { void setPlatePullup(bool pullingUp) {
GPIO_InitTypeDef GPIO_InitStruct; GPIO_InitTypeDef GPIO_InitStruct;
@@ -356,13 +338,11 @@ void setPlatePullup(bool pullingUp) {
GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Pull = GPIO_NOPULL;
if (pullingUp) { if (pullingUp) {
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
HAL_GPIO_WritePin(PLATE_SENSOR_PULLUP_GPIO_Port, HAL_GPIO_WritePin(PLATE_SENSOR_PULLUP_GPIO_Port, PLATE_SENSOR_PULLUP_Pin, GPIO_PIN_SET);
PLATE_SENSOR_PULLUP_Pin, GPIO_PIN_SET);
} else { } else {
// Hi-z // Hi-z
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
HAL_GPIO_WritePin(PLATE_SENSOR_PULLUP_GPIO_Port, HAL_GPIO_WritePin(PLATE_SENSOR_PULLUP_GPIO_Port, PLATE_SENSOR_PULLUP_Pin, GPIO_PIN_RESET);
PLATE_SENSOR_PULLUP_Pin, GPIO_PIN_RESET);
} }
HAL_GPIO_Init(PLATE_SENSOR_PULLUP_GPIO_Port, &GPIO_InitStruct); HAL_GPIO_Init(PLATE_SENSOR_PULLUP_GPIO_Port, &GPIO_InitStruct);
} }
@@ -379,10 +359,9 @@ bool isTipDisconnected() {
* plate_sensor_res = ((adc5_value_PD1_set - adc5_value_PD1_cleared) / (adc5_value_PD1_cleared + 4096 - adc5_value_PD1_set)) * 1000.0; * plate_sensor_res = ((adc5_value_PD1_set - adc5_value_PD1_cleared) / (adc5_value_PD1_cleared + 4096 - adc5_value_PD1_set)) * 1000.0;
* */ * */
bool tipDisconnected = getADC(2) > (4090*8); bool tipDisconnected = getADC(2) > (4090 * 8);
// We have to handle here that this ^ will trip while measuring the gain resistor // We have to handle here that this ^ will trip while measuring the gain resistor
if (xTaskGetTickCount() - lastMeas if (xTaskGetTickCount() - lastMeas < (TICKS_100MS * 2 + (TICKS_100MS / 2))) {
< (TICKS_100MS * 2 + (TICKS_100MS / 2))) {
tipDisconnected = false; tipDisconnected = false;
} }
@@ -410,19 +389,15 @@ bool isTipDisconnected() {
} else { } else {
// We have taken reading one // We have taken reading one
uint16_t adcReadingPD1Cleared = getADC(3); uint16_t adcReadingPD1Cleared = getADC(3);
uint32_t a = ((int) adcReadingPD1Set uint32_t a = ((int)adcReadingPD1Set - (int)adcReadingPD1Cleared);
- (int) adcReadingPD1Cleared);
a *= 10000; a *= 10000;
uint32_t b = ((int) adcReadingPD1Cleared uint32_t b = ((int)adcReadingPD1Cleared + (32768 - (int)adcReadingPD1Set));
+ (32768 - (int) adcReadingPD1Set));
if (b) { if (b) {
tipSenseResistancex10Ohms = a / b; tipSenseResistancex10Ohms = a / b;
} else { } else {
tipSenseResistancex10Ohms = adcReadingPD1Set = tipSenseResistancex10Ohms = adcReadingPD1Set = lastMeas = 0;
lastMeas = 0;
} }
if (tipSenseResistancex10Ohms > 1100 if (tipSenseResistancex10Ohms > 1100 || tipSenseResistancex10Ohms < 900) {
|| tipSenseResistancex10Ohms < 900) {
tipSenseResistancex10Ohms = 0; // out of range tipSenseResistancex10Ohms = 0; // out of range
adcReadingPD1Set = 0; adcReadingPD1Set = 0;
lastMeas = 0; lastMeas = 0;
@@ -445,18 +420,17 @@ void setStatusLED(const enum StatusLED state) {
WS2812::led_set_color(0, 0, 0, 0); WS2812::led_set_color(0, 0, 0, 0);
break; break;
case LED_STANDBY: case LED_STANDBY:
WS2812::led_set_color(0, 0, 0xFF, 0); //green WS2812::led_set_color(0, 0, 0xFF, 0); // green
break; break;
case LED_HEATING: { case LED_HEATING: {
WS2812::led_set_color(0, ((HAL_GetTick() / 10) % 192) + 64, 0, WS2812::led_set_color(0, ((HAL_GetTick() / 10) % 192) + 64, 0,
0); //Red fade 0); // Red fade
} } break;
break;
case LED_HOT: case LED_HOT:
WS2812::led_set_color(0, 0xFF, 0, 0); //red WS2812::led_set_color(0, 0xFF, 0, 0); // red
break; break;
case LED_COOLING_STILL_HOT: case LED_COOLING_STILL_HOT:
WS2812::led_set_color(0, 0xFF, 0x8C, 0x00); //Orange WS2812::led_set_color(0, 0xFF, 0x8C, 0x00); // Orange
break; break;
} }
WS2812::led_update(); WS2812::led_update();

View File

@@ -25,7 +25,6 @@
****************************************************************************** ******************************************************************************
*/ */
/** @addtogroup CMSIS /** @addtogroup CMSIS
* @{ * @{
*/ */
@@ -38,7 +37,7 @@
#define __STM32F103xB_H #define __STM32F103xB_H
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/** @addtogroup Configuration_section_for_CMSIS /** @addtogroup Configuration_section_for_CMSIS
@@ -48,7 +47,7 @@
* @brief Configuration of the Cortex-M3 Processor and Core Peripherals * @brief Configuration of the Cortex-M3 Processor and Core Peripherals
*/ */
#define __CM3_REV 0x0200U /*!< Core Revision r2p0 */ #define __CM3_REV 0x0200U /*!< Core Revision r2p0 */
#define __MPU_PRESENT 0U /*!< Other STM32 devices does not provide an MPU */ #define __MPU_PRESENT 0U /*!< Other STM32 devices does not provide an MPU */
#define __NVIC_PRIO_BITS 4U /*!< STM32 uses 4 Bits for the Priority Levels */ #define __NVIC_PRIO_BITS 4U /*!< STM32 uses 4 Bits for the Priority Levels */
#define __Vendor_SysTickConfig 0U /*!< Set to 1 if different SysTick Config is used */ #define __Vendor_SysTickConfig 0U /*!< Set to 1 if different SysTick Config is used */
@@ -65,10 +64,9 @@
* in @ref Library_configuration_section * in @ref Library_configuration_section
*/ */
/*!< Interrupt Number Definition */ /*!< Interrupt Number Definition */
typedef enum typedef enum {
{ /****** Cortex-M3 Processor Exceptions Numbers ***************************************************/
/****** Cortex-M3 Processor Exceptions Numbers ***************************************************/
NonMaskableInt_IRQn = -14, /*!< 2 Non Maskable Interrupt */ NonMaskableInt_IRQn = -14, /*!< 2 Non Maskable Interrupt */
HardFault_IRQn = -13, /*!< 3 Cortex-M3 Hard Fault Interrupt */ HardFault_IRQn = -13, /*!< 3 Cortex-M3 Hard Fault Interrupt */
MemoryManagement_IRQn = -12, /*!< 4 Cortex-M3 Memory Management Interrupt */ MemoryManagement_IRQn = -12, /*!< 4 Cortex-M3 Memory Management Interrupt */
@@ -79,7 +77,7 @@ typedef enum
PendSV_IRQn = -2, /*!< 14 Cortex-M3 Pend SV Interrupt */ PendSV_IRQn = -2, /*!< 14 Cortex-M3 Pend SV Interrupt */
SysTick_IRQn = -1, /*!< 15 Cortex-M3 System Tick Interrupt */ SysTick_IRQn = -1, /*!< 15 Cortex-M3 System Tick Interrupt */
/****** STM32 specific Interrupt Numbers *********************************************************/ /****** STM32 specific Interrupt Numbers *********************************************************/
WWDG_IRQn = 0, /*!< Window WatchDog Interrupt */ WWDG_IRQn = 0, /*!< Window WatchDog Interrupt */
PVD_IRQn = 1, /*!< PVD through EXTI Line detection Interrupt */ PVD_IRQn = 1, /*!< PVD through EXTI Line detection Interrupt */
TAMPER_IRQn = 2, /*!< Tamper Interrupt */ TAMPER_IRQn = 2, /*!< Tamper Interrupt */
@@ -141,8 +139,7 @@ typedef enum
* @brief Analog to Digital Converter * @brief Analog to Digital Converter
*/ */
typedef struct typedef struct {
{
__IO uint32_t SR; __IO uint32_t SR;
__IO uint32_t CR1; __IO uint32_t CR1;
__IO uint32_t CR2; __IO uint32_t CR2;
@@ -165,8 +162,7 @@ typedef struct
__IO uint32_t DR; __IO uint32_t DR;
} ADC_TypeDef; } ADC_TypeDef;
typedef struct typedef struct {
{
__IO uint32_t SR; /*!< ADC status register, used for ADC multimode (bits common to several ADC instances). Address offset: ADC1 base address */ __IO uint32_t SR; /*!< ADC status register, used for ADC multimode (bits common to several ADC instances). Address offset: ADC1 base address */
__IO uint32_t CR1; /*!< ADC control register 1, used for ADC multimode (bits common to several ADC instances). Address offset: ADC1 base address + 0x04 */ __IO uint32_t CR1; /*!< ADC control register 1, used for ADC multimode (bits common to several ADC instances). Address offset: ADC1 base address + 0x04 */
__IO uint32_t CR2; /*!< ADC control register 2, used for ADC multimode (bits common to several ADC instances). Address offset: ADC1 base address + 0x08 */ __IO uint32_t CR2; /*!< ADC control register 2, used for ADC multimode (bits common to several ADC instances). Address offset: ADC1 base address + 0x08 */
@@ -178,8 +174,7 @@ typedef struct
* @brief Backup Registers * @brief Backup Registers
*/ */
typedef struct typedef struct {
{
uint32_t RESERVED0; uint32_t RESERVED0;
__IO uint32_t DR1; __IO uint32_t DR1;
__IO uint32_t DR2; __IO uint32_t DR2;
@@ -200,8 +195,7 @@ typedef struct
* @brief Controller Area Network TxMailBox * @brief Controller Area Network TxMailBox
*/ */
typedef struct typedef struct {
{
__IO uint32_t TIR; __IO uint32_t TIR;
__IO uint32_t TDTR; __IO uint32_t TDTR;
__IO uint32_t TDLR; __IO uint32_t TDLR;
@@ -212,8 +206,7 @@ typedef struct
* @brief Controller Area Network FIFOMailBox * @brief Controller Area Network FIFOMailBox
*/ */
typedef struct typedef struct {
{
__IO uint32_t RIR; __IO uint32_t RIR;
__IO uint32_t RDTR; __IO uint32_t RDTR;
__IO uint32_t RDLR; __IO uint32_t RDLR;
@@ -224,8 +217,7 @@ typedef struct
* @brief Controller Area Network FilterRegister * @brief Controller Area Network FilterRegister
*/ */
typedef struct typedef struct {
{
__IO uint32_t FR1; __IO uint32_t FR1;
__IO uint32_t FR2; __IO uint32_t FR2;
} CAN_FilterRegister_TypeDef; } CAN_FilterRegister_TypeDef;
@@ -234,8 +226,7 @@ typedef struct
* @brief Controller Area Network * @brief Controller Area Network
*/ */
typedef struct typedef struct {
{
__IO uint32_t MCR; __IO uint32_t MCR;
__IO uint32_t MSR; __IO uint32_t MSR;
__IO uint32_t TSR; __IO uint32_t TSR;
@@ -264,8 +255,7 @@ typedef struct
* @brief CRC calculation unit * @brief CRC calculation unit
*/ */
typedef struct typedef struct {
{
__IO uint32_t DR; /*!< CRC Data register, Address offset: 0x00 */ __IO uint32_t DR; /*!< CRC Data register, Address offset: 0x00 */
__IO uint8_t IDR; /*!< CRC Independent data register, Address offset: 0x04 */ __IO uint8_t IDR; /*!< CRC Independent data register, Address offset: 0x04 */
uint8_t RESERVED0; /*!< Reserved, Address offset: 0x05 */ uint8_t RESERVED0; /*!< Reserved, Address offset: 0x05 */
@@ -273,43 +263,36 @@ typedef struct
__IO uint32_t CR; /*!< CRC Control register, Address offset: 0x08 */ __IO uint32_t CR; /*!< CRC Control register, Address offset: 0x08 */
} CRC_TypeDef; } CRC_TypeDef;
/** /**
* @brief Debug MCU * @brief Debug MCU
*/ */
typedef struct typedef struct {
{
__IO uint32_t IDCODE; __IO uint32_t IDCODE;
__IO uint32_t CR; __IO uint32_t CR;
}DBGMCU_TypeDef; } DBGMCU_TypeDef;
/** /**
* @brief DMA Controller * @brief DMA Controller
*/ */
typedef struct typedef struct {
{
__IO uint32_t CCR; __IO uint32_t CCR;
__IO uint32_t CNDTR; __IO uint32_t CNDTR;
__IO uint32_t CPAR; __IO uint32_t CPAR;
__IO uint32_t CMAR; __IO uint32_t CMAR;
} DMA_Channel_TypeDef; } DMA_Channel_TypeDef;
typedef struct typedef struct {
{
__IO uint32_t ISR; __IO uint32_t ISR;
__IO uint32_t IFCR; __IO uint32_t IFCR;
} DMA_TypeDef; } DMA_TypeDef;
/** /**
* @brief External Interrupt/Event Controller * @brief External Interrupt/Event Controller
*/ */
typedef struct typedef struct {
{
__IO uint32_t IMR; __IO uint32_t IMR;
__IO uint32_t EMR; __IO uint32_t EMR;
__IO uint32_t RTSR; __IO uint32_t RTSR;
@@ -322,8 +305,7 @@ typedef struct
* @brief FLASH Registers * @brief FLASH Registers
*/ */
typedef struct typedef struct {
{
__IO uint32_t ACR; __IO uint32_t ACR;
__IO uint32_t KEYR; __IO uint32_t KEYR;
__IO uint32_t OPTKEYR; __IO uint32_t OPTKEYR;
@@ -339,8 +321,7 @@ typedef struct
* @brief Option Bytes Registers * @brief Option Bytes Registers
*/ */
typedef struct typedef struct {
{
__IO uint16_t RDP; __IO uint16_t RDP;
__IO uint16_t USER; __IO uint16_t USER;
__IO uint16_t Data0; __IO uint16_t Data0;
@@ -355,8 +336,7 @@ typedef struct
* @brief General Purpose I/O * @brief General Purpose I/O
*/ */
typedef struct typedef struct {
{
__IO uint32_t CRL; __IO uint32_t CRL;
__IO uint32_t CRH; __IO uint32_t CRH;
__IO uint32_t IDR; __IO uint32_t IDR;
@@ -370,8 +350,7 @@ typedef struct
* @brief Alternate Function I/O * @brief Alternate Function I/O
*/ */
typedef struct typedef struct {
{
__IO uint32_t EVCR; __IO uint32_t EVCR;
__IO uint32_t MAPR; __IO uint32_t MAPR;
__IO uint32_t EXTICR[4]; __IO uint32_t EXTICR[4];
@@ -382,8 +361,7 @@ typedef struct
* @brief Inter Integrated Circuit Interface * @brief Inter Integrated Circuit Interface
*/ */
typedef struct typedef struct {
{
__IO uint32_t CR1; __IO uint32_t CR1;
__IO uint32_t CR2; __IO uint32_t CR2;
__IO uint32_t OAR1; __IO uint32_t OAR1;
@@ -399,8 +377,7 @@ typedef struct
* @brief Independent WATCHDOG * @brief Independent WATCHDOG
*/ */
typedef struct typedef struct {
{
__IO uint32_t KR; /*!< Key register, Address offset: 0x00 */ __IO uint32_t KR; /*!< Key register, Address offset: 0x00 */
__IO uint32_t PR; /*!< Prescaler register, Address offset: 0x04 */ __IO uint32_t PR; /*!< Prescaler register, Address offset: 0x04 */
__IO uint32_t RLR; /*!< Reload register, Address offset: 0x08 */ __IO uint32_t RLR; /*!< Reload register, Address offset: 0x08 */
@@ -411,8 +388,7 @@ typedef struct
* @brief Power Control * @brief Power Control
*/ */
typedef struct typedef struct {
{
__IO uint32_t CR; __IO uint32_t CR;
__IO uint32_t CSR; __IO uint32_t CSR;
} PWR_TypeDef; } PWR_TypeDef;
@@ -421,8 +397,7 @@ typedef struct
* @brief Reset and Clock Control * @brief Reset and Clock Control
*/ */
typedef struct typedef struct {
{
__IO uint32_t CR; __IO uint32_t CR;
__IO uint32_t CFGR; __IO uint32_t CFGR;
__IO uint32_t CIR; __IO uint32_t CIR;
@@ -434,15 +409,13 @@ typedef struct
__IO uint32_t BDCR; __IO uint32_t BDCR;
__IO uint32_t CSR; __IO uint32_t CSR;
} RCC_TypeDef; } RCC_TypeDef;
/** /**
* @brief Real-Time Clock * @brief Real-Time Clock
*/ */
typedef struct typedef struct {
{
__IO uint32_t CRH; __IO uint32_t CRH;
__IO uint32_t CRL; __IO uint32_t CRL;
__IO uint32_t PRLH; __IO uint32_t PRLH;
@@ -459,8 +432,7 @@ typedef struct
* @brief Serial Peripheral Interface * @brief Serial Peripheral Interface
*/ */
typedef struct typedef struct {
{
__IO uint32_t CR1; __IO uint32_t CR1;
__IO uint32_t CR2; __IO uint32_t CR2;
__IO uint32_t SR; __IO uint32_t SR;
@@ -474,8 +446,7 @@ typedef struct
/** /**
* @brief TIM Timers * @brief TIM Timers
*/ */
typedef struct typedef struct {
{
__IO uint32_t CR1; /*!< TIM control register 1, Address offset: 0x00 */ __IO uint32_t CR1; /*!< TIM control register 1, Address offset: 0x00 */
__IO uint32_t CR2; /*!< TIM control register 2, Address offset: 0x04 */ __IO uint32_t CR2; /*!< TIM control register 2, Address offset: 0x04 */
__IO uint32_t SMCR; /*!< TIM slave Mode Control register, Address offset: 0x08 */ __IO uint32_t SMCR; /*!< TIM slave Mode Control register, Address offset: 0x08 */
@@ -497,15 +468,13 @@ typedef struct
__IO uint32_t DCR; /*!< TIM DMA control register, Address offset: 0x48 */ __IO uint32_t DCR; /*!< TIM DMA control register, Address offset: 0x48 */
__IO uint32_t DMAR; /*!< TIM DMA address for full transfer register, Address offset: 0x4C */ __IO uint32_t DMAR; /*!< TIM DMA address for full transfer register, Address offset: 0x4C */
__IO uint32_t OR; /*!< TIM option register, Address offset: 0x50 */ __IO uint32_t OR; /*!< TIM option register, Address offset: 0x50 */
}TIM_TypeDef; } TIM_TypeDef;
/** /**
* @brief Universal Synchronous Asynchronous Receiver Transmitter * @brief Universal Synchronous Asynchronous Receiver Transmitter
*/ */
typedef struct typedef struct {
{
__IO uint32_t SR; /*!< USART Status register, Address offset: 0x00 */ __IO uint32_t SR; /*!< USART Status register, Address offset: 0x00 */
__IO uint32_t DR; /*!< USART Data register, Address offset: 0x04 */ __IO uint32_t DR; /*!< USART Data register, Address offset: 0x04 */
__IO uint32_t BRR; /*!< USART Baud rate register, Address offset: 0x08 */ __IO uint32_t BRR; /*!< USART Baud rate register, Address offset: 0x08 */
@@ -519,8 +488,7 @@ typedef struct
* @brief Universal Serial Bus Full Speed Device * @brief Universal Serial Bus Full Speed Device
*/ */
typedef struct typedef struct {
{
__IO uint16_t EP0R; /*!< USB Endpoint 0 register, Address offset: 0x00 */ __IO uint16_t EP0R; /*!< USB Endpoint 0 register, Address offset: 0x00 */
__IO uint16_t RESERVED0; /*!< Reserved */ __IO uint16_t RESERVED0; /*!< Reserved */
__IO uint16_t EP1R; /*!< USB Endpoint 1 register, Address offset: 0x04 */ __IO uint16_t EP1R; /*!< USB Endpoint 1 register, Address offset: 0x04 */
@@ -549,13 +517,11 @@ typedef struct
__IO uint16_t RESERVEDC; /*!< Reserved */ __IO uint16_t RESERVEDC; /*!< Reserved */
} USB_TypeDef; } USB_TypeDef;
/** /**
* @brief Window WATCHDOG * @brief Window WATCHDOG
*/ */
typedef struct typedef struct {
{
__IO uint32_t CR; /*!< WWDG Control register, Address offset: 0x00 */ __IO uint32_t CR; /*!< WWDG Control register, Address offset: 0x00 */
__IO uint32_t CFR; /*!< WWDG Configuration register, Address offset: 0x04 */ __IO uint32_t CFR; /*!< WWDG Configuration register, Address offset: 0x04 */
__IO uint32_t SR; /*!< WWDG Status register, Address offset: 0x08 */ __IO uint32_t SR; /*!< WWDG Status register, Address offset: 0x08 */
@@ -569,7 +535,6 @@ typedef struct
* @{ * @{
*/ */
#define FLASH_BASE 0x08000000UL /*!< FLASH base address in the alias region */ #define FLASH_BASE 0x08000000UL /*!< FLASH base address in the alias region */
#define FLASH_BANK1_END 0x0801FFFFUL /*!< FLASH END address of bank1 */ #define FLASH_BANK1_END 0x0801FFFFUL /*!< FLASH END address of bank1 */
#define SRAM_BASE 0x20000000UL /*!< SRAM base address in the alias region */ #define SRAM_BASE 0x20000000UL /*!< SRAM base address in the alias region */
@@ -578,7 +543,6 @@ typedef struct
#define SRAM_BB_BASE 0x22000000UL /*!< SRAM base address in the bit-band region */ #define SRAM_BB_BASE 0x22000000UL /*!< SRAM base address in the bit-band region */
#define PERIPH_BB_BASE 0x42000000UL /*!< Peripheral base address in the bit-band region */ #define PERIPH_BB_BASE 0x42000000UL /*!< Peripheral base address in the bit-band region */
/*!< Peripheral memory map */ /*!< Peripheral memory map */
#define APB1PERIPH_BASE PERIPH_BASE #define APB1PERIPH_BASE PERIPH_BASE
#define APB2PERIPH_BASE (PERIPH_BASE + 0x00010000UL) #define APB2PERIPH_BASE (PERIPH_BASE + 0x00010000UL)
@@ -611,7 +575,6 @@ typedef struct
#define SPI1_BASE (APB2PERIPH_BASE + 0x00003000UL) #define SPI1_BASE (APB2PERIPH_BASE + 0x00003000UL)
#define USART1_BASE (APB2PERIPH_BASE + 0x00003800UL) #define USART1_BASE (APB2PERIPH_BASE + 0x00003800UL)
#define DMA1_BASE (AHBPERIPH_BASE + 0x00000000UL) #define DMA1_BASE (AHBPERIPH_BASE + 0x00000000UL)
#define DMA1_Channel1_BASE (AHBPERIPH_BASE + 0x00000008UL) #define DMA1_Channel1_BASE (AHBPERIPH_BASE + 0x00000008UL)
#define DMA1_Channel2_BASE (AHBPERIPH_BASE + 0x0000001CUL) #define DMA1_Channel2_BASE (AHBPERIPH_BASE + 0x0000001CUL)
@@ -628,15 +591,12 @@ typedef struct
#define UID_BASE 0x1FFFF7E8UL /*!< Unique device ID register base address */ #define UID_BASE 0x1FFFF7E8UL /*!< Unique device ID register base address */
#define OB_BASE 0x1FFFF800UL /*!< Flash Option Bytes base address */ #define OB_BASE 0x1FFFF800UL /*!< Flash Option Bytes base address */
#define DBGMCU_BASE 0xE0042000UL /*!< Debug MCU registers base address */ #define DBGMCU_BASE 0xE0042000UL /*!< Debug MCU registers base address */
/* USB device FS */ /* USB device FS */
#define USB_BASE (APB1PERIPH_BASE + 0x00005C00UL) /*!< USB_IP Peripheral Registers base address */ #define USB_BASE (APB1PERIPH_BASE + 0x00005C00UL) /*!< USB_IP Peripheral Registers base address */
#define USB_PMAADDR (APB1PERIPH_BASE + 0x00006000UL) /*!< USB_IP Packet Memory Area base address */ #define USB_PMAADDR (APB1PERIPH_BASE + 0x00006000UL) /*!< USB_IP Packet Memory Area base address */
/** /**
* @} * @}
*/ */
@@ -687,7 +647,6 @@ typedef struct
#define OB ((OB_TypeDef *)OB_BASE) #define OB ((OB_TypeDef *)OB_BASE)
#define DBGMCU ((DBGMCU_TypeDef *)DBGMCU_BASE) #define DBGMCU ((DBGMCU_TypeDef *)DBGMCU_BASE)
/** /**
* @} * @}
*/ */
@@ -696,7 +655,7 @@ typedef struct
* @{ * @{
*/ */
/** @addtogroup Peripheral_Registers_Bits_Definition /** @addtogroup Peripheral_Registers_Bits_Definition
* @{ * @{
*/ */
@@ -779,7 +738,6 @@ typedef struct
#define PWR_CR_DBP_Msk (0x1UL << PWR_CR_DBP_Pos) /*!< 0x00000100 */ #define PWR_CR_DBP_Msk (0x1UL << PWR_CR_DBP_Pos) /*!< 0x00000100 */
#define PWR_CR_DBP PWR_CR_DBP_Msk /*!< Disable Backup Domain write protection */ #define PWR_CR_DBP PWR_CR_DBP_Msk /*!< Disable Backup Domain write protection */
/******************* Bit definition for PWR_CSR register ********************/ /******************* Bit definition for PWR_CSR register ********************/
#define PWR_CSR_WUF_Pos (0U) #define PWR_CSR_WUF_Pos (0U)
#define PWR_CSR_WUF_Msk (0x1UL << PWR_CSR_WUF_Pos) /*!< 0x00000001 */ #define PWR_CSR_WUF_Msk (0x1UL << PWR_CSR_WUF_Pos) /*!< 0x00000001 */
@@ -929,7 +887,6 @@ typedef struct
#define RCC_CR_PLLRDY_Msk (0x1UL << RCC_CR_PLLRDY_Pos) /*!< 0x02000000 */ #define RCC_CR_PLLRDY_Msk (0x1UL << RCC_CR_PLLRDY_Pos) /*!< 0x02000000 */
#define RCC_CR_PLLRDY RCC_CR_PLLRDY_Msk /*!< PLL clock ready flag */ #define RCC_CR_PLLRDY RCC_CR_PLLRDY_Msk /*!< PLL clock ready flag */
/******************* Bit definition for RCC_CFGR register *******************/ /******************* Bit definition for RCC_CFGR register *******************/
/*!< SW configuration */ /*!< SW configuration */
#define RCC_CFGR_SW_Pos (0U) #define RCC_CFGR_SW_Pos (0U)
@@ -1093,16 +1050,16 @@ typedef struct
#define RCC_CFGR_MCO_HSE 0x06000000U /*!< HSE clock selected as MCO source */ #define RCC_CFGR_MCO_HSE 0x06000000U /*!< HSE clock selected as MCO source */
#define RCC_CFGR_MCO_PLLCLK_DIV2 0x07000000U /*!< PLL clock divided by 2 selected as MCO source */ #define RCC_CFGR_MCO_PLLCLK_DIV2 0x07000000U /*!< PLL clock divided by 2 selected as MCO source */
/* Reference defines */ /* Reference defines */
#define RCC_CFGR_MCOSEL RCC_CFGR_MCO #define RCC_CFGR_MCOSEL RCC_CFGR_MCO
#define RCC_CFGR_MCOSEL_0 RCC_CFGR_MCO_0 #define RCC_CFGR_MCOSEL_0 RCC_CFGR_MCO_0
#define RCC_CFGR_MCOSEL_1 RCC_CFGR_MCO_1 #define RCC_CFGR_MCOSEL_1 RCC_CFGR_MCO_1
#define RCC_CFGR_MCOSEL_2 RCC_CFGR_MCO_2 #define RCC_CFGR_MCOSEL_2 RCC_CFGR_MCO_2
#define RCC_CFGR_MCOSEL_NOCLOCK RCC_CFGR_MCO_NOCLOCK #define RCC_CFGR_MCOSEL_NOCLOCK RCC_CFGR_MCO_NOCLOCK
#define RCC_CFGR_MCOSEL_SYSCLK RCC_CFGR_MCO_SYSCLK #define RCC_CFGR_MCOSEL_SYSCLK RCC_CFGR_MCO_SYSCLK
#define RCC_CFGR_MCOSEL_HSI RCC_CFGR_MCO_HSI #define RCC_CFGR_MCOSEL_HSI RCC_CFGR_MCO_HSI
#define RCC_CFGR_MCOSEL_HSE RCC_CFGR_MCO_HSE #define RCC_CFGR_MCOSEL_HSE RCC_CFGR_MCO_HSE
#define RCC_CFGR_MCOSEL_PLL_DIV2 RCC_CFGR_MCO_PLLCLK_DIV2 #define RCC_CFGR_MCOSEL_PLL_DIV2 RCC_CFGR_MCO_PLLCLK_DIV2
/*!<****************** Bit definition for RCC_CIR register ********************/ /*!<****************** Bit definition for RCC_CIR register ********************/
#define RCC_CIR_LSIRDYF_Pos (0U) #define RCC_CIR_LSIRDYF_Pos (0U)
@@ -1157,7 +1114,6 @@ typedef struct
#define RCC_CIR_CSSC_Msk (0x1UL << RCC_CIR_CSSC_Pos) /*!< 0x00800000 */ #define RCC_CIR_CSSC_Msk (0x1UL << RCC_CIR_CSSC_Pos) /*!< 0x00800000 */
#define RCC_CIR_CSSC RCC_CIR_CSSC_Msk /*!< Clock Security System Interrupt Clear */ #define RCC_CIR_CSSC RCC_CIR_CSSC_Msk /*!< Clock Security System Interrupt Clear */
/***************** Bit definition for RCC_APB2RSTR register *****************/ /***************** Bit definition for RCC_APB2RSTR register *****************/
#define RCC_APB2RSTR_AFIORST_Pos (0U) #define RCC_APB2RSTR_AFIORST_Pos (0U)
#define RCC_APB2RSTR_AFIORST_Msk (0x1UL << RCC_APB2RSTR_AFIORST_Pos) /*!< 0x00000001 */ #define RCC_APB2RSTR_AFIORST_Msk (0x1UL << RCC_APB2RSTR_AFIORST_Pos) /*!< 0x00000001 */
@@ -1192,14 +1148,10 @@ typedef struct
#define RCC_APB2RSTR_USART1RST_Msk (0x1UL << RCC_APB2RSTR_USART1RST_Pos) /*!< 0x00004000 */ #define RCC_APB2RSTR_USART1RST_Msk (0x1UL << RCC_APB2RSTR_USART1RST_Pos) /*!< 0x00004000 */
#define RCC_APB2RSTR_USART1RST RCC_APB2RSTR_USART1RST_Msk /*!< USART1 reset */ #define RCC_APB2RSTR_USART1RST RCC_APB2RSTR_USART1RST_Msk /*!< USART1 reset */
#define RCC_APB2RSTR_IOPERST_Pos (6U) #define RCC_APB2RSTR_IOPERST_Pos (6U)
#define RCC_APB2RSTR_IOPERST_Msk (0x1UL << RCC_APB2RSTR_IOPERST_Pos) /*!< 0x00000040 */ #define RCC_APB2RSTR_IOPERST_Msk (0x1UL << RCC_APB2RSTR_IOPERST_Pos) /*!< 0x00000040 */
#define RCC_APB2RSTR_IOPERST RCC_APB2RSTR_IOPERST_Msk /*!< I/O port E reset */ #define RCC_APB2RSTR_IOPERST RCC_APB2RSTR_IOPERST_Msk /*!< I/O port E reset */
/***************** Bit definition for RCC_APB1RSTR register *****************/ /***************** Bit definition for RCC_APB1RSTR register *****************/
#define RCC_APB1RSTR_TIM2RST_Pos (0U) #define RCC_APB1RSTR_TIM2RST_Pos (0U)
#define RCC_APB1RSTR_TIM2RST_Msk (0x1UL << RCC_APB1RSTR_TIM2RST_Pos) /*!< 0x00000001 */ #define RCC_APB1RSTR_TIM2RST_Msk (0x1UL << RCC_APB1RSTR_TIM2RST_Pos) /*!< 0x00000001 */
@@ -1245,11 +1197,6 @@ typedef struct
#define RCC_APB1RSTR_USBRST_Msk (0x1UL << RCC_APB1RSTR_USBRST_Pos) /*!< 0x00800000 */ #define RCC_APB1RSTR_USBRST_Msk (0x1UL << RCC_APB1RSTR_USBRST_Pos) /*!< 0x00800000 */
#define RCC_APB1RSTR_USBRST RCC_APB1RSTR_USBRST_Msk /*!< USB Device reset */ #define RCC_APB1RSTR_USBRST RCC_APB1RSTR_USBRST_Msk /*!< USB Device reset */
/****************** Bit definition for RCC_AHBENR register ******************/ /****************** Bit definition for RCC_AHBENR register ******************/
#define RCC_AHBENR_DMA1EN_Pos (0U) #define RCC_AHBENR_DMA1EN_Pos (0U)
#define RCC_AHBENR_DMA1EN_Msk (0x1UL << RCC_AHBENR_DMA1EN_Pos) /*!< 0x00000001 */ #define RCC_AHBENR_DMA1EN_Msk (0x1UL << RCC_AHBENR_DMA1EN_Pos) /*!< 0x00000001 */
@@ -1264,9 +1211,6 @@ typedef struct
#define RCC_AHBENR_CRCEN_Msk (0x1UL << RCC_AHBENR_CRCEN_Pos) /*!< 0x00000040 */ #define RCC_AHBENR_CRCEN_Msk (0x1UL << RCC_AHBENR_CRCEN_Pos) /*!< 0x00000040 */
#define RCC_AHBENR_CRCEN RCC_AHBENR_CRCEN_Msk /*!< CRC clock enable */ #define RCC_AHBENR_CRCEN RCC_AHBENR_CRCEN_Msk /*!< CRC clock enable */
/****************** Bit definition for RCC_APB2ENR register *****************/ /****************** Bit definition for RCC_APB2ENR register *****************/
#define RCC_APB2ENR_AFIOEN_Pos (0U) #define RCC_APB2ENR_AFIOEN_Pos (0U)
#define RCC_APB2ENR_AFIOEN_Msk (0x1UL << RCC_APB2ENR_AFIOEN_Pos) /*!< 0x00000001 */ #define RCC_APB2ENR_AFIOEN_Msk (0x1UL << RCC_APB2ENR_AFIOEN_Pos) /*!< 0x00000001 */
@@ -1301,14 +1245,10 @@ typedef struct
#define RCC_APB2ENR_USART1EN_Msk (0x1UL << RCC_APB2ENR_USART1EN_Pos) /*!< 0x00004000 */ #define RCC_APB2ENR_USART1EN_Msk (0x1UL << RCC_APB2ENR_USART1EN_Pos) /*!< 0x00004000 */
#define RCC_APB2ENR_USART1EN RCC_APB2ENR_USART1EN_Msk /*!< USART1 clock enable */ #define RCC_APB2ENR_USART1EN RCC_APB2ENR_USART1EN_Msk /*!< USART1 clock enable */
#define RCC_APB2ENR_IOPEEN_Pos (6U) #define RCC_APB2ENR_IOPEEN_Pos (6U)
#define RCC_APB2ENR_IOPEEN_Msk (0x1UL << RCC_APB2ENR_IOPEEN_Pos) /*!< 0x00000040 */ #define RCC_APB2ENR_IOPEEN_Msk (0x1UL << RCC_APB2ENR_IOPEEN_Pos) /*!< 0x00000040 */
#define RCC_APB2ENR_IOPEEN RCC_APB2ENR_IOPEEN_Msk /*!< I/O port E clock enable */ #define RCC_APB2ENR_IOPEEN RCC_APB2ENR_IOPEEN_Msk /*!< I/O port E clock enable */
/***************** Bit definition for RCC_APB1ENR register ******************/ /***************** Bit definition for RCC_APB1ENR register ******************/
#define RCC_APB1ENR_TIM2EN_Pos (0U) #define RCC_APB1ENR_TIM2EN_Pos (0U)
#define RCC_APB1ENR_TIM2EN_Msk (0x1UL << RCC_APB1ENR_TIM2EN_Pos) /*!< 0x00000001 */ #define RCC_APB1ENR_TIM2EN_Msk (0x1UL << RCC_APB1ENR_TIM2EN_Pos) /*!< 0x00000001 */
@@ -1354,11 +1294,6 @@ typedef struct
#define RCC_APB1ENR_USBEN_Msk (0x1UL << RCC_APB1ENR_USBEN_Pos) /*!< 0x00800000 */ #define RCC_APB1ENR_USBEN_Msk (0x1UL << RCC_APB1ENR_USBEN_Pos) /*!< 0x00800000 */
#define RCC_APB1ENR_USBEN RCC_APB1ENR_USBEN_Msk /*!< USB Device clock enable */ #define RCC_APB1ENR_USBEN RCC_APB1ENR_USBEN_Msk /*!< USB Device clock enable */
/******************* Bit definition for RCC_BDCR register *******************/ /******************* Bit definition for RCC_BDCR register *******************/
#define RCC_BDCR_LSEON_Pos (0U) #define RCC_BDCR_LSEON_Pos (0U)
#define RCC_BDCR_LSEON_Msk (0x1UL << RCC_BDCR_LSEON_Pos) /*!< 0x00000001 */ #define RCC_BDCR_LSEON_Msk (0x1UL << RCC_BDCR_LSEON_Pos) /*!< 0x00000001 */
@@ -1418,8 +1353,6 @@ typedef struct
#define RCC_CSR_LPWRRSTF_Msk (0x1UL << RCC_CSR_LPWRRSTF_Pos) /*!< 0x80000000 */ #define RCC_CSR_LPWRRSTF_Msk (0x1UL << RCC_CSR_LPWRRSTF_Pos) /*!< 0x80000000 */
#define RCC_CSR_LPWRRSTF RCC_CSR_LPWRRSTF_Msk /*!< Low-Power reset flag */ #define RCC_CSR_LPWRRSTF RCC_CSR_LPWRRSTF_Msk /*!< Low-Power reset flag */
/******************************************************************************/ /******************************************************************************/
/* */ /* */
/* General Purpose and Alternate Function I/O */ /* General Purpose and Alternate Function I/O */
@@ -2142,7 +2075,6 @@ typedef struct
#define AFIO_MAPR_SWJ_CFG_DISABLE_Msk (0x1UL << AFIO_MAPR_SWJ_CFG_DISABLE_Pos) /*!< 0x04000000 */ #define AFIO_MAPR_SWJ_CFG_DISABLE_Msk (0x1UL << AFIO_MAPR_SWJ_CFG_DISABLE_Pos) /*!< 0x04000000 */
#define AFIO_MAPR_SWJ_CFG_DISABLE AFIO_MAPR_SWJ_CFG_DISABLE_Msk /*!< JTAG-DP Disabled and SW-DP Disabled */ #define AFIO_MAPR_SWJ_CFG_DISABLE AFIO_MAPR_SWJ_CFG_DISABLE_Msk /*!< JTAG-DP Disabled and SW-DP Disabled */
/***************** Bit definition for AFIO_EXTICR1 register *****************/ /***************** Bit definition for AFIO_EXTICR1 register *****************/
#define AFIO_EXTICR1_EXTI0_Pos (0U) #define AFIO_EXTICR1_EXTI0_Pos (0U)
#define AFIO_EXTICR1_EXTI0_Msk (0xFUL << AFIO_EXTICR1_EXTI0_Pos) /*!< 0x0000000F */ #define AFIO_EXTICR1_EXTI0_Msk (0xFUL << AFIO_EXTICR1_EXTI0_Pos) /*!< 0x0000000F */
@@ -2537,8 +2469,6 @@ typedef struct
/****************** Bit definition for AFIO_MAPR2 register ******************/ /****************** Bit definition for AFIO_MAPR2 register ******************/
/******************************************************************************/ /******************************************************************************/
/* */ /* */
/* External Interrupt/Event Controller */ /* External Interrupt/Event Controller */
@@ -3795,7 +3725,6 @@ typedef struct
#define ADC_DR_ADC2DATA_Msk (0xFFFFUL << ADC_DR_ADC2DATA_Pos) /*!< 0xFFFF0000 */ #define ADC_DR_ADC2DATA_Msk (0xFFFFUL << ADC_DR_ADC2DATA_Pos) /*!< 0xFFFF0000 */
#define ADC_DR_ADC2DATA ADC_DR_ADC2DATA_Msk /*!< ADC group regular conversion data for ADC slave, in multimode */ #define ADC_DR_ADC2DATA ADC_DR_ADC2DATA_Msk /*!< ADC group regular conversion data for ADC slave, in multimode */
/*****************************************************************************/ /*****************************************************************************/
/* */ /* */
/* Timers (TIM) */ /* Timers (TIM) */
@@ -4561,8 +4490,8 @@ typedef struct
#define USB_EPADDR_FIELD USB_EPADDR_FIELD_Msk /*!< EndPoint ADDRess FIELD */ #define USB_EPADDR_FIELD USB_EPADDR_FIELD_Msk /*!< EndPoint ADDRess FIELD */
/* EndPoint REGister MASK (no toggle fields) */ /* EndPoint REGister MASK (no toggle fields) */
#define USB_EPREG_MASK (USB_EP_CTR_RX|USB_EP_SETUP|USB_EP_T_FIELD|USB_EP_KIND|USB_EP_CTR_TX|USB_EPADDR_FIELD) #define USB_EPREG_MASK (USB_EP_CTR_RX | USB_EP_SETUP | USB_EP_T_FIELD | USB_EP_KIND | USB_EP_CTR_TX | USB_EPADDR_FIELD)
/*!< EP_TYPE[1:0] EndPoint TYPE */ /*!< EP_TYPE[1:0] EndPoint TYPE */
#define USB_EP_TYPE_MASK_Pos (9U) #define USB_EP_TYPE_MASK_Pos (9U)
#define USB_EP_TYPE_MASK_Msk (0x3UL << USB_EP_TYPE_MASK_Pos) /*!< 0x00000600 */ #define USB_EP_TYPE_MASK_Msk (0x3UL << USB_EP_TYPE_MASK_Pos) /*!< 0x00000600 */
#define USB_EP_TYPE_MASK USB_EP_TYPE_MASK_Msk /*!< EndPoint TYPE Mask */ #define USB_EP_TYPE_MASK USB_EP_TYPE_MASK_Msk /*!< EndPoint TYPE Mask */
@@ -4580,15 +4509,15 @@ typedef struct
#define USB_EP_TX_VALID 0x00000030U /*!< EndPoint TX VALID */ #define USB_EP_TX_VALID 0x00000030U /*!< EndPoint TX VALID */
#define USB_EPTX_DTOG1 0x00000010U /*!< EndPoint TX Data TOGgle bit1 */ #define USB_EPTX_DTOG1 0x00000010U /*!< EndPoint TX Data TOGgle bit1 */
#define USB_EPTX_DTOG2 0x00000020U /*!< EndPoint TX Data TOGgle bit2 */ #define USB_EPTX_DTOG2 0x00000020U /*!< EndPoint TX Data TOGgle bit2 */
#define USB_EPTX_DTOGMASK (USB_EPTX_STAT|USB_EPREG_MASK) #define USB_EPTX_DTOGMASK (USB_EPTX_STAT | USB_EPREG_MASK)
/*!< STAT_RX[1:0] STATus for RX transfer */ /*!< STAT_RX[1:0] STATus for RX transfer */
#define USB_EP_RX_DIS 0x00000000U /*!< EndPoint RX DISabled */ #define USB_EP_RX_DIS 0x00000000U /*!< EndPoint RX DISabled */
#define USB_EP_RX_STALL 0x00001000U /*!< EndPoint RX STALLed */ #define USB_EP_RX_STALL 0x00001000U /*!< EndPoint RX STALLed */
#define USB_EP_RX_NAK 0x00002000U /*!< EndPoint RX NAKed */ #define USB_EP_RX_NAK 0x00002000U /*!< EndPoint RX NAKed */
#define USB_EP_RX_VALID 0x00003000U /*!< EndPoint RX VALID */ #define USB_EP_RX_VALID 0x00003000U /*!< EndPoint RX VALID */
#define USB_EPRX_DTOG1 0x00001000U /*!< EndPoint RX Data TOGgle bit1 */ #define USB_EPRX_DTOG1 0x00001000U /*!< EndPoint RX Data TOGgle bit1 */
#define USB_EPRX_DTOG2 0x00002000U /*!< EndPoint RX Data TOGgle bit1 */ #define USB_EPRX_DTOG2 0x00002000U /*!< EndPoint RX Data TOGgle bit1 */
#define USB_EPRX_DTOGMASK (USB_EPRX_STAT|USB_EPREG_MASK) #define USB_EPRX_DTOGMASK (USB_EPRX_STAT | USB_EPREG_MASK)
/******************* Bit definition for USB_EP0R register *******************/ /******************* Bit definition for USB_EP0R register *******************/
#define USB_EP0R_EA_Pos (0U) #define USB_EP0R_EA_Pos (0U)
@@ -9863,23 +9792,20 @@ typedef struct
#define FLASH_WRP3_nWRP3_Msk (0xFFUL << FLASH_WRP3_nWRP3_Pos) /*!< 0xFF000000 */ #define FLASH_WRP3_nWRP3_Msk (0xFFUL << FLASH_WRP3_nWRP3_Pos) /*!< 0xFF000000 */
#define FLASH_WRP3_nWRP3 FLASH_WRP3_nWRP3_Msk /*!< Flash memory write protection complemented option bytes */ #define FLASH_WRP3_nWRP3 FLASH_WRP3_nWRP3_Msk /*!< Flash memory write protection complemented option bytes */
/**
* @}
*/
/** /**
* @} * @}
*/ */
/**
* @}
*/
/** @addtogroup Exported_macro /** @addtogroup Exported_macro
* @{ * @{
*/ */
/****************************** ADC Instances *********************************/ /****************************** ADC Instances *********************************/
#define IS_ADC_ALL_INSTANCE(INSTANCE) (((INSTANCE) == ADC1) || \ #define IS_ADC_ALL_INSTANCE(INSTANCE) (((INSTANCE) == ADC1) || ((INSTANCE) == ADC2))
((INSTANCE) == ADC2))
#define IS_ADC_COMMON_INSTANCE(INSTANCE) ((INSTANCE) == ADC12_COMMON) #define IS_ADC_COMMON_INSTANCE(INSTANCE) ((INSTANCE) == ADC12_COMMON)
@@ -9896,20 +9822,12 @@ typedef struct
/****************************** DAC Instances *********************************/ /****************************** DAC Instances *********************************/
/****************************** DMA Instances *********************************/ /****************************** DMA Instances *********************************/
#define IS_DMA_ALL_INSTANCE(INSTANCE) (((INSTANCE) == DMA1_Channel1) || \ #define IS_DMA_ALL_INSTANCE(INSTANCE) \
((INSTANCE) == DMA1_Channel2) || \ (((INSTANCE) == DMA1_Channel1) || ((INSTANCE) == DMA1_Channel2) || ((INSTANCE) == DMA1_Channel3) || ((INSTANCE) == DMA1_Channel4) || ((INSTANCE) == DMA1_Channel5) || ((INSTANCE) == DMA1_Channel6) \
((INSTANCE) == DMA1_Channel3) || \ || ((INSTANCE) == DMA1_Channel7))
((INSTANCE) == DMA1_Channel4) || \
((INSTANCE) == DMA1_Channel5) || \
((INSTANCE) == DMA1_Channel6) || \
((INSTANCE) == DMA1_Channel7))
/******************************* GPIO Instances *******************************/ /******************************* GPIO Instances *******************************/
#define IS_GPIO_ALL_INSTANCE(INSTANCE) (((INSTANCE) == GPIOA) || \ #define IS_GPIO_ALL_INSTANCE(INSTANCE) (((INSTANCE) == GPIOA) || ((INSTANCE) == GPIOB) || ((INSTANCE) == GPIOC) || ((INSTANCE) == GPIOD) || ((INSTANCE) == GPIOE))
((INSTANCE) == GPIOB) || \
((INSTANCE) == GPIOC) || \
((INSTANCE) == GPIOD) || \
((INSTANCE) == GPIOE))
/**************************** GPIO Alternate Function Instances ***************/ /**************************** GPIO Alternate Function Instances ***************/
#define IS_GPIO_AF_INSTANCE(INSTANCE) IS_GPIO_ALL_INSTANCE(INSTANCE) #define IS_GPIO_AF_INSTANCE(INSTANCE) IS_GPIO_ALL_INSTANCE(INSTANCE)
@@ -9918,8 +9836,7 @@ typedef struct
#define IS_GPIO_LOCK_INSTANCE(INSTANCE) IS_GPIO_ALL_INSTANCE(INSTANCE) #define IS_GPIO_LOCK_INSTANCE(INSTANCE) IS_GPIO_ALL_INSTANCE(INSTANCE)
/******************************** I2C Instances *******************************/ /******************************** I2C Instances *******************************/
#define IS_I2C_ALL_INSTANCE(INSTANCE) (((INSTANCE) == I2C1) || \ #define IS_I2C_ALL_INSTANCE(INSTANCE) (((INSTANCE) == I2C1) || ((INSTANCE) == I2C2))
((INSTANCE) == I2C2))
/******************************* SMBUS Instances ******************************/ /******************************* SMBUS Instances ******************************/
#define IS_SMBUS_ALL_INSTANCE IS_I2C_ALL_INSTANCE #define IS_SMBUS_ALL_INSTANCE IS_I2C_ALL_INSTANCE
@@ -9928,226 +9845,98 @@ typedef struct
#define IS_IWDG_ALL_INSTANCE(INSTANCE) ((INSTANCE) == IWDG) #define IS_IWDG_ALL_INSTANCE(INSTANCE) ((INSTANCE) == IWDG)
/******************************** SPI Instances *******************************/ /******************************** SPI Instances *******************************/
#define IS_SPI_ALL_INSTANCE(INSTANCE) (((INSTANCE) == SPI1) || \ #define IS_SPI_ALL_INSTANCE(INSTANCE) (((INSTANCE) == SPI1) || ((INSTANCE) == SPI2))
((INSTANCE) == SPI2))
/****************************** START TIM Instances ***************************/ /****************************** START TIM Instances ***************************/
/****************************** TIM Instances *********************************/ /****************************** TIM Instances *********************************/
#define IS_TIM_INSTANCE(INSTANCE)\ #define IS_TIM_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || ((INSTANCE) == TIM2) || ((INSTANCE) == TIM3) || ((INSTANCE) == TIM4))
(((INSTANCE) == TIM1) || \
((INSTANCE) == TIM2) || \
((INSTANCE) == TIM3) || \
((INSTANCE) == TIM4))
#define IS_TIM_ADVANCED_INSTANCE(INSTANCE) ((INSTANCE) == TIM1) #define IS_TIM_ADVANCED_INSTANCE(INSTANCE) ((INSTANCE) == TIM1)
#define IS_TIM_CC1_INSTANCE(INSTANCE)\ #define IS_TIM_CC1_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || ((INSTANCE) == TIM2) || ((INSTANCE) == TIM3) || ((INSTANCE) == TIM4))
(((INSTANCE) == TIM1) || \
((INSTANCE) == TIM2) || \
((INSTANCE) == TIM3) || \
((INSTANCE) == TIM4))
#define IS_TIM_CC2_INSTANCE(INSTANCE)\ #define IS_TIM_CC2_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || ((INSTANCE) == TIM2) || ((INSTANCE) == TIM3) || ((INSTANCE) == TIM4))
(((INSTANCE) == TIM1) || \
((INSTANCE) == TIM2) || \
((INSTANCE) == TIM3) || \
((INSTANCE) == TIM4))
#define IS_TIM_CC3_INSTANCE(INSTANCE)\ #define IS_TIM_CC3_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || ((INSTANCE) == TIM2) || ((INSTANCE) == TIM3) || ((INSTANCE) == TIM4))
(((INSTANCE) == TIM1) || \
((INSTANCE) == TIM2) || \
((INSTANCE) == TIM3) || \
((INSTANCE) == TIM4))
#define IS_TIM_CC4_INSTANCE(INSTANCE)\ #define IS_TIM_CC4_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || ((INSTANCE) == TIM2) || ((INSTANCE) == TIM3) || ((INSTANCE) == TIM4))
(((INSTANCE) == TIM1) || \
((INSTANCE) == TIM2) || \
((INSTANCE) == TIM3) || \
((INSTANCE) == TIM4))
#define IS_TIM_CLOCKSOURCE_ETRMODE1_INSTANCE(INSTANCE)\ #define IS_TIM_CLOCKSOURCE_ETRMODE1_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || ((INSTANCE) == TIM2) || ((INSTANCE) == TIM3) || ((INSTANCE) == TIM4))
(((INSTANCE) == TIM1) || \
((INSTANCE) == TIM2) || \
((INSTANCE) == TIM3) || \
((INSTANCE) == TIM4))
#define IS_TIM_CLOCKSOURCE_ETRMODE2_INSTANCE(INSTANCE)\ #define IS_TIM_CLOCKSOURCE_ETRMODE2_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || ((INSTANCE) == TIM2) || ((INSTANCE) == TIM3) || ((INSTANCE) == TIM4))
(((INSTANCE) == TIM1) || \
((INSTANCE) == TIM2) || \
((INSTANCE) == TIM3) || \
((INSTANCE) == TIM4))
#define IS_TIM_CLOCKSOURCE_TIX_INSTANCE(INSTANCE)\ #define IS_TIM_CLOCKSOURCE_TIX_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || ((INSTANCE) == TIM2) || ((INSTANCE) == TIM3) || ((INSTANCE) == TIM4))
(((INSTANCE) == TIM1) || \
((INSTANCE) == TIM2) || \
((INSTANCE) == TIM3) || \
((INSTANCE) == TIM4))
#define IS_TIM_CLOCKSOURCE_ITRX_INSTANCE(INSTANCE)\ #define IS_TIM_CLOCKSOURCE_ITRX_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || ((INSTANCE) == TIM2) || ((INSTANCE) == TIM3) || ((INSTANCE) == TIM4))
(((INSTANCE) == TIM1) || \
((INSTANCE) == TIM2) || \
((INSTANCE) == TIM3) || \
((INSTANCE) == TIM4))
#define IS_TIM_OCXREF_CLEAR_INSTANCE(INSTANCE)\ #define IS_TIM_OCXREF_CLEAR_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || ((INSTANCE) == TIM2) || ((INSTANCE) == TIM3) || ((INSTANCE) == TIM4))
(((INSTANCE) == TIM1) || \
((INSTANCE) == TIM2) || \
((INSTANCE) == TIM3) || \
((INSTANCE) == TIM4))
#define IS_TIM_ENCODER_INTERFACE_INSTANCE(INSTANCE)\ #define IS_TIM_ENCODER_INTERFACE_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || ((INSTANCE) == TIM2) || ((INSTANCE) == TIM3) || ((INSTANCE) == TIM4))
(((INSTANCE) == TIM1) || \
((INSTANCE) == TIM2) || \
((INSTANCE) == TIM3) || \
((INSTANCE) == TIM4))
#define IS_TIM_XOR_INSTANCE(INSTANCE)\ #define IS_TIM_XOR_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || ((INSTANCE) == TIM2) || ((INSTANCE) == TIM3) || ((INSTANCE) == TIM4))
(((INSTANCE) == TIM1) || \
((INSTANCE) == TIM2) || \
((INSTANCE) == TIM3) || \
((INSTANCE) == TIM4))
#define IS_TIM_MASTER_INSTANCE(INSTANCE)\ #define IS_TIM_MASTER_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || ((INSTANCE) == TIM2) || ((INSTANCE) == TIM3) || ((INSTANCE) == TIM4))
(((INSTANCE) == TIM1) || \
((INSTANCE) == TIM2) || \
((INSTANCE) == TIM3) || \
((INSTANCE) == TIM4))
#define IS_TIM_SLAVE_INSTANCE(INSTANCE)\ #define IS_TIM_SLAVE_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || ((INSTANCE) == TIM2) || ((INSTANCE) == TIM3) || ((INSTANCE) == TIM4))
(((INSTANCE) == TIM1) || \
((INSTANCE) == TIM2) || \
((INSTANCE) == TIM3) || \
((INSTANCE) == TIM4))
#define IS_TIM_DMABURST_INSTANCE(INSTANCE)\ #define IS_TIM_DMABURST_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || ((INSTANCE) == TIM2) || ((INSTANCE) == TIM3) || ((INSTANCE) == TIM4))
(((INSTANCE) == TIM1) || \
((INSTANCE) == TIM2) || \
((INSTANCE) == TIM3) || \
((INSTANCE) == TIM4))
#define IS_TIM_BREAK_INSTANCE(INSTANCE)\ #define IS_TIM_BREAK_INSTANCE(INSTANCE) ((INSTANCE) == TIM1)
((INSTANCE) == TIM1)
#define IS_TIM_CCX_INSTANCE(INSTANCE, CHANNEL) \ #define IS_TIM_CCX_INSTANCE(INSTANCE, CHANNEL) \
((((INSTANCE) == TIM1) && \ ((((INSTANCE) == TIM1) && (((CHANNEL) == TIM_CHANNEL_1) || ((CHANNEL) == TIM_CHANNEL_2) || ((CHANNEL) == TIM_CHANNEL_3) || ((CHANNEL) == TIM_CHANNEL_4))) \
(((CHANNEL) == TIM_CHANNEL_1) || \ || (((INSTANCE) == TIM2) && (((CHANNEL) == TIM_CHANNEL_1) || ((CHANNEL) == TIM_CHANNEL_2) || ((CHANNEL) == TIM_CHANNEL_3) || ((CHANNEL) == TIM_CHANNEL_4))) \
((CHANNEL) == TIM_CHANNEL_2) || \ || (((INSTANCE) == TIM3) && (((CHANNEL) == TIM_CHANNEL_1) || ((CHANNEL) == TIM_CHANNEL_2) || ((CHANNEL) == TIM_CHANNEL_3) || ((CHANNEL) == TIM_CHANNEL_4))) \
((CHANNEL) == TIM_CHANNEL_3) || \ || (((INSTANCE) == TIM4) && (((CHANNEL) == TIM_CHANNEL_1) || ((CHANNEL) == TIM_CHANNEL_2) || ((CHANNEL) == TIM_CHANNEL_3) || ((CHANNEL) == TIM_CHANNEL_4))))
((CHANNEL) == TIM_CHANNEL_4))) \
|| \
(((INSTANCE) == TIM2) && \
(((CHANNEL) == TIM_CHANNEL_1) || \
((CHANNEL) == TIM_CHANNEL_2) || \
((CHANNEL) == TIM_CHANNEL_3) || \
((CHANNEL) == TIM_CHANNEL_4))) \
|| \
(((INSTANCE) == TIM3) && \
(((CHANNEL) == TIM_CHANNEL_1) || \
((CHANNEL) == TIM_CHANNEL_2) || \
((CHANNEL) == TIM_CHANNEL_3) || \
((CHANNEL) == TIM_CHANNEL_4))) \
|| \
(((INSTANCE) == TIM4) && \
(((CHANNEL) == TIM_CHANNEL_1) || \
((CHANNEL) == TIM_CHANNEL_2) || \
((CHANNEL) == TIM_CHANNEL_3) || \
((CHANNEL) == TIM_CHANNEL_4))))
#define IS_TIM_CCXN_INSTANCE(INSTANCE, CHANNEL) \ #define IS_TIM_CCXN_INSTANCE(INSTANCE, CHANNEL) (((INSTANCE) == TIM1) && (((CHANNEL) == TIM_CHANNEL_1) || ((CHANNEL) == TIM_CHANNEL_2) || ((CHANNEL) == TIM_CHANNEL_3)))
(((INSTANCE) == TIM1) && \
(((CHANNEL) == TIM_CHANNEL_1) || \
((CHANNEL) == TIM_CHANNEL_2) || \
((CHANNEL) == TIM_CHANNEL_3)))
#define IS_TIM_COUNTER_MODE_SELECT_INSTANCE(INSTANCE)\ #define IS_TIM_COUNTER_MODE_SELECT_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || ((INSTANCE) == TIM2) || ((INSTANCE) == TIM3) || ((INSTANCE) == TIM4))
(((INSTANCE) == TIM1) || \
((INSTANCE) == TIM2) || \
((INSTANCE) == TIM3) || \
((INSTANCE) == TIM4))
#define IS_TIM_REPETITION_COUNTER_INSTANCE(INSTANCE)\ #define IS_TIM_REPETITION_COUNTER_INSTANCE(INSTANCE) ((INSTANCE) == TIM1)
((INSTANCE) == TIM1)
#define IS_TIM_CLOCK_DIVISION_INSTANCE(INSTANCE)\ #define IS_TIM_CLOCK_DIVISION_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || ((INSTANCE) == TIM2) || ((INSTANCE) == TIM3) || ((INSTANCE) == TIM4))
(((INSTANCE) == TIM1) || \
((INSTANCE) == TIM2) || \
((INSTANCE) == TIM3) || \
((INSTANCE) == TIM4))
#define IS_TIM_DMA_INSTANCE(INSTANCE)\ #define IS_TIM_DMA_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || ((INSTANCE) == TIM2) || ((INSTANCE) == TIM3) || ((INSTANCE) == TIM4))
(((INSTANCE) == TIM1) || \
((INSTANCE) == TIM2) || \
((INSTANCE) == TIM3) || \
((INSTANCE) == TIM4))
#define IS_TIM_DMA_CC_INSTANCE(INSTANCE)\ #define IS_TIM_DMA_CC_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || ((INSTANCE) == TIM2) || ((INSTANCE) == TIM3) || ((INSTANCE) == TIM4))
(((INSTANCE) == TIM1) || \
((INSTANCE) == TIM2) || \
((INSTANCE) == TIM3) || \
((INSTANCE) == TIM4))
#define IS_TIM_COMMUTATION_EVENT_INSTANCE(INSTANCE)\ #define IS_TIM_COMMUTATION_EVENT_INSTANCE(INSTANCE) ((INSTANCE) == TIM1)
((INSTANCE) == TIM1)
#define IS_TIM_ETR_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || \ #define IS_TIM_ETR_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || ((INSTANCE) == TIM2) || ((INSTANCE) == TIM3) || ((INSTANCE) == TIM4))
((INSTANCE) == TIM2) || \
((INSTANCE) == TIM3) || \
((INSTANCE) == TIM4))
#define IS_TIM_HALL_SENSOR_INTERFACE_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || \ #define IS_TIM_HALL_SENSOR_INTERFACE_INSTANCE(INSTANCE) (((INSTANCE) == TIM1) || ((INSTANCE) == TIM2) || ((INSTANCE) == TIM3) || ((INSTANCE) == TIM4))
((INSTANCE) == TIM2) || \
((INSTANCE) == TIM3) || \
((INSTANCE) == TIM4))
#define IS_TIM_32B_COUNTER_INSTANCE(INSTANCE) 0U #define IS_TIM_32B_COUNTER_INSTANCE(INSTANCE) 0U
/****************************** END TIM Instances *****************************/ /****************************** END TIM Instances *****************************/
/******************** USART Instances : Synchronous mode **********************/ /******************** USART Instances : Synchronous mode **********************/
#define IS_USART_INSTANCE(INSTANCE) (((INSTANCE) == USART1) || \ #define IS_USART_INSTANCE(INSTANCE) (((INSTANCE) == USART1) || ((INSTANCE) == USART2) || ((INSTANCE) == USART3))
((INSTANCE) == USART2) || \
((INSTANCE) == USART3))
/******************** UART Instances : Asynchronous mode **********************/ /******************** UART Instances : Asynchronous mode **********************/
#define IS_UART_INSTANCE(INSTANCE) (((INSTANCE) == USART1) || \ #define IS_UART_INSTANCE(INSTANCE) (((INSTANCE) == USART1) || ((INSTANCE) == USART2) || ((INSTANCE) == USART3))
((INSTANCE) == USART2) || \
((INSTANCE) == USART3))
/******************** UART Instances : Half-Duplex mode **********************/ /******************** UART Instances : Half-Duplex mode **********************/
#define IS_UART_HALFDUPLEX_INSTANCE(INSTANCE) (((INSTANCE) == USART1) || \ #define IS_UART_HALFDUPLEX_INSTANCE(INSTANCE) (((INSTANCE) == USART1) || ((INSTANCE) == USART2) || ((INSTANCE) == USART3))
((INSTANCE) == USART2) || \
((INSTANCE) == USART3))
/******************** UART Instances : LIN mode **********************/ /******************** UART Instances : LIN mode **********************/
#define IS_UART_LIN_INSTANCE(INSTANCE) (((INSTANCE) == USART1) || \ #define IS_UART_LIN_INSTANCE(INSTANCE) (((INSTANCE) == USART1) || ((INSTANCE) == USART2) || ((INSTANCE) == USART3))
((INSTANCE) == USART2) || \
((INSTANCE) == USART3))
/****************** UART Instances : Hardware Flow control ********************/ /****************** UART Instances : Hardware Flow control ********************/
#define IS_UART_HWFLOW_INSTANCE(INSTANCE) (((INSTANCE) == USART1) || \ #define IS_UART_HWFLOW_INSTANCE(INSTANCE) (((INSTANCE) == USART1) || ((INSTANCE) == USART2) || ((INSTANCE) == USART3))
((INSTANCE) == USART2) || \
((INSTANCE) == USART3))
/********************* UART Instances : Smard card mode ***********************/ /********************* UART Instances : Smard card mode ***********************/
#define IS_SMARTCARD_INSTANCE(INSTANCE) (((INSTANCE) == USART1) || \ #define IS_SMARTCARD_INSTANCE(INSTANCE) (((INSTANCE) == USART1) || ((INSTANCE) == USART2) || ((INSTANCE) == USART3))
((INSTANCE) == USART2) || \
((INSTANCE) == USART3))
/*********************** UART Instances : IRDA mode ***************************/ /*********************** UART Instances : IRDA mode ***************************/
#define IS_IRDA_INSTANCE(INSTANCE) (((INSTANCE) == USART1) || \ #define IS_IRDA_INSTANCE(INSTANCE) (((INSTANCE) == USART1) || ((INSTANCE) == USART2) || ((INSTANCE) == USART3))
((INSTANCE) == USART2) || \
((INSTANCE) == USART3))
/***************** UART Instances : Multi-Processor mode **********************/ /***************** UART Instances : Multi-Processor mode **********************/
#define IS_UART_MULTIPROCESSOR_INSTANCE(INSTANCE) (((INSTANCE) == USART1) || \ #define IS_UART_MULTIPROCESSOR_INSTANCE(INSTANCE) (((INSTANCE) == USART1) || ((INSTANCE) == USART2) || ((INSTANCE) == USART3))
((INSTANCE) == USART2) || \
((INSTANCE) == USART3))
/***************** UART Instances : DMA mode available **********************/ /***************** UART Instances : DMA mode available **********************/
#define IS_UART_DMA_INSTANCE(INSTANCE) (((INSTANCE) == USART1) || \ #define IS_UART_DMA_INSTANCE(INSTANCE) (((INSTANCE) == USART1) || ((INSTANCE) == USART2) || ((INSTANCE) == USART3))
((INSTANCE) == USART2) || \
((INSTANCE) == USART3))
/****************************** RTC Instances *********************************/ /****************************** RTC Instances *********************************/
#define IS_RTC_ALL_INSTANCE(INSTANCE) ((INSTANCE) == RTC) #define IS_RTC_ALL_INSTANCE(INSTANCE) ((INSTANCE) == RTC)
@@ -10158,8 +9947,6 @@ typedef struct
/****************************** USB Instances ********************************/ /****************************** USB Instances ********************************/
#define IS_PCD_ALL_INSTANCE(INSTANCE) ((INSTANCE) == USB) #define IS_PCD_ALL_INSTANCE(INSTANCE) ((INSTANCE) == USB)
#define RCC_HSE_MIN 4000000U #define RCC_HSE_MIN 4000000U
#define RCC_HSE_MAX 16000000U #define RCC_HSE_MAX 16000000U
@@ -10194,7 +9981,6 @@ typedef struct
#define CAN1_RX0_IRQn USB_LP_CAN1_RX0_IRQn #define CAN1_RX0_IRQn USB_LP_CAN1_RX0_IRQn
#define USB_LP_IRQn USB_LP_CAN1_RX0_IRQn #define USB_LP_IRQn USB_LP_CAN1_RX0_IRQn
/* Aliases for __IRQHandler */ /* Aliases for __IRQHandler */
#define ADC1_IRQHandler ADC1_2_IRQHandler #define ADC1_IRQHandler ADC1_2_IRQHandler
#define TIM1_BRK_TIM15_IRQHandler TIM1_BRK_IRQHandler #define TIM1_BRK_TIM15_IRQHandler TIM1_BRK_IRQHandler
@@ -10213,7 +9999,6 @@ typedef struct
#define CAN1_RX0_IRQHandler USB_LP_CAN1_RX0_IRQHandler #define CAN1_RX0_IRQHandler USB_LP_CAN1_RX0_IRQHandler
#define USB_LP_IRQHandler USB_LP_CAN1_RX0_IRQHandler #define USB_LP_IRQHandler USB_LP_CAN1_RX0_IRQHandler
/** /**
* @} * @}
*/ */
@@ -10222,13 +10007,10 @@ typedef struct
* @} * @}
*/ */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /* __cplusplus */ #endif /* __cplusplus */
#endif /* __STM32F103xB_H */ #endif /* __STM32F103xB_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View File

@@ -39,7 +39,7 @@
#define __STM32F1XX_H #define __STM32F1XX_H
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
/** @addtogroup Library_configuration_section /** @addtogroup Library_configuration_section
@@ -49,7 +49,7 @@
/** /**
* @brief STM32 Family * @brief STM32 Family
*/ */
#if !defined (STM32F1) #if !defined(STM32F1)
#define STM32F1 #define STM32F1
#endif /* STM32F1 */ #endif /* STM32F1 */
@@ -57,36 +57,35 @@
application application
*/ */
#if !defined (STM32F100xB) && !defined (STM32F100xE) && !defined (STM32F101x6) && \ #if !defined(STM32F100xB) && !defined(STM32F100xE) && !defined(STM32F101x6) && !defined(STM32F101xB) && !defined(STM32F101xE) && !defined(STM32F101xG) && !defined(STM32F102x6) \
!defined (STM32F101xB) && !defined (STM32F101xE) && !defined (STM32F101xG) && !defined (STM32F102x6) && !defined (STM32F102xB) && !defined (STM32F103x6) && \ && !defined(STM32F102xB) && !defined(STM32F103x6) && !defined(STM32F103xB) && !defined(STM32F103xE) && !defined(STM32F103xG) && !defined(STM32F105xC) && !defined(STM32F107xC)
!defined (STM32F103xB) && !defined (STM32F103xE) && !defined (STM32F103xG) && !defined (STM32F105xC) && !defined (STM32F107xC) /* #define STM32F100xB */ /*!< STM32F100C4, STM32F100R4, STM32F100C6, STM32F100R6, STM32F100C8, STM32F100R8, STM32F100V8, STM32F100CB, STM32F100RB and STM32F100VB */
/* #define STM32F100xB */ /*!< STM32F100C4, STM32F100R4, STM32F100C6, STM32F100R6, STM32F100C8, STM32F100R8, STM32F100V8, STM32F100CB, STM32F100RB and STM32F100VB */ /* #define STM32F100xE */ /*!< STM32F100RC, STM32F100VC, STM32F100ZC, STM32F100RD, STM32F100VD, STM32F100ZD, STM32F100RE, STM32F100VE and STM32F100ZE */
/* #define STM32F100xE */ /*!< STM32F100RC, STM32F100VC, STM32F100ZC, STM32F100RD, STM32F100VD, STM32F100ZD, STM32F100RE, STM32F100VE and STM32F100ZE */ /* #define STM32F101x6 */ /*!< STM32F101C4, STM32F101R4, STM32F101T4, STM32F101C6, STM32F101R6 and STM32F101T6 Devices */
/* #define STM32F101x6 */ /*!< STM32F101C4, STM32F101R4, STM32F101T4, STM32F101C6, STM32F101R6 and STM32F101T6 Devices */ /* #define STM32F101xB */ /*!< STM32F101C8, STM32F101R8, STM32F101T8, STM32F101V8, STM32F101CB, STM32F101RB, STM32F101TB and STM32F101VB */
/* #define STM32F101xB */ /*!< STM32F101C8, STM32F101R8, STM32F101T8, STM32F101V8, STM32F101CB, STM32F101RB, STM32F101TB and STM32F101VB */ /* #define STM32F101xE */ /*!< STM32F101RC, STM32F101VC, STM32F101ZC, STM32F101RD, STM32F101VD, STM32F101ZD, STM32F101RE, STM32F101VE and STM32F101ZE */
/* #define STM32F101xE */ /*!< STM32F101RC, STM32F101VC, STM32F101ZC, STM32F101RD, STM32F101VD, STM32F101ZD, STM32F101RE, STM32F101VE and STM32F101ZE */ /* #define STM32F101xG */ /*!< STM32F101RF, STM32F101VF, STM32F101ZF, STM32F101RG, STM32F101VG and STM32F101ZG */
/* #define STM32F101xG */ /*!< STM32F101RF, STM32F101VF, STM32F101ZF, STM32F101RG, STM32F101VG and STM32F101ZG */ /* #define STM32F102x6 */ /*!< STM32F102C4, STM32F102R4, STM32F102C6 and STM32F102R6 */
/* #define STM32F102x6 */ /*!< STM32F102C4, STM32F102R4, STM32F102C6 and STM32F102R6 */ /* #define STM32F102xB */ /*!< STM32F102C8, STM32F102R8, STM32F102CB and STM32F102RB */
/* #define STM32F102xB */ /*!< STM32F102C8, STM32F102R8, STM32F102CB and STM32F102RB */ /* #define STM32F103x6 */ /*!< STM32F103C4, STM32F103R4, STM32F103T4, STM32F103C6, STM32F103R6 and STM32F103T6 */
/* #define STM32F103x6 */ /*!< STM32F103C4, STM32F103R4, STM32F103T4, STM32F103C6, STM32F103R6 and STM32F103T6 */ /* #define STM32F103xB */ /*!< STM32F103C8, STM32F103R8, STM32F103T8, STM32F103V8, STM32F103CB, STM32F103RB, STM32F103TB and STM32F103VB */
/* #define STM32F103xB */ /*!< STM32F103C8, STM32F103R8, STM32F103T8, STM32F103V8, STM32F103CB, STM32F103RB, STM32F103TB and STM32F103VB */ /* #define STM32F103xE */ /*!< STM32F103RC, STM32F103VC, STM32F103ZC, STM32F103RD, STM32F103VD, STM32F103ZD, STM32F103RE, STM32F103VE and STM32F103ZE */
/* #define STM32F103xE */ /*!< STM32F103RC, STM32F103VC, STM32F103ZC, STM32F103RD, STM32F103VD, STM32F103ZD, STM32F103RE, STM32F103VE and STM32F103ZE */ /* #define STM32F103xG */ /*!< STM32F103RF, STM32F103VF, STM32F103ZF, STM32F103RG, STM32F103VG and STM32F103ZG */
/* #define STM32F103xG */ /*!< STM32F103RF, STM32F103VF, STM32F103ZF, STM32F103RG, STM32F103VG and STM32F103ZG */ /* #define STM32F105xC */ /*!< STM32F105R8, STM32F105V8, STM32F105RB, STM32F105VB, STM32F105RC and STM32F105VC */
/* #define STM32F105xC */ /*!< STM32F105R8, STM32F105V8, STM32F105RB, STM32F105VB, STM32F105RC and STM32F105VC */ /* #define STM32F107xC */ /*!< STM32F107RB, STM32F107VB, STM32F107RC and STM32F107VC */
/* #define STM32F107xC */ /*!< STM32F107RB, STM32F107VB, STM32F107RC and STM32F107VC */
#endif #endif
/* Tip: To avoid modifying this file each time you need to switch between these /* Tip: To avoid modifying this file each time you need to switch between these
devices, you can define the device in your toolchain compiler preprocessor. devices, you can define the device in your toolchain compiler preprocessor.
*/ */
#if !defined (USE_HAL_DRIVER) #if !defined(USE_HAL_DRIVER)
/** /**
* @brief Comment the line below if you will not use the peripherals drivers. * @brief 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 In this case, these drivers will not be included and the application code will
be based on direct access to peripherals registers be based on direct access to peripherals registers
*/ */
/*#define USE_HAL_DRIVER */ /*#define USE_HAL_DRIVER */
#endif /* USE_HAL_DRIVER */ #endif /* USE_HAL_DRIVER */
/** /**
@@ -96,10 +95,7 @@
#define __STM32F1_CMSIS_VERSION_SUB1 (0x03) /*!< [23:16] sub1 version */ #define __STM32F1_CMSIS_VERSION_SUB1 (0x03) /*!< [23:16] sub1 version */
#define __STM32F1_CMSIS_VERSION_SUB2 (0x02) /*!< [15:8] sub2 version */ #define __STM32F1_CMSIS_VERSION_SUB2 (0x02) /*!< [15:8] sub2 version */
#define __STM32F1_CMSIS_VERSION_RC (0x00) /*!< [7:0] release candidate */ #define __STM32F1_CMSIS_VERSION_RC (0x00) /*!< [7:0] release candidate */
#define __STM32F1_CMSIS_VERSION ((__STM32F1_CMSIS_VERSION_MAIN << 24)\ #define __STM32F1_CMSIS_VERSION ((__STM32F1_CMSIS_VERSION_MAIN << 24) | (__STM32F1_CMSIS_VERSION_SUB1 << 16) | (__STM32F1_CMSIS_VERSION_SUB2 << 8) | (__STM32F1_CMSIS_VERSION_RC))
|(__STM32F1_CMSIS_VERSION_SUB1 << 16)\
|(__STM32F1_CMSIS_VERSION_SUB2 << 8 )\
|(__STM32F1_CMSIS_VERSION_RC))
/** /**
* @} * @}
@@ -110,35 +106,35 @@
*/ */
#if defined(STM32F100xB) #if defined(STM32F100xB)
#include "stm32f100xb.h" #include "stm32f100xb.h"
#elif defined(STM32F100xE) #elif defined(STM32F100xE)
#include "stm32f100xe.h" #include "stm32f100xe.h"
#elif defined(STM32F101x6) #elif defined(STM32F101x6)
#include "stm32f101x6.h" #include "stm32f101x6.h"
#elif defined(STM32F101xB) #elif defined(STM32F101xB)
#include "stm32f101xb.h" #include "stm32f101xb.h"
#elif defined(STM32F101xE) #elif defined(STM32F101xE)
#include "stm32f101xe.h" #include "stm32f101xe.h"
#elif defined(STM32F101xG) #elif defined(STM32F101xG)
#include "stm32f101xg.h" #include "stm32f101xg.h"
#elif defined(STM32F102x6) #elif defined(STM32F102x6)
#include "stm32f102x6.h" #include "stm32f102x6.h"
#elif defined(STM32F102xB) #elif defined(STM32F102xB)
#include "stm32f102xb.h" #include "stm32f102xb.h"
#elif defined(STM32F103x6) #elif defined(STM32F103x6)
#include "stm32f103x6.h" #include "stm32f103x6.h"
#elif defined(STM32F103xB) #elif defined(STM32F103xB)
#include "stm32f103xb.h" #include "stm32f103xb.h"
#elif defined(STM32F103xE) #elif defined(STM32F103xE)
#include "stm32f103xe.h" #include "stm32f103xe.h"
#elif defined(STM32F103xG) #elif defined(STM32F103xG)
#include "stm32f103xg.h" #include "stm32f103xg.h"
#elif defined(STM32F105xC) #elif defined(STM32F105xC)
#include "stm32f105xc.h" #include "stm32f105xc.h"
#elif defined(STM32F107xC) #elif defined(STM32F107xC)
#include "stm32f107xc.h" #include "stm32f107xc.h"
#else #else
#error "Please select first the target STM32F1xx device used in your application (in stm32f1xx.h file)" #error "Please select first the target STM32F1xx device used in your application (in stm32f1xx.h file)"
#endif #endif
/** /**
@@ -148,30 +144,17 @@
/** @addtogroup Exported_types /** @addtogroup Exported_types
* @{ * @{
*/ */
typedef enum typedef enum { RESET = 0, SET = !RESET } FlagStatus, ITStatus;
{
RESET = 0,
SET = !RESET
} FlagStatus, ITStatus;
typedef enum typedef enum { DISABLE = 0, ENABLE = !DISABLE } FunctionalState;
{
DISABLE = 0,
ENABLE = !DISABLE
} FunctionalState;
#define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE)) #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
typedef enum typedef enum { SUCCESS = 0U, ERROR = !SUCCESS } ErrorStatus;
{
SUCCESS = 0U,
ERROR = !SUCCESS
} ErrorStatus;
/** /**
* @} * @}
*/ */
/** @addtogroup Exported_macros /** @addtogroup Exported_macros
* @{ * @{
*/ */
@@ -191,16 +174,14 @@ typedef enum
#define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL))) #define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL)))
/** /**
* @} * @}
*/ */
#if defined (USE_HAL_DRIVER) #if defined(USE_HAL_DRIVER)
#include "stm32f1xx_hal.h" #include "stm32f1xx_hal.h"
#endif /* USE_HAL_DRIVER */ #endif /* USE_HAL_DRIVER */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /* __cplusplus */ #endif /* __cplusplus */
@@ -214,7 +195,4 @@ typedef enum
* @} * @}
*/ */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

View File

@@ -32,7 +32,7 @@
#define __SYSTEM_STM32F10X_H #define __SYSTEM_STM32F10X_H
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/** @addtogroup STM32F10x_System_Includes /** @addtogroup STM32F10x_System_Includes
@@ -43,7 +43,6 @@
* @} * @}
*/ */
/** @addtogroup STM32F10x_System_Exported_types /** @addtogroup STM32F10x_System_Exported_types
* @{ * @{
*/ */

View File

@@ -1,4 +1,4 @@
/**************************************************************************//** /**************************************************************************/ /**
* @file cmsis_armcc.h * @file cmsis_armcc.h
* @brief CMSIS compiler ARMCC (Arm Compiler 5) header file * @brief CMSIS compiler ARMCC (Arm Compiler 5) header file
* @version V5.0.4 * @version V5.0.4
@@ -25,80 +25,77 @@
#ifndef __CMSIS_ARMCC_H #ifndef __CMSIS_ARMCC_H
#define __CMSIS_ARMCC_H #define __CMSIS_ARMCC_H
#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 400677) #if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 400677)
#error "Please use Arm Compiler Toolchain V4.0.677 or later!" #error "Please use Arm Compiler Toolchain V4.0.677 or later!"
#endif #endif
/* CMSIS compiler control architecture macros */ /* CMSIS compiler control architecture macros */
#if ((defined (__TARGET_ARCH_6_M ) && (__TARGET_ARCH_6_M == 1)) || \ #if ((defined(__TARGET_ARCH_6_M) && (__TARGET_ARCH_6_M == 1)) || (defined(__TARGET_ARCH_6S_M) && (__TARGET_ARCH_6S_M == 1)))
(defined (__TARGET_ARCH_6S_M ) && (__TARGET_ARCH_6S_M == 1)) ) #define __ARM_ARCH_6M__ 1
#define __ARM_ARCH_6M__ 1
#endif #endif
#if (defined (__TARGET_ARCH_7_M ) && (__TARGET_ARCH_7_M == 1)) #if (defined(__TARGET_ARCH_7_M) && (__TARGET_ARCH_7_M == 1))
#define __ARM_ARCH_7M__ 1 #define __ARM_ARCH_7M__ 1
#endif #endif
#if (defined (__TARGET_ARCH_7E_M) && (__TARGET_ARCH_7E_M == 1)) #if (defined(__TARGET_ARCH_7E_M) && (__TARGET_ARCH_7E_M == 1))
#define __ARM_ARCH_7EM__ 1 #define __ARM_ARCH_7EM__ 1
#endif #endif
/* __ARM_ARCH_8M_BASE__ not applicable */ /* __ARM_ARCH_8M_BASE__ not applicable */
/* __ARM_ARCH_8M_MAIN__ not applicable */ /* __ARM_ARCH_8M_MAIN__ not applicable */
/* CMSIS compiler specific defines */ /* CMSIS compiler specific defines */
#ifndef __ASM #ifndef __ASM
#define __ASM __asm #define __ASM __asm
#endif #endif
#ifndef __INLINE #ifndef __INLINE
#define __INLINE __inline #define __INLINE __inline
#endif #endif
#ifndef __STATIC_INLINE #ifndef __STATIC_INLINE
#define __STATIC_INLINE static __inline #define __STATIC_INLINE static __inline
#endif #endif
#ifndef __STATIC_FORCEINLINE #ifndef __STATIC_FORCEINLINE
#define __STATIC_FORCEINLINE static __forceinline #define __STATIC_FORCEINLINE static __forceinline
#endif #endif
#ifndef __NO_RETURN #ifndef __NO_RETURN
#define __NO_RETURN __declspec(noreturn) #define __NO_RETURN __declspec(noreturn)
#endif #endif
#ifndef __USED #ifndef __USED
#define __USED __attribute__((used)) #define __USED __attribute__((used))
#endif #endif
#ifndef __WEAK #ifndef __WEAK
#define __WEAK __attribute__((weak)) #define __WEAK __attribute__((weak))
#endif #endif
#ifndef __PACKED #ifndef __PACKED
#define __PACKED __attribute__((packed)) #define __PACKED __attribute__((packed))
#endif #endif
#ifndef __PACKED_STRUCT #ifndef __PACKED_STRUCT
#define __PACKED_STRUCT __packed struct #define __PACKED_STRUCT __packed struct
#endif #endif
#ifndef __PACKED_UNION #ifndef __PACKED_UNION
#define __PACKED_UNION __packed union #define __PACKED_UNION __packed union
#endif #endif
#ifndef __UNALIGNED_UINT32 /* deprecated */ #ifndef __UNALIGNED_UINT32 /* deprecated */
#define __UNALIGNED_UINT32(x) (*((__packed uint32_t *)(x))) #define __UNALIGNED_UINT32(x) (*((__packed uint32_t *)(x)))
#endif #endif
#ifndef __UNALIGNED_UINT16_WRITE #ifndef __UNALIGNED_UINT16_WRITE
#define __UNALIGNED_UINT16_WRITE(addr, val) ((*((__packed uint16_t *)(addr))) = (val)) #define __UNALIGNED_UINT16_WRITE(addr, val) ((*((__packed uint16_t *)(addr))) = (val))
#endif #endif
#ifndef __UNALIGNED_UINT16_READ #ifndef __UNALIGNED_UINT16_READ
#define __UNALIGNED_UINT16_READ(addr) (*((const __packed uint16_t *)(addr))) #define __UNALIGNED_UINT16_READ(addr) (*((const __packed uint16_t *)(addr)))
#endif #endif
#ifndef __UNALIGNED_UINT32_WRITE #ifndef __UNALIGNED_UINT32_WRITE
#define __UNALIGNED_UINT32_WRITE(addr, val) ((*((__packed uint32_t *)(addr))) = (val)) #define __UNALIGNED_UINT32_WRITE(addr, val) ((*((__packed uint32_t *)(addr))) = (val))
#endif #endif
#ifndef __UNALIGNED_UINT32_READ #ifndef __UNALIGNED_UINT32_READ
#define __UNALIGNED_UINT32_READ(addr) (*((const __packed uint32_t *)(addr))) #define __UNALIGNED_UINT32_READ(addr) (*((const __packed uint32_t *)(addr)))
#endif #endif
#ifndef __ALIGNED #ifndef __ALIGNED
#define __ALIGNED(x) __attribute__((aligned(x))) #define __ALIGNED(x) __attribute__((aligned(x)))
#endif #endif
#ifndef __RESTRICT #ifndef __RESTRICT
#define __RESTRICT __restrict #define __RESTRICT __restrict
#endif #endif
/* ########################### Core Function Access ########################### */ /* ########################### Core Function Access ########################### */
@@ -114,7 +111,6 @@
*/ */
/* intrinsic void __enable_irq(); */ /* intrinsic void __enable_irq(); */
/** /**
\brief Disable IRQ Interrupts \brief Disable IRQ Interrupts
\details Disables IRQ interrupts by setting the I-bit in the CPSR. \details Disables IRQ interrupts by setting the I-bit in the CPSR.
@@ -127,135 +123,112 @@
\details Returns the content of the Control Register. \details Returns the content of the Control Register.
\return Control Register value \return Control Register value
*/ */
__STATIC_INLINE uint32_t __get_CONTROL(void) __STATIC_INLINE uint32_t __get_CONTROL(void) {
{
register uint32_t __regControl __ASM("control"); register uint32_t __regControl __ASM("control");
return(__regControl); return (__regControl);
} }
/** /**
\brief Set Control Register \brief Set Control Register
\details Writes the given value to the Control Register. \details Writes the given value to the Control Register.
\param [in] control Control Register value to set \param [in] control Control Register value to set
*/ */
__STATIC_INLINE void __set_CONTROL(uint32_t control) __STATIC_INLINE void __set_CONTROL(uint32_t control) {
{
register uint32_t __regControl __ASM("control"); register uint32_t __regControl __ASM("control");
__regControl = control; __regControl = control;
} }
/** /**
\brief Get IPSR Register \brief Get IPSR Register
\details Returns the content of the IPSR Register. \details Returns the content of the IPSR Register.
\return IPSR Register value \return IPSR Register value
*/ */
__STATIC_INLINE uint32_t __get_IPSR(void) __STATIC_INLINE uint32_t __get_IPSR(void) {
{
register uint32_t __regIPSR __ASM("ipsr"); register uint32_t __regIPSR __ASM("ipsr");
return(__regIPSR); return (__regIPSR);
} }
/** /**
\brief Get APSR Register \brief Get APSR Register
\details Returns the content of the APSR Register. \details Returns the content of the APSR Register.
\return APSR Register value \return APSR Register value
*/ */
__STATIC_INLINE uint32_t __get_APSR(void) __STATIC_INLINE uint32_t __get_APSR(void) {
{
register uint32_t __regAPSR __ASM("apsr"); register uint32_t __regAPSR __ASM("apsr");
return(__regAPSR); return (__regAPSR);
} }
/** /**
\brief Get xPSR Register \brief Get xPSR Register
\details Returns the content of the xPSR Register. \details Returns the content of the xPSR Register.
\return xPSR Register value \return xPSR Register value
*/ */
__STATIC_INLINE uint32_t __get_xPSR(void) __STATIC_INLINE uint32_t __get_xPSR(void) {
{
register uint32_t __regXPSR __ASM("xpsr"); register uint32_t __regXPSR __ASM("xpsr");
return(__regXPSR); return (__regXPSR);
} }
/** /**
\brief Get Process Stack Pointer \brief Get Process Stack Pointer
\details Returns the current value of the Process Stack Pointer (PSP). \details Returns the current value of the Process Stack Pointer (PSP).
\return PSP Register value \return PSP Register value
*/ */
__STATIC_INLINE uint32_t __get_PSP(void) __STATIC_INLINE uint32_t __get_PSP(void) {
{
register uint32_t __regProcessStackPointer __ASM("psp"); register uint32_t __regProcessStackPointer __ASM("psp");
return(__regProcessStackPointer); return (__regProcessStackPointer);
} }
/** /**
\brief Set Process Stack Pointer \brief Set Process Stack Pointer
\details Assigns the given value to the Process Stack Pointer (PSP). \details Assigns the given value to the Process Stack Pointer (PSP).
\param [in] topOfProcStack Process Stack Pointer value to set \param [in] topOfProcStack Process Stack Pointer value to set
*/ */
__STATIC_INLINE void __set_PSP(uint32_t topOfProcStack) __STATIC_INLINE void __set_PSP(uint32_t topOfProcStack) {
{
register uint32_t __regProcessStackPointer __ASM("psp"); register uint32_t __regProcessStackPointer __ASM("psp");
__regProcessStackPointer = topOfProcStack; __regProcessStackPointer = topOfProcStack;
} }
/** /**
\brief Get Main Stack Pointer \brief Get Main Stack Pointer
\details Returns the current value of the Main Stack Pointer (MSP). \details Returns the current value of the Main Stack Pointer (MSP).
\return MSP Register value \return MSP Register value
*/ */
__STATIC_INLINE uint32_t __get_MSP(void) __STATIC_INLINE uint32_t __get_MSP(void) {
{
register uint32_t __regMainStackPointer __ASM("msp"); register uint32_t __regMainStackPointer __ASM("msp");
return(__regMainStackPointer); return (__regMainStackPointer);
} }
/** /**
\brief Set Main Stack Pointer \brief Set Main Stack Pointer
\details Assigns the given value to the Main Stack Pointer (MSP). \details Assigns the given value to the Main Stack Pointer (MSP).
\param [in] topOfMainStack Main Stack Pointer value to set \param [in] topOfMainStack Main Stack Pointer value to set
*/ */
__STATIC_INLINE void __set_MSP(uint32_t topOfMainStack) __STATIC_INLINE void __set_MSP(uint32_t topOfMainStack) {
{
register uint32_t __regMainStackPointer __ASM("msp"); register uint32_t __regMainStackPointer __ASM("msp");
__regMainStackPointer = topOfMainStack; __regMainStackPointer = topOfMainStack;
} }
/** /**
\brief Get Priority Mask \brief Get Priority Mask
\details Returns the current state of the priority mask bit from the Priority Mask Register. \details Returns the current state of the priority mask bit from the Priority Mask Register.
\return Priority Mask value \return Priority Mask value
*/ */
__STATIC_INLINE uint32_t __get_PRIMASK(void) __STATIC_INLINE uint32_t __get_PRIMASK(void) {
{
register uint32_t __regPriMask __ASM("primask"); register uint32_t __regPriMask __ASM("primask");
return(__regPriMask); return (__regPriMask);
} }
/** /**
\brief Set Priority Mask \brief Set Priority Mask
\details Assigns the given value to the Priority Mask Register. \details Assigns the given value to the Priority Mask Register.
\param [in] priMask Priority Mask \param [in] priMask Priority Mask
*/ */
__STATIC_INLINE void __set_PRIMASK(uint32_t priMask) __STATIC_INLINE void __set_PRIMASK(uint32_t priMask) {
{
register uint32_t __regPriMask __ASM("primask"); register uint32_t __regPriMask __ASM("primask");
__regPriMask = (priMask); __regPriMask = (priMask);
} }
#if ((defined(__ARM_ARCH_7M__) && (__ARM_ARCH_7M__ == 1)) || (defined(__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)))
#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
(defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) )
/** /**
\brief Enable FIQ \brief Enable FIQ
@@ -264,7 +237,6 @@ __STATIC_INLINE void __set_PRIMASK(uint32_t priMask)
*/ */
#define __enable_fault_irq __enable_fiq #define __enable_fault_irq __enable_fiq
/** /**
\brief Disable FIQ \brief Disable FIQ
\details Disables FIQ interrupts by setting the F-bit in the CPSR. \details Disables FIQ interrupts by setting the F-bit in the CPSR.
@@ -272,63 +244,53 @@ __STATIC_INLINE void __set_PRIMASK(uint32_t priMask)
*/ */
#define __disable_fault_irq __disable_fiq #define __disable_fault_irq __disable_fiq
/** /**
\brief Get Base Priority \brief Get Base Priority
\details Returns the current value of the Base Priority register. \details Returns the current value of the Base Priority register.
\return Base Priority register value \return Base Priority register value
*/ */
__STATIC_INLINE uint32_t __get_BASEPRI(void) __STATIC_INLINE uint32_t __get_BASEPRI(void) {
{
register uint32_t __regBasePri __ASM("basepri"); register uint32_t __regBasePri __ASM("basepri");
return(__regBasePri); return (__regBasePri);
} }
/** /**
\brief Set Base Priority \brief Set Base Priority
\details Assigns the given value to the Base Priority register. \details Assigns the given value to the Base Priority register.
\param [in] basePri Base Priority value to set \param [in] basePri Base Priority value to set
*/ */
__STATIC_INLINE void __set_BASEPRI(uint32_t basePri) __STATIC_INLINE void __set_BASEPRI(uint32_t basePri) {
{
register uint32_t __regBasePri __ASM("basepri"); register uint32_t __regBasePri __ASM("basepri");
__regBasePri = (basePri & 0xFFU); __regBasePri = (basePri & 0xFFU);
} }
/** /**
\brief Set Base Priority with condition \brief Set Base Priority with condition
\details Assigns the given value to the Base Priority register only if BASEPRI masking is disabled, \details Assigns the given value to the Base Priority register only if BASEPRI masking is disabled,
or the new value increases the BASEPRI priority level. or the new value increases the BASEPRI priority level.
\param [in] basePri Base Priority value to set \param [in] basePri Base Priority value to set
*/ */
__STATIC_INLINE void __set_BASEPRI_MAX(uint32_t basePri) __STATIC_INLINE void __set_BASEPRI_MAX(uint32_t basePri) {
{
register uint32_t __regBasePriMax __ASM("basepri_max"); register uint32_t __regBasePriMax __ASM("basepri_max");
__regBasePriMax = (basePri & 0xFFU); __regBasePriMax = (basePri & 0xFFU);
} }
/** /**
\brief Get Fault Mask \brief Get Fault Mask
\details Returns the current value of the Fault Mask register. \details Returns the current value of the Fault Mask register.
\return Fault Mask register value \return Fault Mask register value
*/ */
__STATIC_INLINE uint32_t __get_FAULTMASK(void) __STATIC_INLINE uint32_t __get_FAULTMASK(void) {
{
register uint32_t __regFaultMask __ASM("faultmask"); register uint32_t __regFaultMask __ASM("faultmask");
return(__regFaultMask); return (__regFaultMask);
} }
/** /**
\brief Set Fault Mask \brief Set Fault Mask
\details Assigns the given value to the Fault Mask register. \details Assigns the given value to the Fault Mask register.
\param [in] faultMask Fault Mask value to set \param [in] faultMask Fault Mask value to set
*/ */
__STATIC_INLINE void __set_FAULTMASK(uint32_t faultMask) __STATIC_INLINE void __set_FAULTMASK(uint32_t faultMask) {
{
register uint32_t __regFaultMask __ASM("faultmask"); register uint32_t __regFaultMask __ASM("faultmask");
__regFaultMask = (faultMask & (uint32_t)1U); __regFaultMask = (faultMask & (uint32_t)1U);
} }
@@ -336,33 +298,27 @@ __STATIC_INLINE void __set_FAULTMASK(uint32_t faultMask)
#endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ #endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
(defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) ) */ (defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) ) */
/** /**
\brief Get FPSCR \brief Get FPSCR
\details Returns the current value of the Floating Point Status/Control register. \details Returns the current value of the Floating Point Status/Control register.
\return Floating Point Status/Control register value \return Floating Point Status/Control register value
*/ */
__STATIC_INLINE uint32_t __get_FPSCR(void) __STATIC_INLINE uint32_t __get_FPSCR(void) {
{ #if ((defined(__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && (defined(__FPU_USED) && (__FPU_USED == 1U)))
#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
(defined (__FPU_USED ) && (__FPU_USED == 1U)) )
register uint32_t __regfpscr __ASM("fpscr"); register uint32_t __regfpscr __ASM("fpscr");
return(__regfpscr); return (__regfpscr);
#else #else
return(0U); return (0U);
#endif #endif
} }
/** /**
\brief Set FPSCR \brief Set FPSCR
\details Assigns the given value to the Floating Point Status/Control register. \details Assigns the given value to the Floating Point Status/Control register.
\param [in] fpscr Floating Point Status/Control value to set \param [in] fpscr Floating Point Status/Control value to set
*/ */
__STATIC_INLINE void __set_FPSCR(uint32_t fpscr) __STATIC_INLINE void __set_FPSCR(uint32_t fpscr) {
{ #if ((defined(__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && (defined(__FPU_USED) && (__FPU_USED == 1U)))
#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
(defined (__FPU_USED ) && (__FPU_USED == 1U)) )
register uint32_t __regfpscr __ASM("fpscr"); register uint32_t __regfpscr __ASM("fpscr");
__regfpscr = (fpscr); __regfpscr = (fpscr);
#else #else
@@ -370,10 +326,8 @@ __STATIC_INLINE void __set_FPSCR(uint32_t fpscr)
#endif #endif
} }
/*@} end of CMSIS_Core_RegAccFunctions */ /*@} end of CMSIS_Core_RegAccFunctions */
/* ########################## Core Instruction Access ######################### */ /* ########################## Core Instruction Access ######################### */
/** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface /** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface
Access to dedicated instructions Access to dedicated instructions
@@ -386,14 +340,12 @@ __STATIC_INLINE void __set_FPSCR(uint32_t fpscr)
*/ */
#define __NOP __nop #define __NOP __nop
/** /**
\brief Wait For Interrupt \brief Wait For Interrupt
\details Wait For Interrupt is a hint instruction that suspends execution until one of a number of events occurs. \details Wait For Interrupt is a hint instruction that suspends execution until one of a number of events occurs.
*/ */
#define __WFI __wfi #define __WFI __wfi
/** /**
\brief Wait For Event \brief Wait For Event
\details Wait For Event is a hint instruction that permits the processor to enter \details Wait For Event is a hint instruction that permits the processor to enter
@@ -401,24 +353,23 @@ __STATIC_INLINE void __set_FPSCR(uint32_t fpscr)
*/ */
#define __WFE __wfe #define __WFE __wfe
/** /**
\brief Send Event \brief Send Event
\details Send Event is a hint instruction. It causes an event to be signaled to the CPU. \details Send Event is a hint instruction. It causes an event to be signaled to the CPU.
*/ */
#define __SEV __sev #define __SEV __sev
/** /**
\brief Instruction Synchronization Barrier \brief Instruction Synchronization Barrier
\details Instruction Synchronization Barrier flushes the pipeline in the processor, \details Instruction Synchronization Barrier flushes the pipeline in the processor,
so that all instructions following the ISB are fetched from cache or memory, so that all instructions following the ISB are fetched from cache or memory,
after the instruction has been completed. after the instruction has been completed.
*/ */
#define __ISB() do {\ #define __ISB() \
__schedule_barrier();\ do { \
__isb(0xF);\ __schedule_barrier(); \
__schedule_barrier();\ __isb(0xF); \
__schedule_barrier(); \
} while (0U) } while (0U)
/** /**
@@ -426,10 +377,11 @@ __STATIC_INLINE void __set_FPSCR(uint32_t fpscr)
\details Acts as a special kind of Data Memory Barrier. \details Acts as a special kind of Data Memory Barrier.
It completes when all explicit memory accesses before this instruction complete. It completes when all explicit memory accesses before this instruction complete.
*/ */
#define __DSB() do {\ #define __DSB() \
__schedule_barrier();\ do { \
__dsb(0xF);\ __schedule_barrier(); \
__schedule_barrier();\ __dsb(0xF); \
__schedule_barrier(); \
} while (0U) } while (0U)
/** /**
@@ -437,13 +389,13 @@ __STATIC_INLINE void __set_FPSCR(uint32_t fpscr)
\details Ensures the apparent order of the explicit memory operations before \details Ensures the apparent order of the explicit memory operations before
and after the instruction, without ensuring their completion. and after the instruction, without ensuring their completion.
*/ */
#define __DMB() do {\ #define __DMB() \
__schedule_barrier();\ do { \
__dmb(0xF);\ __schedule_barrier(); \
__schedule_barrier();\ __dmb(0xF); \
__schedule_barrier(); \
} while (0U) } while (0U)
/** /**
\brief Reverse byte order (32 bit) \brief Reverse byte order (32 bit)
\details Reverses the byte order in unsigned integer value. For example, 0x12345678 becomes 0x78563412. \details Reverses the byte order in unsigned integer value. For example, 0x12345678 becomes 0x78563412.
@@ -452,7 +404,6 @@ __STATIC_INLINE void __set_FPSCR(uint32_t fpscr)
*/ */
#define __REV __rev #define __REV __rev
/** /**
\brief Reverse byte order (16 bit) \brief Reverse byte order (16 bit)
\details Reverses the byte order within each halfword of a word. For example, 0x12345678 becomes 0x34127856. \details Reverses the byte order within each halfword of a word. For example, 0x12345678 becomes 0x34127856.
@@ -460,14 +411,9 @@ __STATIC_INLINE void __set_FPSCR(uint32_t fpscr)
\return Reversed value \return Reversed value
*/ */
#ifndef __NO_EMBEDDED_ASM #ifndef __NO_EMBEDDED_ASM
__attribute__((section(".rev16_text"))) __STATIC_INLINE __ASM uint32_t __REV16(uint32_t value) __attribute__((section(".rev16_text"))) __STATIC_INLINE __ASM uint32_t __REV16(uint32_t value) { rev16 r0, r0 bx lr }
{
rev16 r0, r0
bx lr
}
#endif #endif
/** /**
\brief Reverse byte order (16 bit) \brief Reverse byte order (16 bit)
\details Reverses the byte order in a 16-bit value and returns the signed 16-bit result. For example, 0x0080 becomes 0x8000. \details Reverses the byte order in a 16-bit value and returns the signed 16-bit result. For example, 0x0080 becomes 0x8000.
@@ -475,14 +421,9 @@ __attribute__((section(".rev16_text"))) __STATIC_INLINE __ASM uint32_t __REV16(u
\return Reversed value \return Reversed value
*/ */
#ifndef __NO_EMBEDDED_ASM #ifndef __NO_EMBEDDED_ASM
__attribute__((section(".revsh_text"))) __STATIC_INLINE __ASM int16_t __REVSH(int16_t value) __attribute__((section(".revsh_text"))) __STATIC_INLINE __ASM int16_t __REVSH(int16_t value) { revsh r0, r0 bx lr }
{
revsh r0, r0
bx lr
}
#endif #endif
/** /**
\brief Rotate Right in unsigned value (32 bit) \brief Rotate Right in unsigned value (32 bit)
\details Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits. \details Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits.
@@ -492,7 +433,6 @@ __attribute__((section(".revsh_text"))) __STATIC_INLINE __ASM int16_t __REVSH(in
*/ */
#define __ROR __ror #define __ROR __ror
/** /**
\brief Breakpoint \brief Breakpoint
\details Causes the processor to enter Debug state. \details Causes the processor to enter Debug state.
@@ -502,25 +442,21 @@ __attribute__((section(".revsh_text"))) __STATIC_INLINE __ASM int16_t __REVSH(in
*/ */
#define __BKPT(value) __breakpoint(value) #define __BKPT(value) __breakpoint(value)
/** /**
\brief Reverse bit order of value \brief Reverse bit order of value
\details Reverses the bit order of the given value. \details Reverses the bit order of the given value.
\param [in] value Value to reverse \param [in] value Value to reverse
\return Reversed value \return Reversed value
*/ */
#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ #if ((defined(__ARM_ARCH_7M__) && (__ARM_ARCH_7M__ == 1)) || (defined(__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)))
(defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) ) #define __RBIT __rbit
#define __RBIT __rbit
#else #else
__attribute__((always_inline)) __STATIC_INLINE uint32_t __RBIT(uint32_t value) __attribute__((always_inline)) __STATIC_INLINE uint32_t __RBIT(uint32_t value) {
{
uint32_t result; uint32_t result;
uint32_t s = (4U /*sizeof(v)*/ * 8U) - 1U; /* extra shift needed at end */ uint32_t s = (4U /*sizeof(v)*/ * 8U) - 1U; /* extra shift needed at end */
result = value; /* r will be reversed bits of v; first get LSB of v */ result = value; /* r will be reversed bits of v; first get LSB of v */
for (value >>= 1U; value != 0U; value >>= 1U) for (value >>= 1U; value != 0U; value >>= 1U) {
{
result <<= 1U; result <<= 1U;
result |= value & 1U; result |= value & 1U;
s--; s--;
@@ -530,7 +466,6 @@ __attribute__((always_inline)) __STATIC_INLINE uint32_t __RBIT(uint32_t value)
} }
#endif #endif
/** /**
\brief Count leading zeros \brief Count leading zeros
\details Counts the number of leading zeros of a data value. \details Counts the number of leading zeros of a data value.
@@ -539,9 +474,7 @@ __attribute__((always_inline)) __STATIC_INLINE uint32_t __RBIT(uint32_t value)
*/ */
#define __CLZ __clz #define __CLZ __clz
#if ((defined(__ARM_ARCH_7M__) && (__ARM_ARCH_7M__ == 1)) || (defined(__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)))
#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \
(defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) )
/** /**
\brief LDR Exclusive (8 bit) \brief LDR Exclusive (8 bit)
@@ -550,12 +483,11 @@ __attribute__((always_inline)) __STATIC_INLINE uint32_t __RBIT(uint32_t value)
\return value of type uint8_t at (*ptr) \return value of type uint8_t at (*ptr)
*/ */
#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020) #if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020)
#define __LDREXB(ptr) ((uint8_t ) __ldrex(ptr)) #define __LDREXB(ptr) ((uint8_t)__ldrex(ptr))
#else #else
#define __LDREXB(ptr) _Pragma("push") _Pragma("diag_suppress 3731") ((uint8_t ) __ldrex(ptr)) _Pragma("pop") #define __LDREXB(ptr) _Pragma("push") _Pragma("diag_suppress 3731")((uint8_t)__ldrex(ptr)) _Pragma("pop")
#endif #endif
/** /**
\brief LDR Exclusive (16 bit) \brief LDR Exclusive (16 bit)
\details Executes a exclusive LDR instruction for 16 bit values. \details Executes a exclusive LDR instruction for 16 bit values.
@@ -563,12 +495,11 @@ __attribute__((always_inline)) __STATIC_INLINE uint32_t __RBIT(uint32_t value)
\return value of type uint16_t at (*ptr) \return value of type uint16_t at (*ptr)
*/ */
#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020) #if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020)
#define __LDREXH(ptr) ((uint16_t) __ldrex(ptr)) #define __LDREXH(ptr) ((uint16_t)__ldrex(ptr))
#else #else
#define __LDREXH(ptr) _Pragma("push") _Pragma("diag_suppress 3731") ((uint16_t) __ldrex(ptr)) _Pragma("pop") #define __LDREXH(ptr) _Pragma("push") _Pragma("diag_suppress 3731")((uint16_t)__ldrex(ptr)) _Pragma("pop")
#endif #endif
/** /**
\brief LDR Exclusive (32 bit) \brief LDR Exclusive (32 bit)
\details Executes a exclusive LDR instruction for 32 bit values. \details Executes a exclusive LDR instruction for 32 bit values.
@@ -576,12 +507,11 @@ __attribute__((always_inline)) __STATIC_INLINE uint32_t __RBIT(uint32_t value)
\return value of type uint32_t at (*ptr) \return value of type uint32_t at (*ptr)
*/ */
#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020) #if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020)
#define __LDREXW(ptr) ((uint32_t ) __ldrex(ptr)) #define __LDREXW(ptr) ((uint32_t)__ldrex(ptr))
#else #else
#define __LDREXW(ptr) _Pragma("push") _Pragma("diag_suppress 3731") ((uint32_t ) __ldrex(ptr)) _Pragma("pop") #define __LDREXW(ptr) _Pragma("push") _Pragma("diag_suppress 3731")((uint32_t)__ldrex(ptr)) _Pragma("pop")
#endif #endif
/** /**
\brief STR Exclusive (8 bit) \brief STR Exclusive (8 bit)
\details Executes a exclusive STR instruction for 8 bit values. \details Executes a exclusive STR instruction for 8 bit values.
@@ -591,12 +521,11 @@ __attribute__((always_inline)) __STATIC_INLINE uint32_t __RBIT(uint32_t value)
\return 1 Function failed \return 1 Function failed
*/ */
#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020) #if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020)
#define __STREXB(value, ptr) __strex(value, ptr) #define __STREXB(value, ptr) __strex(value, ptr)
#else #else
#define __STREXB(value, ptr) _Pragma("push") _Pragma("diag_suppress 3731") __strex(value, ptr) _Pragma("pop") #define __STREXB(value, ptr) _Pragma("push") _Pragma("diag_suppress 3731") __strex(value, ptr) _Pragma("pop")
#endif #endif
/** /**
\brief STR Exclusive (16 bit) \brief STR Exclusive (16 bit)
\details Executes a exclusive STR instruction for 16 bit values. \details Executes a exclusive STR instruction for 16 bit values.
@@ -606,12 +535,11 @@ __attribute__((always_inline)) __STATIC_INLINE uint32_t __RBIT(uint32_t value)
\return 1 Function failed \return 1 Function failed
*/ */
#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020) #if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020)
#define __STREXH(value, ptr) __strex(value, ptr) #define __STREXH(value, ptr) __strex(value, ptr)
#else #else
#define __STREXH(value, ptr) _Pragma("push") _Pragma("diag_suppress 3731") __strex(value, ptr) _Pragma("pop") #define __STREXH(value, ptr) _Pragma("push") _Pragma("diag_suppress 3731") __strex(value, ptr) _Pragma("pop")
#endif #endif
/** /**
\brief STR Exclusive (32 bit) \brief STR Exclusive (32 bit)
\details Executes a exclusive STR instruction for 32 bit values. \details Executes a exclusive STR instruction for 32 bit values.
@@ -621,19 +549,17 @@ __attribute__((always_inline)) __STATIC_INLINE uint32_t __RBIT(uint32_t value)
\return 1 Function failed \return 1 Function failed
*/ */
#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020) #if defined(__ARMCC_VERSION) && (__ARMCC_VERSION < 5060020)
#define __STREXW(value, ptr) __strex(value, ptr) #define __STREXW(value, ptr) __strex(value, ptr)
#else #else
#define __STREXW(value, ptr) _Pragma("push") _Pragma("diag_suppress 3731") __strex(value, ptr) _Pragma("pop") #define __STREXW(value, ptr) _Pragma("push") _Pragma("diag_suppress 3731") __strex(value, ptr) _Pragma("pop")
#endif #endif
/** /**
\brief Remove the exclusive lock \brief Remove the exclusive lock
\details Removes the exclusive lock which is created by LDREX. \details Removes the exclusive lock which is created by LDREX.
*/ */
#define __CLREX __clrex #define __CLREX __clrex
/** /**
\brief Signed Saturate \brief Signed Saturate
\details Saturates a signed value. \details Saturates a signed value.
@@ -643,7 +569,6 @@ __attribute__((always_inline)) __STATIC_INLINE uint32_t __RBIT(uint32_t value)
*/ */
#define __SSAT __ssat #define __SSAT __ssat
/** /**
\brief Unsigned Saturate \brief Unsigned Saturate
\details Saturates an unsigned value. \details Saturates an unsigned value.
@@ -653,7 +578,6 @@ __attribute__((always_inline)) __STATIC_INLINE uint32_t __RBIT(uint32_t value)
*/ */
#define __USAT __usat #define __USAT __usat
/** /**
\brief Rotate Right with Extend (32 bit) \brief Rotate Right with Extend (32 bit)
\details Moves each bit of a bitstring right by one bit. \details Moves each bit of a bitstring right by one bit.
@@ -662,22 +586,16 @@ __attribute__((always_inline)) __STATIC_INLINE uint32_t __RBIT(uint32_t value)
\return Rotated value \return Rotated value
*/ */
#ifndef __NO_EMBEDDED_ASM #ifndef __NO_EMBEDDED_ASM
__attribute__((section(".rrx_text"))) __STATIC_INLINE __ASM uint32_t __RRX(uint32_t value) __attribute__((section(".rrx_text"))) __STATIC_INLINE __ASM uint32_t __RRX(uint32_t value) { rrx r0, r0 bx lr }
{
rrx r0, r0
bx lr
}
#endif #endif
/** /**
\brief LDRT Unprivileged (8 bit) \brief LDRT Unprivileged (8 bit)
\details Executes a Unprivileged LDRT instruction for 8 bit value. \details Executes a Unprivileged LDRT instruction for 8 bit value.
\param [in] ptr Pointer to data \param [in] ptr Pointer to data
\return value of type uint8_t at (*ptr) \return value of type uint8_t at (*ptr)
*/ */
#define __LDRBT(ptr) ((uint8_t ) __ldrt(ptr)) #define __LDRBT(ptr) ((uint8_t)__ldrt(ptr))
/** /**
\brief LDRT Unprivileged (16 bit) \brief LDRT Unprivileged (16 bit)
@@ -685,8 +603,7 @@ __attribute__((section(".rrx_text"))) __STATIC_INLINE __ASM uint32_t __RRX(uint3
\param [in] ptr Pointer to data \param [in] ptr Pointer to data
\return value of type uint16_t at (*ptr) \return value of type uint16_t at (*ptr)
*/ */
#define __LDRHT(ptr) ((uint16_t) __ldrt(ptr)) #define __LDRHT(ptr) ((uint16_t)__ldrt(ptr))
/** /**
\brief LDRT Unprivileged (32 bit) \brief LDRT Unprivileged (32 bit)
@@ -694,8 +611,7 @@ __attribute__((section(".rrx_text"))) __STATIC_INLINE __ASM uint32_t __RRX(uint3
\param [in] ptr Pointer to data \param [in] ptr Pointer to data
\return value of type uint32_t at (*ptr) \return value of type uint32_t at (*ptr)
*/ */
#define __LDRT(ptr) ((uint32_t ) __ldrt(ptr)) #define __LDRT(ptr) ((uint32_t)__ldrt(ptr))
/** /**
\brief STRT Unprivileged (8 bit) \brief STRT Unprivileged (8 bit)
@@ -705,7 +621,6 @@ __attribute__((section(".rrx_text"))) __STATIC_INLINE __ASM uint32_t __RRX(uint3
*/ */
#define __STRBT(value, ptr) __strt(value, ptr) #define __STRBT(value, ptr) __strt(value, ptr)
/** /**
\brief STRT Unprivileged (16 bit) \brief STRT Unprivileged (16 bit)
\details Executes a Unprivileged STRT instruction for 16 bit values. \details Executes a Unprivileged STRT instruction for 16 bit values.
@@ -714,7 +629,6 @@ __attribute__((section(".rrx_text"))) __STATIC_INLINE __ASM uint32_t __RRX(uint3
*/ */
#define __STRHT(value, ptr) __strt(value, ptr) #define __STRHT(value, ptr) __strt(value, ptr)
/** /**
\brief STRT Unprivileged (32 bit) \brief STRT Unprivileged (32 bit)
\details Executes a Unprivileged STRT instruction for 32 bit values. \details Executes a Unprivileged STRT instruction for 32 bit values.
@@ -733,18 +647,13 @@ __attribute__((section(".rrx_text"))) __STATIC_INLINE __ASM uint32_t __RRX(uint3
\param [in] sat Bit position to saturate to (1..32) \param [in] sat Bit position to saturate to (1..32)
\return Saturated value \return Saturated value
*/ */
__attribute__((always_inline)) __STATIC_INLINE int32_t __SSAT(int32_t val, uint32_t sat) __attribute__((always_inline)) __STATIC_INLINE int32_t __SSAT(int32_t val, uint32_t sat) {
{ if ((sat >= 1U) && (sat <= 32U)) {
if ((sat >= 1U) && (sat <= 32U))
{
const int32_t max = (int32_t)((1U << (sat - 1U)) - 1U); const int32_t max = (int32_t)((1U << (sat - 1U)) - 1U);
const int32_t min = -1 - max ; const int32_t min = -1 - max;
if (val > max) if (val > max) {
{
return max; return max;
} } else if (val < min) {
else if (val < min)
{
return min; return min;
} }
} }
@@ -758,17 +667,12 @@ __attribute__((always_inline)) __STATIC_INLINE int32_t __SSAT(int32_t val, uint3
\param [in] sat Bit position to saturate to (0..31) \param [in] sat Bit position to saturate to (0..31)
\return Saturated value \return Saturated value
*/ */
__attribute__((always_inline)) __STATIC_INLINE uint32_t __USAT(int32_t val, uint32_t sat) __attribute__((always_inline)) __STATIC_INLINE uint32_t __USAT(int32_t val, uint32_t sat) {
{ if (sat <= 31U) {
if (sat <= 31U)
{
const uint32_t max = ((1U << sat) - 1U); const uint32_t max = ((1U << sat) - 1U);
if (val > (int32_t)max) if (val > (int32_t)max) {
{
return max; return max;
} } else if (val < 0) {
else if (val < 0)
{
return 0U; return 0U;
} }
} }
@@ -780,14 +684,13 @@ __attribute__((always_inline)) __STATIC_INLINE uint32_t __USAT(int32_t val, uint
/*@}*/ /* end of group CMSIS_Core_InstructionInterface */ /*@}*/ /* end of group CMSIS_Core_InstructionInterface */
/* ################### Compiler specific Intrinsics ########################### */ /* ################### Compiler specific Intrinsics ########################### */
/** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics /** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics
Access to dedicated SIMD instructions Access to dedicated SIMD instructions
@{ @{
*/ */
#if ((defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) ) #if ((defined(__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)))
#define __SADD8 __sadd8 #define __SADD8 __sadd8
#define __QADD8 __qadd8 #define __QADD8 __qadd8
@@ -849,17 +752,13 @@ __attribute__((always_inline)) __STATIC_INLINE uint32_t __USAT(int32_t val, uint
#define __QADD __qadd #define __QADD __qadd
#define __QSUB __qsub #define __QSUB __qsub
#define __PKHBT(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0x0000FFFFUL) | \ #define __PKHBT(ARG1, ARG2, ARG3) (((((uint32_t)(ARG1))) & 0x0000FFFFUL) | ((((uint32_t)(ARG2)) << (ARG3)) & 0xFFFF0000UL))
((((uint32_t)(ARG2)) << (ARG3)) & 0xFFFF0000UL) )
#define __PKHTB(ARG1,ARG2,ARG3) ( ((((uint32_t)(ARG1)) ) & 0xFFFF0000UL) | \ #define __PKHTB(ARG1, ARG2, ARG3) (((((uint32_t)(ARG1))) & 0xFFFF0000UL) | ((((uint32_t)(ARG2)) >> (ARG3)) & 0x0000FFFFUL))
((((uint32_t)(ARG2)) >> (ARG3)) & 0x0000FFFFUL) )
#define __SMMLA(ARG1,ARG2,ARG3) ( (int32_t)((((int64_t)(ARG1) * (ARG2)) + \ #define __SMMLA(ARG1, ARG2, ARG3) ((int32_t)((((int64_t)(ARG1) * (ARG2)) + ((int64_t)(ARG3) << 32U)) >> 32U))
((int64_t)(ARG3) << 32U) ) >> 32U))
#endif /* ((defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) ) */ #endif /* ((defined (__ARM_ARCH_7EM__) && (__ARM_ARCH_7EM__ == 1)) ) */
/*@} end of group CMSIS_SIMD_intrinsics */ /*@} end of group CMSIS_SIMD_intrinsics */
#endif /* __CMSIS_ARMCC_H */ #endif /* __CMSIS_ARMCC_H */

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
/**************************************************************************//** /**************************************************************************/ /**
* @file cmsis_compiler.h * @file cmsis_compiler.h
* @brief CMSIS compiler generic header file * @brief CMSIS compiler generic header file
* @version V5.0.4 * @version V5.0.4
@@ -30,237 +30,234 @@
/* /*
* Arm Compiler 4/5 * Arm Compiler 4/5
*/ */
#if defined ( __CC_ARM ) #if defined(__CC_ARM)
#include "cmsis_armcc.h" #include "cmsis_armcc.h"
/* /*
* Arm Compiler 6 (armclang) * Arm Compiler 6 (armclang)
*/ */
#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
#include "cmsis_armclang.h" #include "cmsis_armclang.h"
/* /*
* GNU Compiler * GNU Compiler
*/ */
#elif defined ( __GNUC__ ) #elif defined(__GNUC__)
#include "cmsis_gcc.h" #include "cmsis_gcc.h"
/* /*
* IAR Compiler * IAR Compiler
*/ */
#elif defined ( __ICCARM__ ) #elif defined(__ICCARM__)
#include <cmsis_iccarm.h> #include <cmsis_iccarm.h>
/* /*
* TI Arm Compiler * TI Arm Compiler
*/ */
#elif defined ( __TI_ARM__ ) #elif defined(__TI_ARM__)
#include <cmsis_ccs.h> #include <cmsis_ccs.h>
#ifndef __ASM
#define __ASM __asm
#endif
#ifndef __INLINE
#define __INLINE inline
#endif
#ifndef __STATIC_INLINE
#define __STATIC_INLINE static inline
#endif
#ifndef __STATIC_FORCEINLINE
#define __STATIC_FORCEINLINE __STATIC_INLINE
#endif
#ifndef __NO_RETURN
#define __NO_RETURN __attribute__((noreturn))
#endif
#ifndef __USED
#define __USED __attribute__((used))
#endif
#ifndef __WEAK
#define __WEAK __attribute__((weak))
#endif
#ifndef __PACKED
#define __PACKED __attribute__((packed))
#endif
#ifndef __PACKED_STRUCT
#define __PACKED_STRUCT struct __attribute__((packed))
#endif
#ifndef __PACKED_UNION
#define __PACKED_UNION union __attribute__((packed))
#endif
#ifndef __UNALIGNED_UINT32 /* deprecated */
struct __attribute__((packed)) T_UINT32 { uint32_t v; };
#define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v)
#endif
#ifndef __UNALIGNED_UINT16_WRITE
__PACKED_STRUCT T_UINT16_WRITE { uint16_t v; };
#define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void*)(addr))->v) = (val))
#endif
#ifndef __UNALIGNED_UINT16_READ
__PACKED_STRUCT T_UINT16_READ { uint16_t v; };
#define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v)
#endif
#ifndef __UNALIGNED_UINT32_WRITE
__PACKED_STRUCT T_UINT32_WRITE { uint32_t v; };
#define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val))
#endif
#ifndef __UNALIGNED_UINT32_READ
__PACKED_STRUCT T_UINT32_READ { uint32_t v; };
#define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v)
#endif
#ifndef __ALIGNED
#define __ALIGNED(x) __attribute__((aligned(x)))
#endif
#ifndef __RESTRICT
#warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored.
#define __RESTRICT
#endif
#ifndef __ASM
#define __ASM __asm
#endif
#ifndef __INLINE
#define __INLINE inline
#endif
#ifndef __STATIC_INLINE
#define __STATIC_INLINE static inline
#endif
#ifndef __STATIC_FORCEINLINE
#define __STATIC_FORCEINLINE __STATIC_INLINE
#endif
#ifndef __NO_RETURN
#define __NO_RETURN __attribute__((noreturn))
#endif
#ifndef __USED
#define __USED __attribute__((used))
#endif
#ifndef __WEAK
#define __WEAK __attribute__((weak))
#endif
#ifndef __PACKED
#define __PACKED __attribute__((packed))
#endif
#ifndef __PACKED_STRUCT
#define __PACKED_STRUCT struct __attribute__((packed))
#endif
#ifndef __PACKED_UNION
#define __PACKED_UNION union __attribute__((packed))
#endif
#ifndef __UNALIGNED_UINT32 /* deprecated */
struct __attribute__((packed)) T_UINT32 {
uint32_t v;
};
#define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v)
#endif
#ifndef __UNALIGNED_UINT16_WRITE
__PACKED_STRUCT T_UINT16_WRITE { uint16_t v; };
#define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val))
#endif
#ifndef __UNALIGNED_UINT16_READ
__PACKED_STRUCT T_UINT16_READ { uint16_t v; };
#define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v)
#endif
#ifndef __UNALIGNED_UINT32_WRITE
__PACKED_STRUCT T_UINT32_WRITE { uint32_t v; };
#define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val))
#endif
#ifndef __UNALIGNED_UINT32_READ
__PACKED_STRUCT T_UINT32_READ { uint32_t v; };
#define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v)
#endif
#ifndef __ALIGNED
#define __ALIGNED(x) __attribute__((aligned(x)))
#endif
#ifndef __RESTRICT
#warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored.
#define __RESTRICT
#endif
/* /*
* TASKING Compiler * TASKING Compiler
*/ */
#elif defined ( __TASKING__ ) #elif defined(__TASKING__)
/* /*
* The CMSIS functions have been implemented as intrinsics in the compiler. * The CMSIS functions have been implemented as intrinsics in the compiler.
* Please use "carm -?i" to get an up to date list of all intrinsics, * Please use "carm -?i" to get an up to date list of all intrinsics,
* Including the CMSIS ones. * Including the CMSIS ones.
*/ */
#ifndef __ASM #ifndef __ASM
#define __ASM __asm #define __ASM __asm
#endif #endif
#ifndef __INLINE #ifndef __INLINE
#define __INLINE inline #define __INLINE inline
#endif #endif
#ifndef __STATIC_INLINE #ifndef __STATIC_INLINE
#define __STATIC_INLINE static inline #define __STATIC_INLINE static inline
#endif #endif
#ifndef __STATIC_FORCEINLINE #ifndef __STATIC_FORCEINLINE
#define __STATIC_FORCEINLINE __STATIC_INLINE #define __STATIC_FORCEINLINE __STATIC_INLINE
#endif #endif
#ifndef __NO_RETURN #ifndef __NO_RETURN
#define __NO_RETURN __attribute__((noreturn)) #define __NO_RETURN __attribute__((noreturn))
#endif #endif
#ifndef __USED #ifndef __USED
#define __USED __attribute__((used)) #define __USED __attribute__((used))
#endif #endif
#ifndef __WEAK #ifndef __WEAK
#define __WEAK __attribute__((weak)) #define __WEAK __attribute__((weak))
#endif #endif
#ifndef __PACKED #ifndef __PACKED
#define __PACKED __packed__ #define __PACKED __packed__
#endif #endif
#ifndef __PACKED_STRUCT #ifndef __PACKED_STRUCT
#define __PACKED_STRUCT struct __packed__ #define __PACKED_STRUCT struct __packed__
#endif #endif
#ifndef __PACKED_UNION #ifndef __PACKED_UNION
#define __PACKED_UNION union __packed__ #define __PACKED_UNION union __packed__
#endif #endif
#ifndef __UNALIGNED_UINT32 /* deprecated */ #ifndef __UNALIGNED_UINT32 /* deprecated */
struct __packed__ T_UINT32 { uint32_t v; }; struct __packed__ T_UINT32 {
#define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v) uint32_t v;
#endif };
#ifndef __UNALIGNED_UINT16_WRITE #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v)
__PACKED_STRUCT T_UINT16_WRITE { uint16_t v; }; #endif
#define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val)) #ifndef __UNALIGNED_UINT16_WRITE
#endif __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; };
#ifndef __UNALIGNED_UINT16_READ #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val))
__PACKED_STRUCT T_UINT16_READ { uint16_t v; }; #endif
#define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v) #ifndef __UNALIGNED_UINT16_READ
#endif __PACKED_STRUCT T_UINT16_READ { uint16_t v; };
#ifndef __UNALIGNED_UINT32_WRITE #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v)
__PACKED_STRUCT T_UINT32_WRITE { uint32_t v; }; #endif
#define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val)) #ifndef __UNALIGNED_UINT32_WRITE
#endif __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; };
#ifndef __UNALIGNED_UINT32_READ #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val))
__PACKED_STRUCT T_UINT32_READ { uint32_t v; }; #endif
#define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v) #ifndef __UNALIGNED_UINT32_READ
#endif __PACKED_STRUCT T_UINT32_READ { uint32_t v; };
#ifndef __ALIGNED #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v)
#define __ALIGNED(x) __align(x) #endif
#endif #ifndef __ALIGNED
#ifndef __RESTRICT #define __ALIGNED(x) __align(x)
#warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored. #endif
#define __RESTRICT #ifndef __RESTRICT
#endif #warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored.
#define __RESTRICT
#endif
/* /*
* COSMIC Compiler * COSMIC Compiler
*/ */
#elif defined ( __CSMC__ ) #elif defined(__CSMC__)
#include <cmsis_csm.h> #include <cmsis_csm.h>
#ifndef __ASM #ifndef __ASM
#define __ASM _asm #define __ASM _asm
#endif #endif
#ifndef __INLINE #ifndef __INLINE
#define __INLINE inline #define __INLINE inline
#endif #endif
#ifndef __STATIC_INLINE #ifndef __STATIC_INLINE
#define __STATIC_INLINE static inline #define __STATIC_INLINE static inline
#endif #endif
#ifndef __STATIC_FORCEINLINE #ifndef __STATIC_FORCEINLINE
#define __STATIC_FORCEINLINE __STATIC_INLINE #define __STATIC_FORCEINLINE __STATIC_INLINE
#endif #endif
#ifndef __NO_RETURN #ifndef __NO_RETURN
// NO RETURN is automatically detected hence no warning here // NO RETURN is automatically detected hence no warning here
#define __NO_RETURN #define __NO_RETURN
#endif #endif
#ifndef __USED #ifndef __USED
#warning No compiler specific solution for __USED. __USED is ignored. #warning No compiler specific solution for __USED. __USED is ignored.
#define __USED #define __USED
#endif #endif
#ifndef __WEAK #ifndef __WEAK
#define __WEAK __weak #define __WEAK __weak
#endif #endif
#ifndef __PACKED #ifndef __PACKED
#define __PACKED @packed #define __PACKED @packed
#endif #endif
#ifndef __PACKED_STRUCT #ifndef __PACKED_STRUCT
#define __PACKED_STRUCT @packed struct #define __PACKED_STRUCT @packed struct
#endif #endif
#ifndef __PACKED_UNION #ifndef __PACKED_UNION
#define __PACKED_UNION @packed union #define __PACKED_UNION @packed union
#endif #endif
#ifndef __UNALIGNED_UINT32 /* deprecated */ #ifndef __UNALIGNED_UINT32 /* deprecated */
@packed struct T_UINT32 { uint32_t v; }; @packed struct T_UINT32 {
#define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v) uint32_t v;
#endif };
#ifndef __UNALIGNED_UINT16_WRITE #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v)
__PACKED_STRUCT T_UINT16_WRITE { uint16_t v; }; #endif
#define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val)) #ifndef __UNALIGNED_UINT16_WRITE
#endif __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; };
#ifndef __UNALIGNED_UINT16_READ #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val))
__PACKED_STRUCT T_UINT16_READ { uint16_t v; }; #endif
#define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v) #ifndef __UNALIGNED_UINT16_READ
#endif __PACKED_STRUCT T_UINT16_READ { uint16_t v; };
#ifndef __UNALIGNED_UINT32_WRITE #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v)
__PACKED_STRUCT T_UINT32_WRITE { uint32_t v; }; #endif
#define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val)) #ifndef __UNALIGNED_UINT32_WRITE
#endif __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; };
#ifndef __UNALIGNED_UINT32_READ #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val))
__PACKED_STRUCT T_UINT32_READ { uint32_t v; }; #endif
#define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v) #ifndef __UNALIGNED_UINT32_READ
#endif __PACKED_STRUCT T_UINT32_READ { uint32_t v; };
#ifndef __ALIGNED #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v)
#warning No compiler specific solution for __ALIGNED. __ALIGNED is ignored. #endif
#define __ALIGNED(x) #ifndef __ALIGNED
#endif #warning No compiler specific solution for __ALIGNED. __ALIGNED is ignored.
#ifndef __RESTRICT #define __ALIGNED(x)
#warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored. #endif
#define __RESTRICT #ifndef __RESTRICT
#endif #warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored.
#define __RESTRICT
#else
#error Unknown compiler.
#endif #endif
#else
#error Unknown compiler.
#endif
#endif /* __CMSIS_COMPILER_H */ #endif /* __CMSIS_COMPILER_H */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
/**************************************************************************//** /**************************************************************************/ /**
* @file cmsis_version.h * @file cmsis_version.h
* @brief CMSIS Core(M) Version definitions * @brief CMSIS Core(M) Version definitions
* @version V5.0.2 * @version V5.0.2
@@ -22,18 +22,17 @@
* limitations under the License. * limitations under the License.
*/ */
#if defined ( __ICCARM__ ) #if defined(__ICCARM__)
#pragma system_include /* treat file as system include file for MISRA check */ #pragma system_include /* treat file as system include file for MISRA check */
#elif defined (__clang__) #elif defined(__clang__)
#pragma clang system_header /* treat file as system include file */ #pragma clang system_header /* treat file as system include file */
#endif #endif
#ifndef __CMSIS_VERSION_H #ifndef __CMSIS_VERSION_H
#define __CMSIS_VERSION_H #define __CMSIS_VERSION_H
/* CMSIS Version definitions */ /* CMSIS Version definitions */
#define __CM_CMSIS_VERSION_MAIN ( 5U) /*!< [31:16] CMSIS Core(M) main version */ #define __CM_CMSIS_VERSION_MAIN (5U) /*!< [31:16] CMSIS Core(M) main version */
#define __CM_CMSIS_VERSION_SUB ( 1U) /*!< [15:0] CMSIS Core(M) sub version */ #define __CM_CMSIS_VERSION_SUB (1U) /*!< [15:0] CMSIS Core(M) sub version */
#define __CM_CMSIS_VERSION ((__CM_CMSIS_VERSION_MAIN << 16U) | \ #define __CM_CMSIS_VERSION ((__CM_CMSIS_VERSION_MAIN << 16U) | __CM_CMSIS_VERSION_SUB) /*!< CMSIS Core(M) version number */
__CM_CMSIS_VERSION_SUB ) /*!< CMSIS Core(M) version number */
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
/**************************************************************************//** /**************************************************************************/ /**
* @file core_sc000.h * @file core_sc000.h
* @brief CMSIS SC000 Core Peripheral Access Layer Header File * @brief CMSIS SC000 Core Peripheral Access Layer Header File
* @version V5.0.5 * @version V5.0.5
@@ -22,10 +22,10 @@
* limitations under the License. * limitations under the License.
*/ */
#if defined ( __ICCARM__ ) #if defined(__ICCARM__)
#pragma system_include /* treat file as system include file for MISRA check */ #pragma system_include /* treat file as system include file for MISRA check */
#elif defined (__clang__) #elif defined(__clang__)
#pragma clang system_header /* treat file as system include file */ #pragma clang system_header /* treat file as system include file */
#endif #endif
#ifndef __CORE_SC000_H_GENERIC #ifndef __CORE_SC000_H_GENERIC
@@ -34,7 +34,7 @@
#include <stdint.h> #include <stdint.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/** /**
@@ -51,7 +51,6 @@
Function-like macros are used to allow more efficient code. Function-like macros are used to allow more efficient code.
*/ */
/******************************************************************************* /*******************************************************************************
* CMSIS definitions * CMSIS definitions
******************************************************************************/ ******************************************************************************/
@@ -65,8 +64,7 @@
/* CMSIS SC000 definitions */ /* CMSIS SC000 definitions */
#define __SC000_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */ #define __SC000_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */
#define __SC000_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */ #define __SC000_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */
#define __SC000_CMSIS_VERSION ((__SC000_CMSIS_VERSION_MAIN << 16U) | \ #define __SC000_CMSIS_VERSION ((__SC000_CMSIS_VERSION_MAIN << 16U) | __SC000_CMSIS_VERSION_SUB) /*!< \deprecated CMSIS HAL version number */
__SC000_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */
#define __CORTEX_SC (000U) /*!< Cortex secure core */ #define __CORTEX_SC (000U) /*!< Cortex secure core */
@@ -75,46 +73,45 @@
*/ */
#define __FPU_USED 0U #define __FPU_USED 0U
#if defined ( __CC_ARM ) #if defined(__CC_ARM)
#if defined __TARGET_FPU_VFP #if defined __TARGET_FPU_VFP
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
#endif #endif
#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
#if defined __ARM_PCS_VFP #if defined __ARM_PCS_VFP
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
#endif #endif
#elif defined ( __GNUC__ ) #elif defined(__GNUC__)
#if defined (__VFP_FP__) && !defined(__SOFTFP__) #if defined(__VFP_FP__) && !defined(__SOFTFP__)
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
#endif #endif
#elif defined ( __ICCARM__ ) #elif defined(__ICCARM__)
#if defined __ARMVFP__ #if defined __ARMVFP__
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
#endif #endif
#elif defined ( __TI_ARM__ ) #elif defined(__TI_ARM__)
#if defined __TI_VFP_SUPPORT__ #if defined __TI_VFP_SUPPORT__
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
#endif #endif
#elif defined ( __TASKING__ ) #elif defined(__TASKING__)
#if defined __FPU_VFP__ #if defined __FPU_VFP__
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
#endif #endif
#elif defined ( __CSMC__ ) #elif defined(__CSMC__)
#if ( __CSMC__ & 0x400U) #if (__CSMC__ & 0x400U)
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
#endif #endif
#endif #endif
#include "cmsis_compiler.h" /* CMSIS compiler specific defines */ #include "cmsis_compiler.h" /* CMSIS compiler specific defines */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
@@ -127,30 +124,30 @@
#define __CORE_SC000_H_DEPENDANT #define __CORE_SC000_H_DEPENDANT
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/* check device defines and use defaults */ /* check device defines and use defaults */
#if defined __CHECK_DEVICE_DEFINES #if defined __CHECK_DEVICE_DEFINES
#ifndef __SC000_REV #ifndef __SC000_REV
#define __SC000_REV 0x0000U #define __SC000_REV 0x0000U
#warning "__SC000_REV not defined in device header file; using default!" #warning "__SC000_REV not defined in device header file; using default!"
#endif #endif
#ifndef __MPU_PRESENT #ifndef __MPU_PRESENT
#define __MPU_PRESENT 0U #define __MPU_PRESENT 0U
#warning "__MPU_PRESENT not defined in device header file; using default!" #warning "__MPU_PRESENT not defined in device header file; using default!"
#endif #endif
#ifndef __NVIC_PRIO_BITS #ifndef __NVIC_PRIO_BITS
#define __NVIC_PRIO_BITS 2U #define __NVIC_PRIO_BITS 2U
#warning "__NVIC_PRIO_BITS not defined in device header file; using default!" #warning "__NVIC_PRIO_BITS not defined in device header file; using default!"
#endif #endif
#ifndef __Vendor_SysTickConfig #ifndef __Vendor_SysTickConfig
#define __Vendor_SysTickConfig 0U #define __Vendor_SysTickConfig 0U
#warning "__Vendor_SysTickConfig not defined in device header file; using default!" #warning "__Vendor_SysTickConfig not defined in device header file; using default!"
#endif #endif
#endif #endif
/* IO definitions (access restrictions to peripheral registers) */ /* IO definitions (access restrictions to peripheral registers) */
@@ -162,9 +159,9 @@
\li for automatic generation of peripheral register debug information. \li for automatic generation of peripheral register debug information.
*/ */
#ifdef __cplusplus #ifdef __cplusplus
#define __I volatile /*!< Defines 'read only' permissions */ #define __I volatile /*!< Defines 'read only' permissions */
#else #else
#define __I volatile const /*!< Defines 'read only' permissions */ #define __I volatile const /*!< Defines 'read only' permissions */
#endif #endif
#define __O volatile /*!< Defines 'write only' permissions */ #define __O volatile /*!< Defines 'write only' permissions */
#define __IO volatile /*!< Defines 'read / write' permissions */ #define __IO volatile /*!< Defines 'read / write' permissions */
@@ -176,8 +173,6 @@
/*@} end of group SC000 */ /*@} end of group SC000 */
/******************************************************************************* /*******************************************************************************
* Register Abstraction * Register Abstraction
Core Register contain: Core Register contain:
@@ -202,15 +197,13 @@
/** /**
\brief Union type to access the Application Program Status Register (APSR). \brief Union type to access the Application Program Status Register (APSR).
*/ */
typedef union typedef union {
{ struct {
struct uint32_t _reserved0 : 28; /*!< bit: 0..27 Reserved */
{ uint32_t V : 1; /*!< bit: 28 Overflow condition code flag */
uint32_t _reserved0:28; /*!< bit: 0..27 Reserved */ uint32_t C : 1; /*!< bit: 29 Carry condition code flag */
uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ uint32_t Z : 1; /*!< bit: 30 Zero condition code flag */
uint32_t C:1; /*!< bit: 29 Carry condition code flag */ uint32_t N : 1; /*!< bit: 31 Negative condition code flag */
uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
uint32_t N:1; /*!< bit: 31 Negative condition code flag */
} b; /*!< Structure used for bit access */ } b; /*!< Structure used for bit access */
uint32_t w; /*!< Type used for word access */ uint32_t w; /*!< Type used for word access */
} APSR_Type; } APSR_Type;
@@ -228,16 +221,13 @@ typedef union
#define APSR_V_Pos 28U /*!< APSR: V Position */ #define APSR_V_Pos 28U /*!< APSR: V Position */
#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */ #define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */
/** /**
\brief Union type to access the Interrupt Program Status Register (IPSR). \brief Union type to access the Interrupt Program Status Register (IPSR).
*/ */
typedef union typedef union {
{ struct {
struct uint32_t ISR : 9; /*!< bit: 0.. 8 Exception number */
{ uint32_t _reserved0 : 23; /*!< bit: 9..31 Reserved */
uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */
uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */
} b; /*!< Structure used for bit access */ } b; /*!< Structure used for bit access */
uint32_t w; /*!< Type used for word access */ uint32_t w; /*!< Type used for word access */
} IPSR_Type; } IPSR_Type;
@@ -246,22 +236,19 @@ typedef union
#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */ #define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */
#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */ #define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */
/** /**
\brief Union type to access the Special-Purpose Program Status Registers (xPSR). \brief Union type to access the Special-Purpose Program Status Registers (xPSR).
*/ */
typedef union typedef union {
{ struct {
struct uint32_t ISR : 9; /*!< bit: 0.. 8 Exception number */
{ uint32_t _reserved0 : 15; /*!< bit: 9..23 Reserved */
uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ uint32_t T : 1; /*!< bit: 24 Thumb bit (read 0) */
uint32_t _reserved0:15; /*!< bit: 9..23 Reserved */ uint32_t _reserved1 : 3; /*!< bit: 25..27 Reserved */
uint32_t T:1; /*!< bit: 24 Thumb bit (read 0) */ uint32_t V : 1; /*!< bit: 28 Overflow condition code flag */
uint32_t _reserved1:3; /*!< bit: 25..27 Reserved */ uint32_t C : 1; /*!< bit: 29 Carry condition code flag */
uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ uint32_t Z : 1; /*!< bit: 30 Zero condition code flag */
uint32_t C:1; /*!< bit: 29 Carry condition code flag */ uint32_t N : 1; /*!< bit: 31 Negative condition code flag */
uint32_t Z:1; /*!< bit: 30 Zero condition code flag */
uint32_t N:1; /*!< bit: 31 Negative condition code flag */
} b; /*!< Structure used for bit access */ } b; /*!< Structure used for bit access */
uint32_t w; /*!< Type used for word access */ uint32_t w; /*!< Type used for word access */
} xPSR_Type; } xPSR_Type;
@@ -285,17 +272,14 @@ typedef union
#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */ #define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */
#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */ #define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */
/** /**
\brief Union type to access the Control Registers (CONTROL). \brief Union type to access the Control Registers (CONTROL).
*/ */
typedef union typedef union {
{ struct {
struct uint32_t _reserved0 : 1; /*!< bit: 0 Reserved */
{ uint32_t SPSEL : 1; /*!< bit: 1 Stack to be used */
uint32_t _reserved0:1; /*!< bit: 0 Reserved */ uint32_t _reserved1 : 30; /*!< bit: 2..31 Reserved */
uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */
uint32_t _reserved1:30; /*!< bit: 2..31 Reserved */
} b; /*!< Structure used for bit access */ } b; /*!< Structure used for bit access */
uint32_t w; /*!< Type used for word access */ uint32_t w; /*!< Type used for word access */
} CONTROL_Type; } CONTROL_Type;
@@ -306,7 +290,6 @@ typedef union
/*@} end of group CMSIS_CORE */ /*@} end of group CMSIS_CORE */
/** /**
\ingroup CMSIS_core_register \ingroup CMSIS_core_register
\defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC) \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC)
@@ -317,8 +300,7 @@ typedef union
/** /**
\brief Structure type to access the Nested Vectored Interrupt Controller (NVIC). \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC).
*/ */
typedef struct typedef struct {
{
__IOM uint32_t ISER[1U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */ __IOM uint32_t ISER[1U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */
uint32_t RESERVED0[31U]; uint32_t RESERVED0[31U];
__IOM uint32_t ICER[1U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */ __IOM uint32_t ICER[1U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */
@@ -333,7 +315,6 @@ typedef struct
/*@} end of group CMSIS_NVIC */ /*@} end of group CMSIS_NVIC */
/** /**
\ingroup CMSIS_core_register \ingroup CMSIS_core_register
\defgroup CMSIS_SCB System Control Block (SCB) \defgroup CMSIS_SCB System Control Block (SCB)
@@ -344,8 +325,7 @@ typedef struct
/** /**
\brief Structure type to access the System Control Block (SCB). \brief Structure type to access the System Control Block (SCB).
*/ */
typedef struct typedef struct {
{
__IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */ __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */
__IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */ __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */
__IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */ __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */
@@ -446,7 +426,6 @@ typedef struct
/*@} end of group CMSIS_SCB */ /*@} end of group CMSIS_SCB */
/** /**
\ingroup CMSIS_core_register \ingroup CMSIS_core_register
\defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB) \defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB)
@@ -457,8 +436,7 @@ typedef struct
/** /**
\brief Structure type to access the System Control and ID Register not in the SCB. \brief Structure type to access the System Control and ID Register not in the SCB.
*/ */
typedef struct typedef struct {
{
uint32_t RESERVED0[2U]; uint32_t RESERVED0[2U];
__IOM uint32_t ACTLR; /*!< Offset: 0x008 (R/W) Auxiliary Control Register */ __IOM uint32_t ACTLR; /*!< Offset: 0x008 (R/W) Auxiliary Control Register */
} SCnSCB_Type; } SCnSCB_Type;
@@ -469,7 +447,6 @@ typedef struct
/*@} end of group CMSIS_SCnotSCB */ /*@} end of group CMSIS_SCnotSCB */
/** /**
\ingroup CMSIS_core_register \ingroup CMSIS_core_register
\defgroup CMSIS_SysTick System Tick Timer (SysTick) \defgroup CMSIS_SysTick System Tick Timer (SysTick)
@@ -480,8 +457,7 @@ typedef struct
/** /**
\brief Structure type to access the System Timer (SysTick). \brief Structure type to access the System Timer (SysTick).
*/ */
typedef struct typedef struct {
{
__IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */ __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */
__IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */ __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */
__IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */ __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */
@@ -521,7 +497,7 @@ typedef struct
/*@} end of group CMSIS_SysTick */ /*@} end of group CMSIS_SysTick */
#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) #if defined(__MPU_PRESENT) && (__MPU_PRESENT == 1U)
/** /**
\ingroup CMSIS_core_register \ingroup CMSIS_core_register
\defgroup CMSIS_MPU Memory Protection Unit (MPU) \defgroup CMSIS_MPU Memory Protection Unit (MPU)
@@ -532,8 +508,7 @@ typedef struct
/** /**
\brief Structure type to access the Memory Protection Unit (MPU). \brief Structure type to access the Memory Protection Unit (MPU).
*/ */
typedef struct typedef struct {
{
__IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */ __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */
__IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */ __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */
__IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region RNRber Register */ __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region RNRber Register */
@@ -609,7 +584,6 @@ typedef struct
/*@} end of group CMSIS_MPU */ /*@} end of group CMSIS_MPU */
#endif #endif
/** /**
\ingroup CMSIS_core_register \ingroup CMSIS_core_register
\defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug) \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug)
@@ -619,7 +593,6 @@ typedef struct
*/ */
/*@} end of group CMSIS_CoreDebug */ /*@} end of group CMSIS_CoreDebug */
/** /**
\ingroup CMSIS_core_register \ingroup CMSIS_core_register
\defgroup CMSIS_core_bitfield Core register bit field macros \defgroup CMSIS_core_bitfield Core register bit field macros
@@ -633,7 +606,7 @@ typedef struct
\param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type. \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type.
\return Masked and shifted value. \return Masked and shifted value.
*/ */
#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk) #define _VAL2FLD(field, value) (((uint32_t)(value) << field##_Pos) & field##_Msk)
/** /**
\brief Mask and shift a register value to extract a bit filed value. \brief Mask and shift a register value to extract a bit filed value.
@@ -641,11 +614,10 @@ typedef struct
\param[in] value Value of register. This parameter is interpreted as an uint32_t type. \param[in] value Value of register. This parameter is interpreted as an uint32_t type.
\return Masked and shifted bit field value. \return Masked and shifted bit field value.
*/ */
#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos) #define _FLD2VAL(field, value) (((uint32_t)(value)&field##_Msk) >> field##_Pos)
/*@} end of group CMSIS_core_bitfield */ /*@} end of group CMSIS_core_bitfield */
/** /**
\ingroup CMSIS_core_register \ingroup CMSIS_core_register
\defgroup CMSIS_core_base Core Definitions \defgroup CMSIS_core_base Core Definitions
@@ -659,20 +631,18 @@ typedef struct
#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */ #define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */
#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */ #define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */
#define SCnSCB ((SCnSCB_Type *) SCS_BASE ) /*!< System control Register not in SCB */ #define SCnSCB ((SCnSCB_Type *)SCS_BASE) /*!< System control Register not in SCB */
#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */ #define SCB ((SCB_Type *)SCB_BASE) /*!< SCB configuration struct */
#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */ #define SysTick ((SysTick_Type *)SysTick_BASE) /*!< SysTick configuration struct */
#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */ #define NVIC ((NVIC_Type *)NVIC_BASE) /*!< NVIC configuration struct */
#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) #if defined(__MPU_PRESENT) && (__MPU_PRESENT == 1U)
#define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */ #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */
#define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */ #define MPU ((MPU_Type *)MPU_BASE) /*!< Memory Protection Unit */
#endif #endif
/*@} */ /*@} */
/******************************************************************************* /*******************************************************************************
* Hardware Abstraction Layer * Hardware Abstraction Layer
Core Function Interface contains: Core Function Interface contains:
@@ -684,8 +654,6 @@ typedef struct
\defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference
*/ */
/* ########################## NVIC functions #################################### */ /* ########################## NVIC functions #################################### */
/** /**
\ingroup CMSIS_Core_FunctionInterface \ingroup CMSIS_Core_FunctionInterface
@@ -695,50 +663,47 @@ typedef struct
*/ */
#ifdef CMSIS_NVIC_VIRTUAL #ifdef CMSIS_NVIC_VIRTUAL
#ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE
#define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h" #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h"
#endif #endif
#include CMSIS_NVIC_VIRTUAL_HEADER_FILE #include CMSIS_NVIC_VIRTUAL_HEADER_FILE
#else #else
/*#define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping not available for SC000 */ /*#define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping not available for SC000 */
/*#define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping not available for SC000 */ /*#define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping not available for SC000 */
#define NVIC_EnableIRQ __NVIC_EnableIRQ #define NVIC_EnableIRQ __NVIC_EnableIRQ
#define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ
#define NVIC_DisableIRQ __NVIC_DisableIRQ #define NVIC_DisableIRQ __NVIC_DisableIRQ
#define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ
#define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ
#define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ
/*#define NVIC_GetActive __NVIC_GetActive not available for SC000 */ /*#define NVIC_GetActive __NVIC_GetActive not available for SC000 */
#define NVIC_SetPriority __NVIC_SetPriority #define NVIC_SetPriority __NVIC_SetPriority
#define NVIC_GetPriority __NVIC_GetPriority #define NVIC_GetPriority __NVIC_GetPriority
#define NVIC_SystemReset __NVIC_SystemReset #define NVIC_SystemReset __NVIC_SystemReset
#endif /* CMSIS_NVIC_VIRTUAL */ #endif /* CMSIS_NVIC_VIRTUAL */
#ifdef CMSIS_VECTAB_VIRTUAL #ifdef CMSIS_VECTAB_VIRTUAL
#ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE
#define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h" #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h"
#endif #endif
#include CMSIS_VECTAB_VIRTUAL_HEADER_FILE #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE
#else #else
#define NVIC_SetVector __NVIC_SetVector #define NVIC_SetVector __NVIC_SetVector
#define NVIC_GetVector __NVIC_GetVector #define NVIC_GetVector __NVIC_GetVector
#endif /* (CMSIS_VECTAB_VIRTUAL) */ #endif /* (CMSIS_VECTAB_VIRTUAL) */
#define NVIC_USER_IRQ_OFFSET 16 #define NVIC_USER_IRQ_OFFSET 16
/* The following EXC_RETURN values are saved the LR on exception entry */ /* The following EXC_RETURN values are saved the LR on exception entry */
#define EXC_RETURN_HANDLER (0xFFFFFFF1UL) /* return to Handler mode, uses MSP after return */ #define EXC_RETURN_HANDLER (0xFFFFFFF1UL) /* return to Handler mode, uses MSP after return */
#define EXC_RETURN_THREAD_MSP (0xFFFFFFF9UL) /* return to Thread mode, uses MSP after return */ #define EXC_RETURN_THREAD_MSP (0xFFFFFFF9UL) /* return to Thread mode, uses MSP after return */
#define EXC_RETURN_THREAD_PSP (0xFFFFFFFDUL) /* return to Thread mode, uses PSP after return */ #define EXC_RETURN_THREAD_PSP (0xFFFFFFFDUL) /* return to Thread mode, uses PSP after return */
/* Interrupt Priorities are WORD accessible only under Armv6-M */ /* Interrupt Priorities are WORD accessible only under Armv6-M */
/* The following MACROS handle generation of the register offset and byte masks */ /* The following MACROS handle generation of the register offset and byte masks */
#define _BIT_SHIFT(IRQn) ( ((((uint32_t)(int32_t)(IRQn)) ) & 0x03UL) * 8UL) #define _BIT_SHIFT(IRQn) (((((uint32_t)(int32_t)(IRQn))) & 0x03UL) * 8UL)
#define _SHP_IDX(IRQn) ( (((((uint32_t)(int32_t)(IRQn)) & 0x0FUL)-8UL) >> 2UL) ) #define _SHP_IDX(IRQn) ((((((uint32_t)(int32_t)(IRQn)) & 0x0FUL) - 8UL) >> 2UL))
#define _IP_IDX(IRQn) ( (((uint32_t)(int32_t)(IRQn)) >> 2UL) ) #define _IP_IDX(IRQn) ((((uint32_t)(int32_t)(IRQn)) >> 2UL))
/** /**
\brief Enable Interrupt \brief Enable Interrupt
@@ -746,15 +711,12 @@ typedef struct
\param [in] IRQn Device specific interrupt number. \param [in] IRQn Device specific interrupt number.
\note IRQn must not be negative. \note IRQn must not be negative.
*/ */
__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn) __STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn) {
{ if ((int32_t)(IRQn) >= 0) {
if ((int32_t)(IRQn) >= 0)
{
NVIC->ISER[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); NVIC->ISER[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
} }
} }
/** /**
\brief Get Interrupt Enable status \brief Get Interrupt Enable status
\details Returns a device specific interrupt enable status from the NVIC interrupt controller. \details Returns a device specific interrupt enable status from the NVIC interrupt controller.
@@ -763,36 +725,28 @@ __STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn)
\return 1 Interrupt is enabled. \return 1 Interrupt is enabled.
\note IRQn must not be negative. \note IRQn must not be negative.
*/ */
__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn) __STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn) {
{ if ((int32_t)(IRQn) >= 0) {
if ((int32_t)(IRQn) >= 0) return ((uint32_t)(((NVIC->ISER[0U] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
{ } else {
return((uint32_t)(((NVIC->ISER[0U] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); return (0U);
}
else
{
return(0U);
} }
} }
/** /**
\brief Disable Interrupt \brief Disable Interrupt
\details Disables a device specific interrupt in the NVIC interrupt controller. \details Disables a device specific interrupt in the NVIC interrupt controller.
\param [in] IRQn Device specific interrupt number. \param [in] IRQn Device specific interrupt number.
\note IRQn must not be negative. \note IRQn must not be negative.
*/ */
__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn) __STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn) {
{ if ((int32_t)(IRQn) >= 0) {
if ((int32_t)(IRQn) >= 0)
{
NVIC->ICER[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); NVIC->ICER[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
__DSB(); __DSB();
__ISB(); __ISB();
} }
} }
/** /**
\brief Get Pending Interrupt \brief Get Pending Interrupt
\details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt. \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt.
@@ -801,49 +755,38 @@ __STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn)
\return 1 Interrupt status is pending. \return 1 Interrupt status is pending.
\note IRQn must not be negative. \note IRQn must not be negative.
*/ */
__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn) __STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn) {
{ if ((int32_t)(IRQn) >= 0) {
if ((int32_t)(IRQn) >= 0) return ((uint32_t)(((NVIC->ISPR[0U] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL));
{ } else {
return((uint32_t)(((NVIC->ISPR[0U] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); return (0U);
}
else
{
return(0U);
} }
} }
/** /**
\brief Set Pending Interrupt \brief Set Pending Interrupt
\details Sets the pending bit of a device specific interrupt in the NVIC pending register. \details Sets the pending bit of a device specific interrupt in the NVIC pending register.
\param [in] IRQn Device specific interrupt number. \param [in] IRQn Device specific interrupt number.
\note IRQn must not be negative. \note IRQn must not be negative.
*/ */
__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn) __STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn) {
{ if ((int32_t)(IRQn) >= 0) {
if ((int32_t)(IRQn) >= 0)
{
NVIC->ISPR[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); NVIC->ISPR[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
} }
} }
/** /**
\brief Clear Pending Interrupt \brief Clear Pending Interrupt
\details Clears the pending bit of a device specific interrupt in the NVIC pending register. \details Clears the pending bit of a device specific interrupt in the NVIC pending register.
\param [in] IRQn Device specific interrupt number. \param [in] IRQn Device specific interrupt number.
\note IRQn must not be negative. \note IRQn must not be negative.
*/ */
__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn) __STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn) {
{ if ((int32_t)(IRQn) >= 0) {
if ((int32_t)(IRQn) >= 0)
{
NVIC->ICPR[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); NVIC->ICPR[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
} }
} }
/** /**
\brief Set Interrupt Priority \brief Set Interrupt Priority
\details Sets the priority of a device specific interrupt or a processor exception. \details Sets the priority of a device specific interrupt or a processor exception.
@@ -853,21 +796,14 @@ __STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn)
\param [in] priority Priority to set. \param [in] priority Priority to set.
\note The priority cannot be set for every processor exception. \note The priority cannot be set for every processor exception.
*/ */
__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) __STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) {
{ if ((int32_t)(IRQn) >= 0) {
if ((int32_t)(IRQn) >= 0) NVIC->IP[_IP_IDX(IRQn)] = ((uint32_t)(NVIC->IP[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
{ } else {
NVIC->IP[_IP_IDX(IRQn)] = ((uint32_t)(NVIC->IP[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | SCB->SHP[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) | (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
(((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
}
else
{
SCB->SHP[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
(((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
} }
} }
/** /**
\brief Get Interrupt Priority \brief Get Interrupt Priority
\details Reads the priority of a device specific interrupt or a processor exception. \details Reads the priority of a device specific interrupt or a processor exception.
@@ -877,20 +813,15 @@ __STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
\return Interrupt Priority. \return Interrupt Priority.
Value is aligned automatically to the implemented priority bits of the microcontroller. Value is aligned automatically to the implemented priority bits of the microcontroller.
*/ */
__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn) __STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn) {
{
if ((int32_t)(IRQn) >= 0) if ((int32_t)(IRQn) >= 0) {
{ return ((uint32_t)(((NVIC->IP[_IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn)) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
return((uint32_t)(((NVIC->IP[ _IP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS))); } else {
} return ((uint32_t)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn)) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
else
{
return((uint32_t)(((SCB->SHP[_SHP_IDX(IRQn)] >> _BIT_SHIFT(IRQn) ) & (uint32_t)0xFFUL) >> (8U - __NVIC_PRIO_BITS)));
} }
} }
/** /**
\brief Set Interrupt Vector \brief Set Interrupt Vector
\details Sets an interrupt vector in SRAM based interrupt vector table. \details Sets an interrupt vector in SRAM based interrupt vector table.
@@ -900,13 +831,11 @@ __STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn)
\param [in] IRQn Interrupt number \param [in] IRQn Interrupt number
\param [in] vector Address of interrupt handler function \param [in] vector Address of interrupt handler function
*/ */
__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) __STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
{
uint32_t *vectors = (uint32_t *)SCB->VTOR; uint32_t *vectors = (uint32_t *)SCB->VTOR;
vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector; vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector;
} }
/** /**
\brief Get Interrupt Vector \brief Get Interrupt Vector
\details Reads an interrupt vector from interrupt vector table. \details Reads an interrupt vector from interrupt vector table.
@@ -915,26 +844,22 @@ __STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector)
\param [in] IRQn Interrupt number. \param [in] IRQn Interrupt number.
\return Address of interrupt handler function \return Address of interrupt handler function
*/ */
__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn) __STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn) {
{
uint32_t *vectors = (uint32_t *)SCB->VTOR; uint32_t *vectors = (uint32_t *)SCB->VTOR;
return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET]; return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET];
} }
/** /**
\brief System Reset \brief System Reset
\details Initiates a system reset request to reset the MCU. \details Initiates a system reset request to reset the MCU.
*/ */
__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void) __NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void) {
{
__DSB(); /* Ensure all outstanding memory accesses included __DSB(); /* Ensure all outstanding memory accesses included
buffered write are completed before reset */ buffered write are completed before reset */
SCB->AIRCR = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | SCB->AIRCR = ((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | SCB_AIRCR_SYSRESETREQ_Msk);
SCB_AIRCR_SYSRESETREQ_Msk);
__DSB(); /* Ensure completion of memory access */ __DSB(); /* Ensure completion of memory access */
for(;;) /* wait until reset */ for (;;) /* wait until reset */
{ {
__NOP(); __NOP();
} }
@@ -942,7 +867,6 @@ __NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void)
/*@} end of CMSIS_Core_NVICFunctions */ /*@} end of CMSIS_Core_NVICFunctions */
/* ########################## FPU functions #################################### */ /* ########################## FPU functions #################################### */
/** /**
\ingroup CMSIS_Core_FunctionInterface \ingroup CMSIS_Core_FunctionInterface
@@ -959,16 +883,10 @@ __NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void)
- \b 1: Single precision FPU - \b 1: Single precision FPU
- \b 2: Double + Single precision FPU - \b 2: Double + Single precision FPU
*/ */
__STATIC_INLINE uint32_t SCB_GetFPUType(void) __STATIC_INLINE uint32_t SCB_GetFPUType(void) { return 0U; /* No FPU */ }
{
return 0U; /* No FPU */
}
/*@} end of CMSIS_Core_FpuFunctions */ /*@} end of CMSIS_Core_FpuFunctions */
/* ################################## SysTick function ############################################ */ /* ################################## SysTick function ############################################ */
/** /**
\ingroup CMSIS_Core_FunctionInterface \ingroup CMSIS_Core_FunctionInterface
@@ -977,7 +895,7 @@ __STATIC_INLINE uint32_t SCB_GetFPUType(void)
@{ @{
*/ */
#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U) #if defined(__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U)
/** /**
\brief System Tick Configuration \brief System Tick Configuration
@@ -990,19 +908,15 @@ __STATIC_INLINE uint32_t SCB_GetFPUType(void)
function <b>SysTick_Config</b> is not included. In this case, the file <b><i>device</i>.h</b> function <b>SysTick_Config</b> is not included. In this case, the file <b><i>device</i>.h</b>
must contain a vendor-specific implementation of this function. must contain a vendor-specific implementation of this function.
*/ */
__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks) __STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks) {
{ if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) {
if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk)
{
return (1UL); /* Reload value impossible */ return (1UL); /* Reload value impossible */
} }
SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */ SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */
NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */ NVIC_SetPriority(SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */
SysTick->VAL = 0UL; /* Load the SysTick Counter Value */ SysTick->VAL = 0UL; /* Load the SysTick Counter Value */
SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | SysTick_CTRL_TICKINT_Msk | SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
SysTick_CTRL_TICKINT_Msk |
SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */
return (0UL); /* Function successful */ return (0UL); /* Function successful */
} }
@@ -1010,9 +924,6 @@ __STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)
/*@} end of CMSIS_Core_SysTickFunctions */ /*@} end of CMSIS_Core_SysTickFunctions */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@@ -22,10 +22,10 @@
* limitations under the License. * limitations under the License.
*/ */
#if defined ( __ICCARM__ ) #if defined(__ICCARM__)
#pragma system_include /* treat file as system include file for MISRA check */ #pragma system_include /* treat file as system include file for MISRA check */
#elif defined (__clang__) #elif defined(__clang__)
#pragma clang system_header /* treat file as system include file */ #pragma clang system_header /* treat file as system include file */
#endif #endif
#ifndef TZ_CONTEXT_H #ifndef TZ_CONTEXT_H
@@ -44,27 +44,27 @@ typedef uint32_t TZ_MemoryId_t;
/// Initialize secure context memory system /// Initialize secure context memory system
/// \return execution status (1: success, 0: error) /// \return execution status (1: success, 0: error)
uint32_t TZ_InitContextSystem_S (void); uint32_t TZ_InitContextSystem_S(void);
/// Allocate context memory for calling secure software modules in TrustZone /// Allocate context memory for calling secure software modules in TrustZone
/// \param[in] module identifies software modules called from non-secure mode /// \param[in] module identifies software modules called from non-secure mode
/// \return value != 0 id TrustZone memory slot identifier /// \return value != 0 id TrustZone memory slot identifier
/// \return value 0 no memory available or internal error /// \return value 0 no memory available or internal error
TZ_MemoryId_t TZ_AllocModuleContext_S (TZ_ModuleId_t module); TZ_MemoryId_t TZ_AllocModuleContext_S(TZ_ModuleId_t module);
/// Free context memory that was previously allocated with \ref TZ_AllocModuleContext_S /// Free context memory that was previously allocated with \ref TZ_AllocModuleContext_S
/// \param[in] id TrustZone memory slot identifier /// \param[in] id TrustZone memory slot identifier
/// \return execution status (1: success, 0: error) /// \return execution status (1: success, 0: error)
uint32_t TZ_FreeModuleContext_S (TZ_MemoryId_t id); uint32_t TZ_FreeModuleContext_S(TZ_MemoryId_t id);
/// Load secure context (called on RTOS thread context switch) /// Load secure context (called on RTOS thread context switch)
/// \param[in] id TrustZone memory slot identifier /// \param[in] id TrustZone memory slot identifier
/// \return execution status (1: success, 0: error) /// \return execution status (1: success, 0: error)
uint32_t TZ_LoadContext_S (TZ_MemoryId_t id); uint32_t TZ_LoadContext_S(TZ_MemoryId_t id);
/// Store secure context (called on RTOS thread context switch) /// Store secure context (called on RTOS thread context switch)
/// \param[in] id TrustZone memory slot identifier /// \param[in] id TrustZone memory slot identifier
/// \return execution status (1: success, 0: error) /// \return execution status (1: success, 0: error)
uint32_t TZ_StoreContext_S (TZ_MemoryId_t id); uint32_t TZ_StoreContext_S(TZ_MemoryId_t id);
#endif // TZ_CONTEXT_H #endif // TZ_CONTEXT_H

View File

@@ -90,7 +90,8 @@ typedef struct {
* ADC can be either disabled or enabled without conversion on going on regular group. * ADC can be either disabled or enabled without conversion on going on regular group.
*/ */
typedef struct { typedef struct {
uint32_t Channel; /*!< Specifies the channel to configure into ADC regular group. uint32_t
Channel; /*!< Specifies the channel to configure into ADC regular group.
This parameter can be a value of @ref ADC_channels This parameter can be a value of @ref ADC_channels
Note: Depending on devices, some channels may not be available on package pins. Refer to device datasheet for channels availability. Note: Depending on devices, some channels may not be available on package pins. Refer to device datasheet for channels availability.
Note: On STM32F1 devices with several ADC: Only ADC1 can access internal measurement channels (VrefInt/TempSensor) Note: On STM32F1 devices with several ADC: Only ADC1 can access internal measurement channels (VrefInt/TempSensor)

View File

@@ -53,13 +53,13 @@ extern "C" {
* - For all except parameters 'ExternalTrigInjecConv': ADC enabled without conversion on going on injected group. * - For all except parameters 'ExternalTrigInjecConv': ADC enabled without conversion on going on injected group.
*/ */
typedef struct { typedef struct {
uint32_t uint32_t InjectedChannel; /*!< Selection of ADC channel to configure
InjectedChannel; /*!< Selection of ADC channel to configure
This parameter can be a value of @ref ADC_channels This parameter can be a value of @ref ADC_channels
Note: Depending on devices, some channels may not be available on package pins. Refer to device datasheet for channels availability. Note: Depending on devices, some channels may not be available on package pins. Refer to device datasheet for channels availability.
Note: On STM32F1 devices with several ADC: Only ADC1 can access internal measurement channels (VrefInt/TempSensor) Note: On STM32F1 devices with several ADC: Only ADC1 can access internal measurement channels (VrefInt/TempSensor)
Note: On STM32F10xx8 and STM32F10xxB devices: A low-amplitude voltage glitch may be generated (on ADC input 0) on the PA0 pin, when the ADC is converting with injection Note: On STM32F10xx8 and STM32F10xxB devices: A low-amplitude voltage glitch may be generated (on ADC input 0) on the PA0 pin, when the ADC is converting with
trigger. It is advised to distribute the analog channels so that Channel 0 is configured as an injected channel. Refer to errata sheet of these devices for more details. */ injection trigger. It is advised to distribute the analog channels so that Channel 0 is configured as an injected channel. Refer to errata
sheet of these devices for more details. */
uint32_t InjectedRank; /*!< Rank in the injected group sequencer uint32_t InjectedRank; /*!< Rank in the injected group sequencer
This parameter must be a value of @ref ADCEx_injected_rank This parameter must be a value of @ref ADCEx_injected_rank
Note: In case of need to disable a channel or change order of conversion sequencer, rank containing a previous channel setting can be overwritten by the new channel Note: In case of need to disable a channel or change order of conversion sequencer, rank containing a previous channel setting can be overwritten by the new channel

View File

@@ -11,6 +11,4 @@
#include "task.h" #include "task.h"
// Initialisation to be performed with scheduler active // Initialisation to be performed with scheduler active
void postRToSInit() { void postRToSInit() {}
}

View File

@@ -42,7 +42,7 @@ void DMA1_Channel1_IRQHandler(void) { HAL_DMA_IRQHandler(&hdma_adc1); }
// ADC interrupt used for DMA // ADC interrupt used for DMA
void ADC1_2_IRQHandler(void) { HAL_ADC_IRQHandler(&hadc1); } void ADC1_2_IRQHandler(void) { HAL_ADC_IRQHandler(&hadc1); }
//used for hal ticks // used for hal ticks
void TIM4_IRQHandler(void) { HAL_TIM_IRQHandler(&htim4); } void TIM4_IRQHandler(void) { HAL_TIM_IRQHandler(&htim4); }
void I2C1_EV_IRQHandler(void) { HAL_I2C_EV_IRQHandler(&hi2c1); } void I2C1_EV_IRQHandler(void) { HAL_I2C_EV_IRQHandler(&hi2c1); }
void I2C1_ER_IRQHandler(void) { HAL_I2C_ER_IRQHandler(&hi2c1); } void I2C1_ER_IRQHandler(void) { HAL_I2C_ER_IRQHandler(&hi2c1); }

View File

@@ -5,21 +5,18 @@
* Author: Ralim * Author: Ralim
*/ */
#include <WS2812.h>
#include "Pins.h" #include "Pins.h"
#include <WS2812.h>
#include <string.h> #include <string.h>
uint8_t WS2812::leds_colors[WS2812_LED_CHANNEL_COUNT * WS2812_LED_COUNT]; uint8_t WS2812::leds_colors[WS2812_LED_CHANNEL_COUNT * WS2812_LED_COUNT];
void WS2812::init(void) { void WS2812::init(void) { memset(leds_colors, 0, sizeof(leds_colors)); }
memset(leds_colors, 0, sizeof(leds_colors));
}
void WS2812::led_update() { void WS2812::led_update() {
__disable_irq(); __disable_irq();
//Bitbang it out as our cpu irq latency is too high // Bitbang it out as our cpu irq latency is too high
for (unsigned int i = 0; i < sizeof(leds_colors); i++) { for (unsigned int i = 0; i < sizeof(leds_colors); i++) {
//Shove out MSB first // Shove out MSB first
for (int x = 0; x < 8; x++) { for (int x = 0; x < 8; x++) {
WS2812_GPIO_Port->BSRR = WS2812_Pin; WS2812_GPIO_Port->BSRR = WS2812_Pin;
if ((leds_colors[i] & (1 << (7 - x))) == (1 << (7 - x))) { if ((leds_colors[i] & (1 << (7 - x))) == (1 << (7 - x))) {
@@ -62,7 +59,7 @@ void WS2812::led_update() {
__asm__ __volatile__("nop"); __asm__ __volatile__("nop");
__asm__ __volatile__("nop"); __asm__ __volatile__("nop");
} }
WS2812_GPIO_Port->BSRR = (uint32_t) WS2812_Pin << 16u; WS2812_GPIO_Port->BSRR = (uint32_t)WS2812_Pin << 16u;
__asm__ __volatile__("nop"); __asm__ __volatile__("nop");
__asm__ __volatile__("nop"); __asm__ __volatile__("nop");
__asm__ __volatile__("nop"); __asm__ __volatile__("nop");

View File

@@ -25,7 +25,6 @@ public:
static void led_set_color_all(uint8_t r, uint8_t g, uint8_t b); static void led_set_color_all(uint8_t r, uint8_t g, uint8_t b);
private: private:
static uint8_t leds_colors[WS2812_LED_CHANNEL_COUNT * WS2812_LED_COUNT]; static uint8_t leds_colors[WS2812_LED_CHANNEL_COUNT * WS2812_LED_COUNT];
}; };

View File

@@ -199,14 +199,11 @@ static void gui_solderingTempAdjust() {
return; return;
break; break;
case BUTTON_B_LONG: case BUTTON_B_LONG:
if (xTaskGetTickCount() - autoRepeatTimer if (xTaskGetTickCount() - autoRepeatTimer + autoRepeatAcceleration > PRESS_ACCEL_INTERVAL_MAX) {
+ autoRepeatAcceleration> PRESS_ACCEL_INTERVAL_MAX) {
if (systemSettings.ReverseButtonTempChangeEnabled) { if (systemSettings.ReverseButtonTempChangeEnabled) {
systemSettings.SolderingTemp += systemSettings.SolderingTemp += systemSettings.TempChangeLongStep;
systemSettings.TempChangeLongStep;
} else } else
systemSettings.SolderingTemp -= systemSettings.SolderingTemp -= systemSettings.TempChangeLongStep;
systemSettings.TempChangeLongStep;
autoRepeatTimer = xTaskGetTickCount(); autoRepeatTimer = xTaskGetTickCount();
autoRepeatAcceleration += PRESS_ACCEL_STEP; autoRepeatAcceleration += PRESS_ACCEL_STEP;
@@ -214,40 +211,31 @@ static void gui_solderingTempAdjust() {
break; break;
case BUTTON_B_SHORT: case BUTTON_B_SHORT:
if (systemSettings.ReverseButtonTempChangeEnabled) { if (systemSettings.ReverseButtonTempChangeEnabled) {
systemSettings.SolderingTemp += systemSettings.SolderingTemp += systemSettings.TempChangeShortStep;
systemSettings.TempChangeShortStep;
} else } else
systemSettings.SolderingTemp -= systemSettings.SolderingTemp -= systemSettings.TempChangeShortStep;
systemSettings.TempChangeShortStep;
break; break;
case BUTTON_F_LONG: case BUTTON_F_LONG:
if (xTaskGetTickCount() - autoRepeatTimer if (xTaskGetTickCount() - autoRepeatTimer + autoRepeatAcceleration > PRESS_ACCEL_INTERVAL_MAX) {
+ autoRepeatAcceleration> PRESS_ACCEL_INTERVAL_MAX) {
if (systemSettings.ReverseButtonTempChangeEnabled) { if (systemSettings.ReverseButtonTempChangeEnabled) {
systemSettings.SolderingTemp -= systemSettings.SolderingTemp -= systemSettings.TempChangeLongStep;
systemSettings.TempChangeLongStep;
} else } else
systemSettings.SolderingTemp += systemSettings.SolderingTemp += systemSettings.TempChangeLongStep;
systemSettings.TempChangeLongStep;
autoRepeatTimer = xTaskGetTickCount(); autoRepeatTimer = xTaskGetTickCount();
autoRepeatAcceleration += PRESS_ACCEL_STEP; autoRepeatAcceleration += PRESS_ACCEL_STEP;
} }
break; break;
case BUTTON_F_SHORT: case BUTTON_F_SHORT:
if (systemSettings.ReverseButtonTempChangeEnabled) { if (systemSettings.ReverseButtonTempChangeEnabled) {
systemSettings.SolderingTemp -= systemSettings.SolderingTemp -= systemSettings.TempChangeShortStep; // add 10
systemSettings.TempChangeShortStep; // add 10
} else } else
systemSettings.SolderingTemp += systemSettings.SolderingTemp += systemSettings.TempChangeShortStep; // add 10
systemSettings.TempChangeShortStep; // add 10
break; break;
default: default:
break; break;
} }
if ((PRESS_ACCEL_INTERVAL_MAX - autoRepeatAcceleration) if ((PRESS_ACCEL_INTERVAL_MAX - autoRepeatAcceleration) < PRESS_ACCEL_INTERVAL_MIN) {
< PRESS_ACCEL_INTERVAL_MIN) { autoRepeatAcceleration = PRESS_ACCEL_INTERVAL_MAX - PRESS_ACCEL_INTERVAL_MIN;
autoRepeatAcceleration = PRESS_ACCEL_INTERVAL_MAX
- PRESS_ACCEL_INTERVAL_MIN;
} }
// constrain between 10-450 C // constrain between 10-450 C
if (systemSettings.temperatureInF) { if (systemSettings.temperatureInF) {
@@ -270,13 +258,9 @@ static void gui_solderingTempAdjust() {
#else #else
if (OLED::getRotation()) { if (OLED::getRotation()) {
#endif #endif
OLED::print( OLED::print(systemSettings.ReverseButtonTempChangeEnabled ? SymbolPlus : SymbolMinus, FontStyle::LARGE);
systemSettings.ReverseButtonTempChangeEnabled ?
SymbolPlus : SymbolMinus, FontStyle::LARGE);
} else { } else {
OLED::print( OLED::print(systemSettings.ReverseButtonTempChangeEnabled ? SymbolMinus : SymbolPlus, FontStyle::LARGE);
systemSettings.ReverseButtonTempChangeEnabled ?
SymbolMinus : SymbolPlus, FontStyle::LARGE);
} }
OLED::print(SymbolSpace, FontStyle::LARGE); OLED::print(SymbolSpace, FontStyle::LARGE);
@@ -292,13 +276,9 @@ static void gui_solderingTempAdjust() {
#else #else
if (OLED::getRotation()) { if (OLED::getRotation()) {
#endif #endif
OLED::print( OLED::print(systemSettings.ReverseButtonTempChangeEnabled ? SymbolMinus : SymbolPlus, FontStyle::LARGE);
systemSettings.ReverseButtonTempChangeEnabled ?
SymbolMinus : SymbolPlus, FontStyle::LARGE);
} else { } else {
OLED::print( OLED::print(systemSettings.ReverseButtonTempChangeEnabled ? SymbolPlus : SymbolMinus, FontStyle::LARGE);
systemSettings.ReverseButtonTempChangeEnabled ?
SymbolPlus : SymbolMinus, FontStyle::LARGE);
} }
OLED::refresh(); OLED::refresh();
GUIDelay(); GUIDelay();
@@ -307,14 +287,12 @@ static void gui_solderingTempAdjust() {
static bool shouldShutdown() { static bool shouldShutdown() {
if (systemSettings.ShutdownTime) { // only allow shutdown exit if time > 0 if (systemSettings.ShutdownTime) { // only allow shutdown exit if time > 0
if (lastMovementTime) { if (lastMovementTime) {
if (((TickType_t) (xTaskGetTickCount() - lastMovementTime)) if (((TickType_t)(xTaskGetTickCount() - lastMovementTime)) > (TickType_t)(systemSettings.ShutdownTime * TICKS_MIN)) {
> (TickType_t) (systemSettings.ShutdownTime * TICKS_MIN)) {
return true; return true;
} }
} }
if (lastHallEffectSleepStart) { if (lastHallEffectSleepStart) {
if (((TickType_t) (xTaskGetTickCount() - lastHallEffectSleepStart)) if (((TickType_t)(xTaskGetTickCount() - lastHallEffectSleepStart)) > (TickType_t)(systemSettings.ShutdownTime * TICKS_MIN)) {
> (TickType_t) (systemSettings.ShutdownTime * TICKS_MIN)) {
return true; return true;
} }
} }
@@ -333,18 +311,9 @@ static int gui_SolderingSleepingMode(bool stayOff, bool autoStarted) {
return 1; // return non-zero on error return 1; // return non-zero on error
#endif #endif
if (systemSettings.temperatureInF) { if (systemSettings.temperatureInF) {
currentTempTargetDegC = currentTempTargetDegC = stayOff ? 0 : TipThermoModel::convertFtoC(min(systemSettings.SleepTemp, systemSettings.SolderingTemp));
stayOff ?
0 :
TipThermoModel::convertFtoC(
min(systemSettings.SleepTemp,
systemSettings.SolderingTemp));
} else { } else {
currentTempTargetDegC = currentTempTargetDegC = stayOff ? 0 : min(systemSettings.SleepTemp, systemSettings.SolderingTemp);
stayOff ?
0 :
min(systemSettings.SleepTemp,
systemSettings.SolderingTemp);
} }
// draw the lcd // draw the lcd
uint16_t tipTemp; uint16_t tipTemp;
@@ -357,11 +326,9 @@ static int gui_SolderingSleepingMode(bool stayOff, bool autoStarted) {
OLED::clearScreen(); OLED::clearScreen();
OLED::setCursor(0, 0); OLED::setCursor(0, 0);
if (systemSettings.detailedSoldering) { if (systemSettings.detailedSoldering) {
OLED::print(translatedString(Tr->SleepingAdvancedString), OLED::print(translatedString(Tr->SleepingAdvancedString), FontStyle::SMALL);
FontStyle::SMALL);
OLED::setCursor(0, 8); OLED::setCursor(0, 8);
OLED::print(translatedString(Tr->SleepingTipAdvancedString), OLED::print(translatedString(Tr->SleepingTipAdvancedString), FontStyle::SMALL);
FontStyle::SMALL);
OLED::printNumber(tipTemp, 3, FontStyle::SMALL); OLED::printNumber(tipTemp, 3, FontStyle::SMALL);
if (systemSettings.temperatureInF) if (systemSettings.temperatureInF)
OLED::print(SymbolDegF, FontStyle::SMALL); OLED::print(SymbolDegF, FontStyle::SMALL);
@@ -373,8 +340,7 @@ static int gui_SolderingSleepingMode(bool stayOff, bool autoStarted) {
printVoltage(); printVoltage();
OLED::print(SymbolVolts, FontStyle::SMALL); OLED::print(SymbolVolts, FontStyle::SMALL);
} else { } else {
OLED::print(translatedString(Tr->SleepingSimpleString), OLED::print(translatedString(Tr->SleepingSimpleString), FontStyle::LARGE);
FontStyle::LARGE);
OLED::printNumber(tipTemp, 3, FontStyle::LARGE); OLED::printNumber(tipTemp, 3, FontStyle::LARGE);
if (systemSettings.temperatureInF) if (systemSettings.temperatureInF)
OLED::drawSymbol(0); OLED::drawSymbol(0);
@@ -393,8 +359,7 @@ static int gui_SolderingSleepingMode(bool stayOff, bool autoStarted) {
// If we have moved recently; in the last second // If we have moved recently; in the last second
// Then exit soldering mode // Then exit soldering mode
if (((TickType_t) (xTaskGetTickCount() - lastMovementTime)) if (((TickType_t)(xTaskGetTickCount() - lastMovementTime)) < (TickType_t)(TICKS_SECOND)) {
< (TickType_t) (TICKS_SECOND)) {
currentTempTargetDegC = 0; currentTempTargetDegC = 0;
return 1; return 1;
} }
@@ -521,13 +486,11 @@ static void gui_solderingMode(uint8_t jumpToSleep) {
case BUTTON_BOTH_LONG: case BUTTON_BOTH_LONG:
// Unlock buttons // Unlock buttons
buttonsLocked = false; buttonsLocked = false;
warnUser(translatedString(Tr->UnlockingKeysString), warnUser(translatedString(Tr->UnlockingKeysString), TICKS_SECOND);
TICKS_SECOND);
break; break;
case BUTTON_F_LONG: case BUTTON_F_LONG:
// if boost mode is enabled turn it on // if boost mode is enabled turn it on
if (systemSettings.BoostTemp if (systemSettings.BoostTemp && (systemSettings.lockingMode == 1)) {
&& (systemSettings.lockingMode == 1)) {
boostModeOn = true; boostModeOn = true;
} }
break; break;
@@ -537,8 +500,7 @@ static void gui_solderingMode(uint8_t jumpToSleep) {
case BUTTON_F_SHORT: case BUTTON_F_SHORT:
case BUTTON_B_SHORT: case BUTTON_B_SHORT:
// Do nothing and display a lock warming // Do nothing and display a lock warming
warnUser(translatedString(Tr->WarningKeysLockedString), warnUser(translatedString(Tr->WarningKeysLockedString), TICKS_SECOND / 2);
TICKS_SECOND / 2);
break; break;
default: default:
break; break;
@@ -568,14 +530,12 @@ static void gui_solderingMode(uint8_t jumpToSleep) {
if (oldTemp != systemSettings.SolderingTemp) { if (oldTemp != systemSettings.SolderingTemp) {
saveSettings(); // only save on change saveSettings(); // only save on change
} }
} } break;
break;
case BUTTON_BOTH_LONG: case BUTTON_BOTH_LONG:
if (systemSettings.lockingMode != 0) { if (systemSettings.lockingMode != 0) {
// Lock buttons // Lock buttons
buttonsLocked = true; buttonsLocked = true;
warnUser(translatedString(Tr->LockingKeysString), warnUser(translatedString(Tr->LockingKeysString), TICKS_SECOND);
TICKS_SECOND);
} }
break; break;
default: default:
@@ -589,11 +549,9 @@ static void gui_solderingMode(uint8_t jumpToSleep) {
if (systemSettings.detailedSoldering) { if (systemSettings.detailedSoldering) {
OLED::print(translatedString(Tr->SolderingAdvancedPowerPrompt), OLED::print(translatedString(Tr->SolderingAdvancedPowerPrompt),
FontStyle::SMALL); // Power: FontStyle::SMALL); // Power:
OLED::printNumber(x10WattHistory.average() / 10, 2, OLED::printNumber(x10WattHistory.average() / 10, 2, FontStyle::SMALL);
FontStyle::SMALL);
OLED::print(SymbolDot, FontStyle::SMALL); OLED::print(SymbolDot, FontStyle::SMALL);
OLED::printNumber(x10WattHistory.average() % 10, 1, OLED::printNumber(x10WattHistory.average() % 10, 1, FontStyle::SMALL);
FontStyle::SMALL);
OLED::print(SymbolWatts, FontStyle::SMALL); OLED::print(SymbolWatts, FontStyle::SMALL);
#ifndef NO_SLEEP_MODE #ifndef NO_SLEEP_MODE
if (systemSettings.sensitivity && systemSettings.SleepTime) { if (systemSettings.sensitivity && systemSettings.SleepTime) {
@@ -602,8 +560,7 @@ static void gui_solderingMode(uint8_t jumpToSleep) {
} }
#endif #endif
OLED::setCursor(0, 8); OLED::setCursor(0, 8);
OLED::print(translatedString(Tr->SleepingTipAdvancedString), OLED::print(translatedString(Tr->SleepingTipAdvancedString), FontStyle::SMALL);
FontStyle::SMALL);
gui_drawTipTemp(true, FontStyle::SMALL); gui_drawTipTemp(true, FontStyle::SMALL);
if (boostModeOn) { if (boostModeOn) {
@@ -652,15 +609,13 @@ static void gui_solderingMode(uint8_t jumpToSleep) {
// Update the setpoints for the temperature // Update the setpoints for the temperature
if (boostModeOn) { if (boostModeOn) {
if (systemSettings.temperatureInF) if (systemSettings.temperatureInF)
currentTempTargetDegC = TipThermoModel::convertFtoC( currentTempTargetDegC = TipThermoModel::convertFtoC(systemSettings.BoostTemp);
systemSettings.BoostTemp);
else { else {
currentTempTargetDegC = (systemSettings.BoostTemp); currentTempTargetDegC = (systemSettings.BoostTemp);
} }
} else { } else {
if (systemSettings.temperatureInF) if (systemSettings.temperatureInF)
currentTempTargetDegC = TipThermoModel::convertFtoC( currentTempTargetDegC = TipThermoModel::convertFtoC(systemSettings.SolderingTemp);
systemSettings.SolderingTemp);
else { else {
currentTempTargetDegC = (systemSettings.SolderingTemp); currentTempTargetDegC = (systemSettings.SolderingTemp);
} }
@@ -679,10 +634,10 @@ static void gui_solderingMode(uint8_t jumpToSleep) {
return; // If the function returns non-0 then exit return; // If the function returns non-0 then exit
} }
} }
//Update LED status // Update LED status
int error = currentTempTargetDegC - TipThermoModel::getTipInC(); int error = currentTempTargetDegC - TipThermoModel::getTipInC();
if (error >= -10 && error <= 10) { if (error >= -10 && error <= 10) {
//converged // converged
setStatusLED(LED_HOT); setStatusLED(LED_HOT);
} else { } else {
setStatusLED(LED_HEATING); setStatusLED(LED_HEATING);
@@ -706,36 +661,27 @@ void showDebugMenu(void) {
break; break;
case 1: case 1:
// High water mark for GUI // High water mark for GUI
OLED::printNumber(uxTaskGetStackHighWaterMark(GUITaskHandle), 5, OLED::printNumber(uxTaskGetStackHighWaterMark(GUITaskHandle), 5, FontStyle::SMALL);
FontStyle::SMALL);
break; break;
case 2: case 2:
// High water mark for the Movement task // High water mark for the Movement task
OLED::printNumber(uxTaskGetStackHighWaterMark(MOVTaskHandle), 5, OLED::printNumber(uxTaskGetStackHighWaterMark(MOVTaskHandle), 5, FontStyle::SMALL);
FontStyle::SMALL);
break; break;
case 3: case 3:
// High water mark for the PID task // High water mark for the PID task
OLED::printNumber(uxTaskGetStackHighWaterMark(PIDTaskHandle), 5, OLED::printNumber(uxTaskGetStackHighWaterMark(PIDTaskHandle), 5, FontStyle::SMALL);
FontStyle::SMALL);
break; break;
case 4: case 4:
// system up time stamp // system up time stamp
OLED::printNumber(xTaskGetTickCount() / TICKS_100MS, 5, OLED::printNumber(xTaskGetTickCount() / TICKS_100MS, 5, FontStyle::SMALL);
FontStyle::SMALL);
break; break;
case 5: case 5:
// Movement time stamp // Movement time stamp
OLED::printNumber(lastMovementTime / TICKS_100MS, 5, OLED::printNumber(lastMovementTime / TICKS_100MS, 5, FontStyle::SMALL);
FontStyle::SMALL);
break; break;
case 6: case 6:
// Raw Tip // Raw Tip
{ { OLED::printNumber(TipThermoModel::convertTipRawADCTouV(getTipRawTemp(0), true), 6, FontStyle::SMALL); }
OLED::printNumber(
TipThermoModel::convertTipRawADCTouV(getTipRawTemp(0),
true), 6, FontStyle::SMALL);
}
break; break;
case 7: case 7:
// Temp in C // Temp in C
@@ -751,8 +697,7 @@ void showDebugMenu(void) {
break; break;
case 10: case 10:
// Print PCB ID number // Print PCB ID number
OLED::printNumber(DetectedAccelerometerVersion, 2, OLED::printNumber(DetectedAccelerometerVersion, 2, FontStyle::SMALL);
FontStyle::SMALL);
break; break;
case 11: case 11:
// Power negotiation status // Power negotiation status
@@ -780,8 +725,7 @@ void showDebugMenu(void) {
break; break;
case 12: case 12:
// Max deg C limit // Max deg C limit
OLED::printNumber(TipThermoModel::getTipMaxInC(), 3, OLED::printNumber(TipThermoModel::getTipMaxInC(), 3, FontStyle::SMALL);
FontStyle::SMALL);
break; break;
default: default:
break; break;
@@ -816,8 +760,7 @@ void showWarnings() {
if (systemSettings.accelMissingWarningCounter < 2) { if (systemSettings.accelMissingWarningCounter < 2) {
systemSettings.accelMissingWarningCounter++; systemSettings.accelMissingWarningCounter++;
saveSettings(); saveSettings();
warnUser(translatedString(Tr->NoAccelerometerMessage), warnUser(translatedString(Tr->NoAccelerometerMessage), 10 * TICKS_SECOND);
10 * TICKS_SECOND);
} }
} }
#ifdef POW_PD #ifdef POW_PD
@@ -826,8 +769,7 @@ void showWarnings() {
if (systemSettings.pdMissingWarningCounter < 2) { if (systemSettings.pdMissingWarningCounter < 2) {
systemSettings.pdMissingWarningCounter++; systemSettings.pdMissingWarningCounter++;
saveSettings(); saveSettings();
warnUser(translatedString(Tr->NoPowerDeliveryMessage), warnUser(translatedString(Tr->NoPowerDeliveryMessage), 10 * TICKS_SECOND);
10 * TICKS_SECOND);
} }
} }
#endif #endif
@@ -850,8 +792,7 @@ void startGUITask(void const *argument __unused) {
// flipped is generated by flipping each row // flipped is generated by flipping each row
for (int row = 0; row < 2; row++) { for (int row = 0; row < 2; row++) {
for (int x = 0; x < 84; x++) { for (int x = 0; x < 84; x++) {
idleScreenBGF[(row * 84) + x] = idleScreenBG[(row * 84) idleScreenBGF[(row * 84) + x] = idleScreenBG[(row * 84) + (83 - x)];
+ (83 - x)];
} }
} }
} }
@@ -935,11 +876,7 @@ void startGUITask(void const *argument __unused) {
// This is zero cost really as state is only changed on display updates // This is zero cost really as state is only changed on display updates
OLED::setDisplayState(OLED::DisplayState::ON); OLED::setDisplayState(OLED::DisplayState::ON);
if ((tipTemp < 50) && systemSettings.sensitivity if ((tipTemp < 50) && systemSettings.sensitivity && (((xTaskGetTickCount() - lastMovementTime) > MOVEMENT_INACTIVITY_TIME) && ((xTaskGetTickCount() - lastButtonTime) > BUTTON_INACTIVITY_TIME))) {
&& (((xTaskGetTickCount() - lastMovementTime)
> MOVEMENT_INACTIVITY_TIME)
&& ((xTaskGetTickCount() - lastButtonTime)
> BUTTON_INACTIVITY_TIME))) {
OLED::setDisplayState(OLED::DisplayState::OFF); OLED::setDisplayState(OLED::DisplayState::OFF);
setStatusLED(LED_OFF); setStatusLED(LED_OFF);
} }
@@ -948,21 +885,16 @@ void startGUITask(void const *argument __unused) {
OLED::setCursor(0, 0); OLED::setCursor(0, 0);
if (systemSettings.detailedIDLE) { if (systemSettings.detailedIDLE) {
if (isTipDisconnected()) { if (isTipDisconnected()) {
OLED::print(translatedString(Tr->TipDisconnectedString), OLED::print(translatedString(Tr->TipDisconnectedString), FontStyle::SMALL);
FontStyle::SMALL);
} else { } else {
OLED::print(translatedString(Tr->IdleTipString), OLED::print(translatedString(Tr->IdleTipString), FontStyle::SMALL);
FontStyle::SMALL);
gui_drawTipTemp(false, FontStyle::SMALL); gui_drawTipTemp(false, FontStyle::SMALL);
OLED::print(translatedString(Tr->IdleSetString), OLED::print(translatedString(Tr->IdleSetString), FontStyle::SMALL);
FontStyle::SMALL); OLED::printNumber(systemSettings.SolderingTemp, 3, FontStyle::SMALL);
OLED::printNumber(systemSettings.SolderingTemp, 3,
FontStyle::SMALL);
} }
OLED::setCursor(0, 8); OLED::setCursor(0, 8);
OLED::print(translatedString(Tr->InputVoltageString), OLED::print(translatedString(Tr->InputVoltageString), FontStyle::SMALL);
FontStyle::SMALL);
printVoltage(); printVoltage();
} else { } else {
@@ -1008,8 +940,7 @@ void startGUITask(void const *argument __unused) {
// If we have a tip connected draw the temp, if not we leave it blank // If we have a tip connected draw the temp, if not we leave it blank
if (!tipDisconnectedDisplay) { if (!tipDisconnectedDisplay) {
// draw in the temp // draw in the temp
if (!(systemSettings.coolingTempBlink if (!(systemSettings.coolingTempBlink && (xTaskGetTickCount() % 260 < 160)))
&& (xTaskGetTickCount() % 260 < 160)))
gui_drawTipTemp(false, FontStyle::LARGE); // draw in the temp gui_drawTipTemp(false, FontStyle::LARGE); // draw in the temp
} else { } else {
// Draw in missing tip symbol // Draw in missing tip symbol