The hardware driver programs are totally rewritten for version 2.5.
I abandon AVR-GCC and adopt
AVR-G++
, the GNU C++ compiler for AVR, to develop the hardware driver. Thanks to the object-oriented
programming (OOP) features, I encapsulated the drivers for all hardware modules into classes
and offer users interfaces to initialize and to control the modules; thus, the code becomes
much more user friendly, secure, and flexible than before; furthermore, the maintenance and
update to the driver programs are easier for me. The driver for each module is also more
sophisticated: it can use different functions of a module when being passed specific
parameters. For example, users can determine whether to initialize a T/C to pulse-width
modulation mode, timer mode, or any other mode.
However, AVR-G++ still has some
restrictions such as not supporting “new” and “delete” operators; thus, I cannot create
objects dynamically. Although the standard C Language function malloc() can allocate memory
dynamically while function free() can release the memory, they do not support OOP: they never
call the constructor and destructor of an object; therefore, AVR-G++ still does not meet my
require perfectly.
During the development of driver version 2, I use a different IDE
from that used in the previous version because the new IDE –
Eclipse
– is more powerful in source code management and in providing code context, which enhances
my coding efficiency considerably.
The driver program for version 1.0 instructs
users to write foreground- background processing client code; nonetheless, the driver for
version 2.5 equips a preemptive RTOS called
FreeRTOS
, which also supports time slicing tasks; thus, the user code is not an endless loop,
instead, should be written in several subroutines. I embed AVRX into my own programs to make
it more powerful: users can select different tasks to run each time when the system
starts.