I have changed delay() from a class to a simple C and saved 5kB we need to look why classes are taking so much place

interrupts
key 4 years ago
parent 76c339af27
commit aeda7542d3

@ -0,0 +1,16 @@
#ifndef _DELAY_H_
#define _DELAY_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
void delayMs(uint16_t delay);
#ifdef __cplusplus
}
#endif
#endif

@ -1,16 +0,0 @@
#ifndef _DELAY_H_
#define _DELAY_H_
#include <stdint.h>
class Delay
{
public:
Delay();
~Delay();
void ms(uint16_t delay);
private:
};
#endif

@ -4,7 +4,7 @@ set (STMSRC_INCLUDES
set(STMSRC_SOURCES
stm32f0xx_csl.c
stm32f0xx_it.c
#stm32f0xx_it.c
system_stm32f0xx.c
)
@ -15,7 +15,7 @@ target_include_directories(stmSources PUBLIC ${STMSRC_INCLUDES})
target_link_libraries(stmSources sub::drivers)
add_library(sub::sources ALIAS stmSources)
add_library(stmDelay delay.cpp)
add_library(stmDelay delay.c)
target_compile_options(stmDelay PRIVATE ${C_FLAGS})
target_compile_definitions(stmDelay PRIVATE ${C_DEFS})
target_include_directories(stmDelay PUBLIC ${INTERFACES_DIR} ${CSL_INCLUDES})

@ -0,0 +1,7 @@
#include "delay.h"
#include "../Inc/stm32f0xx_csl.h"
void delayMs(uint16_t delay)
{
LL_mDelay(delay);
}

@ -1,17 +0,0 @@
#include "delay.hpp"
#include "../Inc/stm32f0xx_csl.h"
Delay::Delay()
{
}
Delay::~Delay()
{
}
void Delay::ms(uint16_t delay)
{
LL_mDelay(delay);
}

@ -76,7 +76,7 @@ int stmStart()
/* System interrupt init*/
/* SysTick_IRQn interrupt configuration */
NVIC_SetPriority(SysTick_IRQn, 3);
// NVIC_SetPriority(SysTick_IRQn, 3);
/* USER CODE BEGIN Init */
@ -171,7 +171,7 @@ void Error_Handler(void)
{
/* USER CODE BEGIN Error_Handler_Debug */
/* User can add his own implementation to report the HAL error return state */
__disable_irq();
// __disable_irq();
while (1)
{
}
@ -186,13 +186,13 @@ void Error_Handler(void)
* @param line: assert_param error line source number
* @retval None
*/
void assert_failed(uint8_t *file, uint32_t line)
{
//void assert_failed(uint8_t *file, uint32_t line)
//{
/* USER CODE BEGIN 6 */
/* User can add his own implementation to report the file name and line number,
ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
/* USER CODE END 6 */
}
//}
#endif /* USE_FULL_ASSERT */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

@ -1,5 +1,4 @@
#include "bsl_nucleo_f042k6.hpp"
//#include"bsl/csl/interfaces/delay.hpp"
Nucleo_f042k6::Nucleo_f042k6()
{
@ -15,7 +14,5 @@ void Nucleo_f042k6::init()
void Nucleo_f042k6::running()
{
delay.ms(1000);
delay.ms(1000);
}

@ -2,7 +2,6 @@
#define BSL_NUCLEO_F042K6_H
#include "../csl/interfaces/pin.h"
#include "../csl/interfaces/delay.hpp"
#include "stm32f0xx_csl.h"
class Nucleo_f042k6
@ -17,7 +16,6 @@ class Nucleo_f042k6
private :
Delay delay;
};
#endif /* BSL_NUCLEO_F042K6_H */

@ -1,13 +1,10 @@
#include"main.hpp"
#include"bsl/csl/interfaces/delay.hpp"
#include"bsl/csl/interfaces/delay.h"
#include"stm32f0xx_csl.h"
int main(int argc, char *argv[])
{
Delay delay;
uint8_t i = 0;
stmStart();
@ -17,9 +14,9 @@ int main(int argc, char *argv[])
for(i = 0 ; i < 10 ; i++)
{
delay.ms(100);
delayMs(100);
pinToggle(pinB3);
delay.ms(100);
delayMs(100);
}
pinWrite(pinB3,0);

Loading…
Cancel
Save