1414SPIClass SPI;
1515
1616/* *
17- * @brief Default constructor. Uses pin configuration of variant.h.
18- */
19- SPIClass::SPIClass ()
20- {
21- _spi.pin_miso = digitalPinToPinName (MISO);
22- _spi.pin_mosi = digitalPinToPinName (MOSI);
23- _spi.pin_sclk = digitalPinToPinName (SCK);
24- _spi.pin_ssel = NC;
25- }
26-
27- /* *
28- * @brief Constructor to create another SPI instance attached to another SPI
29- * peripheral different of the default SPI. All pins must be attached to
30- * the same SPI peripheral. See datasheet of the microcontroller.
17+ * @brief Default Constructor. Uses pin configuration of default SPI
18+ * defined in the variant*.h.
19+ * To create another SPI instance attached to another SPI
20+ * peripheral gave the pins as parameters to the constructor.
21+ * @note All pins must be attached to the same SPI peripheral.
22+ * See datasheet of the microcontroller.
3123 * @param mosi: SPI mosi pin. Accepted format: number or Arduino format (Dx)
32- * or ST format (Pxy).
24+ * or ST format (Pxy). Default is MOSI pin of the default SPI peripheral.
3325 * @param miso: SPI miso pin. Accepted format: number or Arduino format (Dx)
34- * or ST format (Pxy).
26+ * or ST format (Pxy). Default is MISO pin of the default SPI peripheral.
3527 * @param sclk: SPI clock pin. Accepted format: number or Arduino format (Dx)
36- * or ST format (Pxy).
28+ * or ST format (Pxy). Default is SCK pin of the default SPI peripheral.
3729 * @param ssel: SPI ssel pin (optional). Accepted format: number or
3830 * Arduino format (Dx) or ST format (Pxy). By default is set to NC.
3931 * This pin must correspond to a hardware CS pin which can be managed
@@ -45,6 +37,7 @@ SPIClass::SPIClass()
4537 */
4638SPIClass::SPIClass (uint32_t mosi, uint32_t miso, uint32_t sclk, uint32_t ssel)
4739{
40+ memset ((void *)&_spi, 0 , sizeof (_spi));
4841 _spi.pin_miso = digitalPinToPinName (miso);
4942 _spi.pin_mosi = digitalPinToPinName (mosi);
5043 _spi.pin_sclk = digitalPinToPinName (sclk);
0 commit comments