This library contains drivers most commonly used for boards on the Solar Car Team.
Drivers are split up and somewhat independent of one-another. There are dependencies to the Utils drivers. All other dependencies are managed through the use of function pointers to invert dependencies.
Any functions that begin with a double underscrore __function_name
should not be called by the user in production code!
The table below provides a brief description of each driver and has a link to a more detailed README for those drivers.
Driver | Description |
---|---|
CAN | Generic CAN Drivers for receiving from and sending messages to a CAN Controller |
CAN Controller | Device-specific driver implementations of a generic CAN Controller interface (used by the CAN library) |
Interrupts | Generic driver for handling and dispatching interrupts on specific pins for any microcontroller |
Microcontroller | Device-specific drivers for a microcontroller |
Pin Control | Generic driver for control pins on a microcontroller |
SPI | Generic SPI sending and receiving |
Testing | Unit Testing Framework |
Utils | Awesome utilities that you can use in drivers, or your code. (Exceptions, bit manipulation, memory, queues, etc...) |
Examples | Crazy-good examples to show you how to do anything in this library!! If something you want to know about is not in here, try taking a look at the .test file for that driver! |
Unit Testing | Learn about running and writing Unit Tests for this library and your code that uses this library |
If you're writing software for a board, you should definitely be using this driver library since it has Unit Tests to verify that it is fully functional.
This driver library is designed to be used as a Git Submodule so it can be updated on all projects really easily. Before you dive into submodules, you should probably be familiar with a basic understanding of Git.
For a general view of submodules read the documentation, and then talk to a team member who has experience, it's pretty easy.
This is also a good article (if it ever goes offline there is a copy saved here).
To use this project in Code Composer Studio you need to be compiling your projects using MSP430-GCC.
For information on the unit tests, writing them, and compiling them, read this file.
The following table lists the data types (typedef
s) defined by this library:
Name | Underlying Type |
---|---|
int8_t |
signed char |
uint8_t |
unsigned char |
int16_t |
short int |
uint16_t |
unsigned short int |
int32_t |
long int |
uint32_t |
unsigned long int |
int64_t |
long long int |
uint64_t |
unsigned long long int |
vuint8_t |
volatile unsigned char |
vuint16_t |
volatile unsigned short int |
io_pin |
uint8_t |
bool |
Enum: False , Failure , Busy , No , or Disable True , Success , Yes , or Enable |
pin_mode |
Enum: Input or Output |
pin_level |
Enum: Low or High |
spi_bus |
Microcontrollers define how many SPI buses they have, will be in the format of SPI_BUS_x |
group_64 |
Union. (see file) |
can_message |
Struct. (see file) |
These are all defined in datatypes.h
.
The folling table lists the constants defined by this library:
Name | Value |
---|---|
NULL |
0x00 |
NOTHING |
NULL |
EMPTY |
NULL |
NO_PIN |
NULL |
NO_REGISTER |
NULL |
NO_PORT |
NULL |
NO_BIT |
NULL |
NO_MESSAGE |
NULL |
NO_VECTOR |
NULL |
CAN_OK |
0x0001 |
CAN_RTR |
0xFFFC |
CAN_WAKE |
0xFFFD |
CAN_MERROR |
0xFFFE |
CAN_ERROR |
0xFFFF |
BIT0 - BITF |
0x0001 - 0x8000 |
Looking through this project you will see different file extensions, namely .driver
and .test
.
These are needed because Code Composer Studio will compile any, and all .c
files in the project, and we don't want the unit test stuff to be included in the firmware that gets put on microcontrollers, so this is the solution.
This project is possible by the awesome open source utilities by the team at Throw The Switch
For unit testing, Unity is used, (see the LICENSE here).
CException is used for added exception handling (see the LICENSE here).