Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit dac493f

Browse filesBrowse files
davefiddesme-no-dev
authored andcommitted
SPI: Fix discarded-qalifiers warning when compiling with all warnings (espressif#3458)
* SPI: Fix discarded-qalifiers warning when compiling with all warnings This fixes an error introduced with changeset b847f41 which tightened the use of const for read-only data. The helper funtion __transferBytes also requires the const qualifier on outgoing data. Without this change a warning is displayed when compiling with the Arduino IDE set to display "All" compiler warnings. Tests: - Build an ESP32 SPI sketch that uses static const data to send to an SPI device using the SPI.transferBytes() API * SPI:Ensure all local functions are marked static This audits all functions in the esp32-hal-xpi.c module and ensures that any functions entirely local to the module are marked as static. Tests: - Build with Arduino set to show all warnings and ensure none are displayed * SPI: Remove unused local __spiTranslate24 function This removes the __spiTranslate24() function which is unused.
1 parent bc3d113 commit dac493f
Copy full SHA for dac493f

File tree

Expand file treeCollapse file tree

1 file changed

+2
-12
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-12
lines changed

‎cores/esp32/esp32-hal-spi.c

Copy file name to clipboardExpand all lines: cores/esp32/esp32-hal-spi.c
+2-12Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -532,17 +532,7 @@ uint8_t spiTransferByte(spi_t * spi, uint8_t data)
532532
return data;
533533
}
534534

535-
uint32_t __spiTranslate24(uint32_t data)
536-
{
537-
union {
538-
uint32_t l;
539-
uint8_t b[4];
540-
} out;
541-
out.l = data;
542-
return out.b[2] | (out.b[1] << 8) | (out.b[0] << 16);
543-
}
544-
545-
uint32_t __spiTranslate32(uint32_t data)
535+
static uint32_t __spiTranslate32(uint32_t data)
546536
{
547537
union {
548538
uint32_t l;
@@ -630,7 +620,7 @@ uint32_t spiTransferLong(spi_t * spi, uint32_t data)
630620
return data;
631621
}
632622

633-
void __spiTransferBytes(spi_t * spi, uint8_t * data, uint8_t * out, uint32_t bytes)
623+
static void __spiTransferBytes(spi_t * spi, const uint8_t * data, uint8_t * out, uint32_t bytes)
634624
{
635625
if(!spi) {
636626
return;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.