Auto TOSLINK switch
Software architecture
The source code of the firmware is written in ANSI C and has been structured to be as portable as possible, providing firmware development is inherently architecture dependent. The project is separated into 3 distinct layers:
-
Main Application
-
Hardware Abstraction Layer (HAL)
-
Device specific code
The Main application code is, as it's name imply, the logic that drives the system. It decide wether a channel has a valid feed or not and applies the priority logic and switch inputs.
The Device specific code interface the microcontroller's peripherals.
The HAL layer binds Main Application and Device specific code together.
Using this structure, it's ease porting code to another architecture. One would simply need to supply it's own device specific code and link the 2 upper layers to it.
As previously stated, the PIC18F25K50 has been selected because development tools are very cheap. MPLABX is Microchip's freely available IDE. Microchip also provides a free version of it's XC8 compiler suite that is adequate to build this project. To setup a working development environment, the user simply needs to download and install these 2 components available on Microchip's website.
As reference, environment setup has been configured using MPLABX IDE 3.26 and XC8 1.37 without any issue. Newer versions should also be compatible.
The TOSLINK switcher project does not make use of the "Microchip Library Application" to avoid any potential licensing issues with the GPL. This statement is also valid for the Diolan bootloader source code.