|mntmn 7351f1f4f1 WIP: remove charger i2c comms for ref2d3||2 weeks ago|
|boards||2 weeks ago|
|cli||6 months ago|
|core||3 months ago|
|drivers||6 months ago|
|localisation||6 months ago|
|protocol||6 months ago|
|README.md||6 months ago|
|asserts.h||6 months ago|
|binary.h||6 months ago|
|errors.h||6 months ago|
|fixed.h||6 months ago|
|log.h||6 months ago|
|printf-retarget.c||6 months ago|
|projectconfig.h||6 months ago|
|sysdefs.h||6 months ago|
To make it easier to use the code base across a number of projects, the ‘int main(void)’ function is placed inside a board-specific file in ‘/src/boards/board_name/‘, along with a header file containing all of the configuration flags for that project.
You select a target board by adding a single #define somewhere in your project (this should already be done for you in the LPCXpresso and Crossworks project files, as well as in the Makefile), and projectconfig.h in the root src folder will point the code base to the right board file based on this define:
#if defined(CFG_BRD_LPCXPRESSO_LPC1347) #include "boards/lpcxpresso1347/board_lpcxpresso1347.h" #elif defined(CFG_BRD_RF1GHZNODE) #include "boards/rf1ghznode/board_rf1ghznode.h" #elif defined(CFG_BRD_RF1GHZUSB) #include "boards/rf1ghzusb/board_rf1ghzusb.h" #elif defined (CFG_BRD_LPCNFC) #include "boards/lpcnfc/board_lpcnfc.h" #elif defined (CFG_BRD_LPCSTEPPER) #include "boards/lpcstepper/board_lpcstepper.h" #elif defined (CFG_BRD_SIMULATOR) #include "boards/simulator/board_simulator.h" #else #error "No CFG_BRD_* has been defined" #endif
To maintain a basic structure in the code base, the code is divided into several folders:
Board or project-specific code, including the board-specific ‘main’ function that serves as the entry point for your projects, and any board/project-specific config settings. See projectconfig.h for more information on selecting a target board.
Core code for the text-based command-line interface. This is only used if CFG_INTERFACE is enabled in your board config file, in combination with either CFG_PRINTF_USBCDC or CFG_PRINTF_UART.
Drivers for the core peripherals on the MCU, such as GPIO, USB, ADC, the delay timer, etc.
Drivers for any HW other than the core MCU peripherals, such as various sensors or displays, and some helper functions like code to bit-bang SPI, simple DSP filters, etc.
A rudimentary attempt at providing localised text to allow multiple languages in one firmware build (experimental code, and likely to change in future releases)
A simple binary protocol to handle commands via binary serial buses like USB, SPI or I2C. This is still in development and should be considered experimental code, but the goal is to eventually provide an easy way to interact with a PC via USB using a class like USB HID or via another MCU with SPI.