Configuration / Initializing the Board
When using a Cow Pi board, a single function call is sufficient to configure all pins and fully initialize the board if no Expansion Options are used. (If expansions are used, their pins must must be configured separately, as must their initialization.)
The cowpi_setup() function does three things:
It initializes the standard input/output/error FILE streams at the specified bitrate
It configures the display module using the same
cowpi_display_module_tandcowpi_display_module_protocol_targuments as the CowPi_stdio library’scowpi_add_display_module()function - The function returns a pointer to the display module’s FILE streamIt assigns the peripheral inputs and outputs to the microcontroller pins appropriate to your particular Cow Pi board, and it configures the pins accordingly
-
FILE *cowpi_setup(unsigned long console_bitrate, cowpi_display_module_t display_module, cowpi_display_module_protocol_t communication_protocol)
Configures the microcontroller’s pins for the expected hardware setup, configures
stdoutandstdinto use the USB-based serial interface between the microcontroller and the host computer, and configures the library to work with the specified display module and communication protocol.If the Morse Code “font” is available, then
stderrwill use Morse Code on the right LED. Otherwise,stderrwill be aliased tostdout.If the USB-based serial interface should not be configured, then set the
console_bitrateto 0. If there is not yet a display module, then set thedisplay_moduleto{.display_module = NO_MODULE}. If there is not yet a display module (and the communication protocol’s pins are not otherwise used) then you may assigncommunication_protocolto{.protocol = NO_PROTOCOL}.See also
cowpi_stdio_setup()in CowPi_stdioSee also
cowpi_add_display_module()in CowPi_stdio- Parameters:
console_bitrate – the serial interface’s bitrate, or
0if the serial interface should not be configureddisplay_module – the display module’s details
communication_protocol – the communication protocol’s details
- Returns:
a pointer to a
FILEstream for the display module, orNULLif a stream could not be created