@@ -41,30 +41,30 @@ SPIClass::SPIClass(uint8_t spi_bus)
41
41
,_div(0 )
42
42
,_freq(1000000 )
43
43
,_inTransaction(false )
44
- #if !CONFIG_DISABLE_HAL_LOCKS
44
+ #if !CONFIG_DISABLE_HAL_LOCKS
45
45
,paramLock(NULL )
46
- #endif
47
46
{
48
- #if !CONFIG_DISABLE_HAL_LOCKS
49
47
if (paramLock==NULL ){
50
48
paramLock = xSemaphoreCreateMutex ();
51
49
if (paramLock==NULL ){
52
50
log_e (" xSemaphoreCreateMutex failed" );
53
51
return ;
54
52
}
55
53
}
56
- #endif
57
54
}
55
+ #else
56
+ {}
57
+ #endif
58
58
59
59
SPIClass::~SPIClass ()
60
60
{
61
61
end ();
62
- #if !CONFIG_DISABLE_HAL_LOCKS
62
+ #if !CONFIG_DISABLE_HAL_LOCKS
63
63
if (paramLock!=NULL ){
64
64
vSemaphoreDelete (paramLock);
65
65
paramLock = NULL ;
66
66
}
67
- #endif
67
+ #endif
68
68
}
69
69
70
70
void SPIClass::begin (int8_t sck, int8_t miso, int8_t mosi, int8_t ss)
@@ -140,22 +140,22 @@ void SPIClass::setHwCs(bool use)
140
140
void SPIClass::setFrequency (uint32_t freq)
141
141
{
142
142
SPI_PARAM_LOCK ();
143
- // check if last freq changed
143
+ // check if last freq changed
144
144
uint32_t cdiv = spiGetClockDiv (_spi);
145
145
if (_freq != freq || _div != cdiv) {
146
146
_freq = freq;
147
147
_div = spiFrequencyToClockDiv (_freq);
148
148
spiSetClockDiv (_spi, _div);
149
149
}
150
- SPI_PARAM_UNLOCK ();
150
+ SPI_PARAM_UNLOCK ();
151
151
}
152
152
153
153
void SPIClass::setClockDivider (uint32_t clockDiv)
154
154
{
155
155
SPI_PARAM_LOCK ();
156
- _div = clockDiv;
156
+ _div = clockDiv;
157
157
spiSetClockDiv (_spi, _div);
158
- SPI_PARAM_UNLOCK ();
158
+ SPI_PARAM_UNLOCK ();
159
159
}
160
160
161
161
uint32_t SPIClass::getClockDivider ()
@@ -176,7 +176,7 @@ void SPIClass::setBitOrder(uint8_t bitOrder)
176
176
void SPIClass::beginTransaction (SPISettings settings)
177
177
{
178
178
SPI_PARAM_LOCK ();
179
- // check if last freq changed
179
+ // check if last freq changed
180
180
uint32_t cdiv = spiGetClockDiv (_spi);
181
181
if (_freq != settings._clock || _div != cdiv) {
182
182
_freq = settings._clock ;
@@ -191,7 +191,7 @@ void SPIClass::endTransaction()
191
191
if (_inTransaction){
192
192
_inTransaction = false ;
193
193
spiEndTransaction (_spi);
194
- SPI_PARAM_UNLOCK (); // <-- Im not sure should it be here or right after spiTransaction()
194
+ SPI_PARAM_UNLOCK (); // <-- Im not sure should it be here or right after spiTransaction()
195
195
}
196
196
}
197
197
0 commit comments