# Templates definition file
# (C) 2020 Officina Turini
#
# Keywords version 1.0.0 - 2020/01/28
#
# Keywords:
# # This is a comment
# TIT: Template name
# DOC: About this template
# INC: Necessary include files
# INI: Init code
# COD: Example code
# DEF: Defines list
# END: End of template definitions
#
TIT:PRINTF - Formatted print
DOC:
"printf" is the name of one of the main C output functions, and stands for "print formatted".
printf format strings are complementary to scanf format strings, which provide formatted input (parsing).
In both cases these provide simple functionality and fixed format compared to more sophisticated and flexible
template engines or parsers, but are sufficient for many purposes.
Mismatches between the format specifiers and type of the data can cause crashes and other vulnerabilities.
From: https://en.wikipedia.org/wiki/Printf_format_string
Rev. 1.0
Manuele Turini
END:
INC:otSerial,otMalloc,otString,otMath,otPrintf
INI:
UartEnableSignals(UART0);
UartSetBaud(UART0, 115200);
_initMalloc();
setStdout(4096, UART0); // printf output is now directed on UART0
END:
COD:
printf("Hello world\n");
END:
END:
#
#
TIT:SD - Secure Digital
DOC:
Secure Digital, officially abbreviated as SD, is a proprietary non-volatile memory card format
developed by the SD Card Association (SDA) for use in portable devices.
The standard was introduced in August 1999 by joint efforts between SanDisk,
Panasonic (Matsushita Electric) and Toshiba as an improvement over MultiMediaCards (MMC),
and has become the industry standard.
From: https://en.wikipedia.org/wiki/SD_card
Rev. 1.0
Manuele Turini
END:
INC:otPort,otSD,otSerial,otTimer,otPrintfLite
INI:
// Setup the UART0 used by printf
UartEnableSignals(UART0);
UartSetBaud(UART0, 115200);
// Init printf
setStdout(UART0); // printf output is now directed on UART0
SdPower(true);
SdOpen();
END:
COD:
// ...
SdClose();
HIBE;
END:
END:
#
#
TIT:SPI - Serial Peripheral Interface
DOC:
Synchronous serial communication interface specification used for short-distance communication.
The interface was developed by Motorola in the mid-1980s and has become a de facto standard.
SPI devices communicate in full duplex mode using a master-slave architecture.
Sometimes SPI is called a four-wire serial bus.
From: https://en.wikipedia.org/wiki/Serial_Peripheral_Interface
Rev. 1.0
Manuele Turini
END:
INC:otFPGA,otPort,otSpi,otSerial,otPrintfLite
INI:
// Setup the UART0 used by printf
UartEnableSignals(UART0);
UartSetBaud(UART0, 115200);
// Init printf
setStdout(UART0); // printf output is now directed on UART0
// Init the FPGA, slave selection are made with it
FpgaInit();
// Setup a SPI channel
SpiChannel(SA_EEPROM, 10, 0, 0);
END:
COD:
// Select EEPROM channel
SpiSet(SA_EEPROM);
// Activate CS
SpiCs(true);
// ...
SpiPut(0);
// ...
SpiCs(false);
// ...
END:
END:
*