Skip to content

Commit 70b00b3

Browse files
authored
utilities: fix shadowed variables (#1569)
Fix shadowed variables in the radio driver and utility functions. utilities.h:183:44: error: declaration of 'mask' shadows a previous local [-Werror=shadow] 183 | #define CRITICAL_SECTION_BEGIN( ) uint32_t mask; BoardCritica... Signed-off-by: Fabio Baltieri <[email protected]> Signed-off-by: Jordan Yates <[email protected]>
1 parent 2bf36bd commit 70b00b3

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

src/boards/mcu/utilities.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ uint32_t Crc32( uint8_t *buffer, uint16_t length )
107107
for( uint16_t i = 0; i < length; ++i )
108108
{
109109
crc ^= ( uint32_t )buffer[i];
110-
for( uint16_t i = 0; i < 8; i++ )
110+
for( uint16_t j = 0; j < 8; i++ )
111111
{
112112
crc = ( crc >> 1 ) ^ ( reversedPolynom & ~( ( crc & 0x01 ) - 1 ) );
113113
}
@@ -137,7 +137,7 @@ uint32_t Crc32Update( uint32_t crcInit, uint8_t *buffer, uint16_t length )
137137
for( uint16_t i = 0; i < length; ++i )
138138
{
139139
crc ^= ( uint32_t )buffer[i];
140-
for( uint16_t i = 0; i < 8; i++ )
140+
for( uint16_t j = 0; j < 8; i++ )
141141
{
142142
crc = ( crc >> 1 ) ^ ( reversedPolynom & ~( ( crc & 0x01 ) - 1 ) );
143143
}

src/boards/utilities.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,11 @@ uint32_t Crc32Finalize( uint32_t crc );
182182
*/
183183
#define CRITICAL_SECTION_BEGIN( ) uint32_t mask; BoardCriticalSectionBegin( &mask )
184184

185+
/*!
186+
* Begin repeated critical section
187+
*/
188+
#define CRITICAL_SECTION_BEGIN_REPEAT( ) BoardCriticalSectionBegin( &mask )
189+
185190
/*!
186191
* Ends critical section
187192
*/

src/radio/sx126x/radio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1261,7 +1261,7 @@ void RadioIrqProcess( void )
12611261
SX126xClearIrqStatus( irqRegs );
12621262

12631263
// Check if DIO1 pin is High. If it is the case revert IrqFired to true
1264-
CRITICAL_SECTION_BEGIN( );
1264+
CRITICAL_SECTION_BEGIN_REPEAT( );
12651265
if( SX126xGetDio1PinState( ) == 1 )
12661266
{
12671267
IrqFired = true;

0 commit comments

Comments
 (0)