Standardizing ASTRA's embedded code.
- Overview
- Usage in PlatformIO
- Naming conventions
- File List
- Theory
- Updating this Repository
- Responsible People
This library provides classes, structs, functions, pin number macros, and team-wide constants, just to name a few. Here are a few examples:
parseInput(const String, std::vector<String>&): takes input from USB or UART and separates it into the vector, using commas as delimiters. Very useful for dealing with commands and data input from other mcu's.CAN_sendDutyCycle(uint8_t, AstraCAN&): Formats and sends a CAN packet to a REV motor controller with a duty cycle. All communication with REV motor controllers should reside inAstraREVCAN.{h,cpp}.isCalibrated(Adafruit_BNO055&): Attempts to check whether the BNO has been calibrated in EEPROM.SERIAL_BAUD: Standard baudrate for USB Serial used by all of ASTRA's mcu's.
- Add the following line to
lib_depsin your/platformio.ini:
https://github.com/SHC-ASTRA/astra-embedded-lib
- Add the dependencies you need from
include/. E.g.,#include "AstraVicCAN.h" - Make sure to grab the correct dependencies for
/platformio.inifrom the library headers.
- Copy the example file from
/.pio/libdeps/[board]/astra-Embedded-Lib/examples/Template/ - Grab whatever headers you need from
include/ - Get writing!
PlatformIO provides a button which will check for updates in all of your dependencies and update them for you. Here's how to take advantage of it:
- Open the PlatformIO side-bar (the alien on the left)
- Under "Project Tasks" (the top pane), for each microcontroller specified in your platformio.ini, there are a handful of folders. "General" and "Platform" should be open already.
- Open the "Dependencies" folder.
- Click "Update".
- Library files - Depending on context, either the files generally contained in the library, or the main functional C++ files containing functions and classes.
- Library files - Camel case with the first letter of all words, including the first, capitalized. Ex:
AstraArm.cpp
AstraArm.h/.cpp- ArmAstraMotors.h/.cpp- REV motorAstraNP.h/.cpp- Status indicator using NeoPixelAstraVicCAN.h- Serial/CAN-analogous communication standard
library.json- PlatformIO stuffREADME.md- this file. Documentation and GitHub front page.
AstraREVCAN.h/.cpp- ASTRA's implementation of CAN communication with REV motorsAstraSensors.h/.cpp- functions for sensorsAstraMisc.h/.cpp- functions, consts, etc. useful to all ASTRA projects.
main.cppincludes all the library headers it needs- Only if a library header is included by
main.cppwill it throw#includeerrors. If the header isn't included inmain.cpp, then no include errors, but if it is, then you will get required include errors. .cppfiles enable themselves when all of its required external libraries are found. External libraries are 90% of the reason the.cppfiles need the option to be disabled.
- Place the header file in
include/and its implementation.cppinsrc/. - Choose a library macro to enable its files.
- Place the library macro in this file for documentation.
Name: David Sharpe
Email: ds0196@uah.edu
Name: David Sharpe
Email: ds0196@uah.edu