Sometimes it takes a while until things get better. Same thing applies to software: from time to time a refactoring and simplification makes sense. Especially if the underlying technology has been improved. With CodeWarrior for MCU10.3 available, it is time to refactor the LED component.
The ‘old’ way using GPIO_LDD
In my tutorial about using LED’s with the Freedom board, I showed how to use an LED component. For this, I used GPIO_LDD as this was the only way possible at this time:
GPIO_LDD is rather complex to set up. Even more, it was not possible to use a single interface for my LED. I had to add a dual interface. The connection from the LED component to the GPIO_LDD was done with special settings in the LED component properties:
So for ARM/Kinetis, it was using a LDD interface, where it was using BitIO for every other architecture. BitIO is using BitIO_LDD
The new way: BitIO is using BitIO_LDD
With the availability of CodeWarrior for MCU10.3, things finally have been improved: it is possible to use BitIO_LDD . CodeWarrior for MCU10.3 supports now the earlier BitIO component, and interfaces it automatically with the BitIO_LDD sub-component. With this, it is possible that I get rid of my LDD interface . Which makes everything easier to use.
Migrating to the new component
Unfortunately I have not found a good way to make things backward compatible. This means if you use that new LED component V1.047 or later, you need to configure it for the LED used. To transform a project from the ‘old’ the new simplified way, following steps need to be performed:
- Download the new LED component and install it in CodeWarrior/Processor Expert
- Open in CodeWarrior the project. The LED’s will show errors as not configured properly yet.
- Remove the GPIO_LDD’s used for the LEDs
- For each LED, configure the LED pin according to the pin connection:
What happens is that for each LED, the BitIO sub-component will automatically add and configure a BitIO_LDD component:
Creating new projects will automatically use the new LED interface, so no extra step is needed.
Although things are not backward compatible, the usage of the new LED component is now simpler with the usage of BitIO_LDD. The new LED component is available here. I have updated the Freedom Board example projects too.