Skip to content

Commit fb3aad1

Browse files
committed
Adding spacers for better readability.
1 parent eb08565 commit fb3aad1

File tree

2 files changed

+63
-2
lines changed

2 files changed

+63
-2
lines changed

libraries/SPI/SPI.cpp

+41-1
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,45 @@
1111
* published by the Free Software Foundation.
1212
*/
1313

14+
/**************************************************************************************
15+
* INCLUDE
16+
**************************************************************************************/
17+
1418
#include "SPI.h"
1519

20+
/**************************************************************************************
21+
* NAMESPACE
22+
**************************************************************************************/
23+
1624
using namespace arduino;
1725

26+
/**************************************************************************************
27+
* EXTERN GLOBAL CONSTANTS
28+
**************************************************************************************/
29+
1830
extern const spi_extended_cfg_t g_spi0_ext_cfg;
1931
extern const spi_extended_cfg_t g_spi1_ext_cfg;
2032
extern const sci_spi_extended_cfg_t g_spi2_cfg_extend;
2133

34+
/**************************************************************************************
35+
* STATIC MEMBER INITIALISATION
36+
**************************************************************************************/
37+
2238
uint8_t ArduinoSPI::initialized = 0;
2339
uint8_t ArduinoSPI::interruptMode = 0;
2440
uint8_t ArduinoSPI::interruptMask = 0;
2541
uint8_t ArduinoSPI::interruptSave = 0;
2642

43+
/**************************************************************************************
44+
* GLOBAL MEMBER VARIABLES
45+
**************************************************************************************/
46+
2747
static spi_event_t _spi_cb_event[13] = {SPI_EVENT_TRANSFER_ABORTED};
2848

49+
/**************************************************************************************
50+
* CTOR/DTOR
51+
**************************************************************************************/
52+
2953
ArduinoSPI::ArduinoSPI(spi_ctrl_t *g_spi_ctrl
3054
,const spi_cfg_t *g_spi_cfg
3155
,const spi_extended_cfg_t *g_spi_ext_cfg, int ch):
@@ -54,6 +78,10 @@ ArduinoSPI::ArduinoSPI(int ch, bool isSci):
5478
{
5579
}
5680

81+
/**************************************************************************************
82+
* PUBLIC MEMBER FUNCTIONS
83+
**************************************************************************************/
84+
5785
void ArduinoSPI::begin()
5886
{
5987
bool isSPIObject = false;
@@ -244,6 +272,10 @@ void ArduinoSPI::detachInterrupt() {
244272

245273
}
246274

275+
/**************************************************************************************
276+
* PRIVATE MEMBER FUNCTIONS
277+
**************************************************************************************/
278+
247279
void ArduinoSPI::config(arduino::SPISettings const & settings)
248280
{
249281
if (_is_sci)
@@ -437,6 +469,10 @@ void ArduinoSPI::enableSciSpiIrqs() {
437469

438470
}
439471

472+
/**************************************************************************************
473+
* CALLBACKS FOR FSP FRAMEWORK
474+
**************************************************************************************/
475+
440476
void spi_callback(spi_callback_args_t *p_args) {
441477
if (SPI_EVENT_TRANSFER_COMPLETE == p_args->event) {
442478
_spi_cb_event[p_args->channel] = SPI_EVENT_TRANSFER_COMPLETE;
@@ -458,10 +494,14 @@ void sci_spi_callback(spi_callback_args_t *p_args) {
458494
}
459495
}
460496

497+
/**************************************************************************************
498+
* OBJECT INSTANTIATION
499+
**************************************************************************************/
500+
461501
#if SPI_HOWMANY > 0
462502
ArduinoSPI SPI(SPI_CHANNEL, (bool)IS_SPI_SCI);
463503
#endif
464504

465505
#if SPI_HOWMANY > 1
466506
ArduinoSPI SPI1(SPI1_CHANNEL, (bool)IS_SPI1_SCI);
467-
#endif
507+
#endif

libraries/SPI/SPI.h

+22-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
#ifndef _SPI_H_INCLUDED
1515
#define _SPI_H_INCLUDED
1616

17+
/**************************************************************************************
18+
* INCLUDE
19+
**************************************************************************************/
20+
1721
#include <Arduino.h>
1822
#include "api/HardwareSPI.h"
1923

@@ -25,8 +29,16 @@
2529
//extern const spi_extended_cfg_t g_spi0_ext_cfg;
2630
//extern const sci_spi_extended_cfg_t g_spi1_cfg_extend;
2731

32+
/**************************************************************************************
33+
* NAMESPACE
34+
**************************************************************************************/
35+
2836
namespace arduino {
2937

38+
/**************************************************************************************
39+
* CLASS DECLARATION
40+
**************************************************************************************/
41+
3042
class ArduinoSPI : public SPIClass
3143
{
3244
public:
@@ -62,6 +74,7 @@ class ArduinoSPI : public SPIClass
6274
void enableSciSpiIrqs();
6375

6476
arduino::SPISettings const DEFAULT_SPI_SETTINGS = arduino::SPISettings(1000000, MSBFIRST, arduino::SPI_MODE0);
77+
arduino::SPISettings _settings = arduino::SPISettings(0, MSBFIRST, arduino::SPI_MODE0);
6578
static uint8_t initialized;
6679
static uint8_t interruptMode; // 0=none, 1=mask, 2=global
6780
static uint8_t interruptMask; // which interrupts to mask
@@ -84,7 +97,15 @@ class ArduinoSPI : public SPIClass
8497
static std::tuple<spi_clk_phase_t, spi_clk_polarity_t, spi_bit_order_t> toFspSpiConfig(arduino::SPISettings const & settings);
8598
};
8699

87-
}
100+
/**************************************************************************************
101+
* NAMESPACE
102+
**************************************************************************************/
103+
104+
} /* arduino */
105+
106+
/**************************************************************************************
107+
* EXTERN DECLARATION
108+
**************************************************************************************/
88109

89110
#if SPI_HOWMANY > 0
90111
extern arduino::ArduinoSPI SPI;

0 commit comments

Comments
 (0)