metaonly module ti.mcu.msp430.driverlib.product.DriverLib |
 |
MSP430 Low-Level Peripheral Driver Support Library
DriverLib provides low-level peripheral functions that enables simple
and efficient control of peripherals found on the MSP430. The functions
are provided in source form to allow maximum reuse in a variety of
development environments.
[
more ... ]
var DriverLib = xdc.useModule('ti.mcu.msp430.driverlib.product.DriverLib');
module-wide functions
DETAILS
DriverLib provides low-level peripheral functions that enables simple
and efficient control of peripherals found on the MSP430. The functions
are provided in source form to allow maximum reuse in a variety of
development environments.
This module provides the "home page" for DriverLib within the Grace
graphical configuration editor. This enables projects that support
graphical configuration to easily integrate with DriverLib. In particular,
for these projects
- DriverLib sources are automatically compiled for your specific device
- compiler and linker options are automatically added, and
- you can easily switch between different versions of DriverLib on
a per-project basis
This support makes it simple to create Code Composer Studio (CCS) projects
that enable you to easily build and manage specific versions of pre-built
DriveLib libraries. These pre-built libraries can then be referenced by
one or more of your existing projects.
USING DRIVERLIB
Using DriverLib is a simple three step process.
- modify your .c sources to include the appropriate peripheral header
file and call the desired function.
- modify your compiler project options to include the directory
containing the DriverLib product's root directory.
- modify your linker project options to include the path to a
pre-built library of the appropriate DriverLib sources.
Suppose, for example, you want to use the WDT_A watchdog timer functions of
DriverLib. Your source might be modified to look like the following:
#include <driverlib/MSP430FR57xx/wdt_a.h> // include header for the WDT_A peripheral
int main(void) {
WDT_A_hold(__MSP430_BASEADDRESS_WDT_A__); // disable the WDT_A watchdog timer
:
return (0);
}
If you're using Code Composer Studio (CCS), DriverLib automatically defines
a "macro", named ${MSP430_DRIVERLIB_ROOT}, that should be used to specify
include paths. This ensures that your projects are portable among users
that may have different installation directories. In this case, your
compiler include options should include:
-I ${MSP430_DRIVERLIB_ROOT}
Finally, suppose you're created a project named driverlib_5739 which
contains a pre-built DriverLib library for the MSP430FR5739. Your linker
options should include:
-l "${workspace_loc:/driverlib_5739/src/driverlib/driverlib.lib}"
where, ${workspace_loc: ...} is an Eclipse/CCS macro that
expands to an absolute path to the file src/driverlib/driverlib.lib
located in the project named driverlib_5739. Again, using the Eclipse
${...} macros enables projects to be directly imported by other
developers even if they have different workspace or product installation
paths.
BUILDING DRIVERLIB
If you are using Code Composer Studio (CCS), it is easy to build a library
for a specific device.
- Create a new project: File -> New -> CCS Project
- Select a device and a project name, say MSP430FR5739 and
"driverlib_5739"
- In the "Project templates and examples" selection box, select the
"Configurable DriverLib Example" template under the
"MSP430 DriverLib" heading. If you don't see this heading, the
device you selected is not supported by DriverLib.
- Click the "Finish" button. A new project named driverlib_5739
will be created and added to your workspace.
- Build the project: Project -> Build Project
Once the project is finished building, a complete DriverLib library, named
driverlib.lib, will exist in the ./src/driverlib folder of the project
and can be referenced by any other project in your workspace via the
Eclipse/CCS macro:
${workspace_loc:/driverlib_5739/src/driverlib/driverlib.lib}
generated on Thu, 27 Feb 2020 18:39:55 GMT