Small additions, changes and bug fixes. Some triggered a revision and regeneration of all the libraries and the example projects. There are also two new libraries and a demonstration project for them that deserve their own articles.
Additions
When generating the code, VPC adds some clock values (from the clock settings window) on top of the “main.h” header of the project. These values are used mainly to calculate timer frequencies (required by the project and/or libraries).
#define HSI_VALUE 16000000
#define HSE_VALUE 8000000
#define HCLK_VALUE 32000000
#define APB1_T_VALUE 32000000
#define APB2_T_VALUE 32000000
#include "stm32l1xx.h"
Changes
The header file stm32l1xx_tim.h is now permanently added in the list of included headers in main.h. The same with the stm32l1xx_tim.c, permanently included in Makefile. This is for the proper functioning of the newly added libraries.
The second change is about the suffix added to the user defined pin labels. Instead of
_GPIO_Port
now is just
_Port
This change triggered modifications in the current libraries and a regeneration of all the example projects. While all compile just fine, not all are retested yet on real hardware. I don’t expect surprises but now you know.
The third change refers at how SysTick is managed. Previously, my_ticks global variable was incremented to simulate the millis() function from Arduino libraries but that will overflow at some point in time, causing firmware problems. Now the code is as it should have been from the beginning:
void SysTick_Handler(void)
{
if (my_ticks > 0) my_ticks--;
}
Of course, my_delay_ms() function is changed accordingly:
void my_delay_ms(uint16_t ms){
my_ticks = ms;
while(my_ticks > 0);
}
Bug fixes
In the generated code for the TIM7 peripheral, there was a wrong reference to the TIM6 peripheral. Fixed.
Note
This time, a Linux 64bit executable of VPC is provided in repository. If you can’t compile your own (but I advice you to try), you can use the one provided (compiled on a Linux Fedora 30 workstation – man, so far away from my Linux Fedora 1.0! At first, I did not liked the fact that there won’t be a free Linux Red Hat distribution any more, but now Fedora is the best Linux distribution ever for developers. I think it always was. Well, enough with the rant).
Everything published in repository.