Skip to content

Commit 3622b8d

Browse files
committed
Compile warnings
1 parent ac2cffe commit 3622b8d

File tree

7 files changed

+30
-24
lines changed

7 files changed

+30
-24
lines changed

src/Driver/es7210/es7210.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ static error_t es7210_update_reg_bit(uint8_t reg_addr, uint8_t update_bits, uint
149149

150150
static int get_coeff(uint32_t mclk, uint32_t lrck)
151151
{
152-
for (int i = 0; i < (sizeof(coeff_div) / sizeof(coeff_div[0])); i++) {
152+
for (unsigned i = 0; i < (sizeof(coeff_div) / sizeof(coeff_div[0])); i++) {
153153
if (coeff_div[i].lrck == lrck && coeff_div[i].mclk == mclk)
154154
return i;
155155
}

src/Driver/es7243/es7243.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,9 @@ error_t es7243_adc_set_addr(int addr)
6969

7070
static error_t es7243_mclk_active(uint8_t mclk_gpio)
7171
{
72-
arduino_pin_mode(mclk_gpio, OUTPUT);
73-
/*
72+
#ifndef ARDUINO_ARCH_NRF52840
73+
pinMode(mclk_gpio, OUTPUT);
74+
#endif /*
7475
Before initializing es7243, it is necessary to output
7576
mclk to es7243 to activate the I2C configuration.
7677
So give some clocks to active es7243.

src/Driver/es8311/es8311.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ static int es8311_read_reg(uint8_t reg_addr)
218218
*/
219219
static int get_coeff(uint32_t mclk, uint32_t rate)
220220
{
221-
for (int i = 0; i < (sizeof(coeff_div) / sizeof(coeff_div[0])); i++) {
221+
for (unsigned i = 0; i < (sizeof(coeff_div) / sizeof(coeff_div[0])); i++) {
222222
if (coeff_div[i].rate == rate && coeff_div[i].mclk == mclk)
223223
return i;
224224
}

src/Driver/tas5805m/tas5805m.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ error_t tas5805m_get_volume(int *value)
151151
uint8_t cmd[2] = {MASTER_VOL_REG_ADDR, 0x00};
152152
error_t ret = i2c_bus_read_bytes(i2c_handler, TAS5805M_ADDR, &cmd[0], 1, &cmd[1], 1);
153153
TAS5805M_ASSERT(ret, "Fail to get volume", RESULT_FAIL);
154-
int i;
154+
unsigned i;
155155
for (i = 0; i < sizeof(tas5805m_volume); i++) {
156156
if (cmd[1] >= tas5805m_volume[i])
157157
break;

src/DriverPins.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,9 @@ class DriverPins {
311311
pinMode(tmp.pin, OUTPUT);
312312
digitalWrite(tmp.pin, HIGH);
313313
break;
314+
default:
315+
// do nothing
316+
break;
314317
}
315318
}
316319
}

src/Utils/etc.cpp

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/Utils/etc.h

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,33 @@
33
#ifdef ARDUINO
44
# include "Arduino.h"
55
#else
6-
7-
#define HIGH 0x1
8-
#define LOW 0x0
9-
10-
#define INPUT 0x0
11-
#define OUTPUT 0x1
12-
#define INPUT_PULLUP 0x2
13-
void pinMode(int, int);
14-
void digitalWrite(int, int);
15-
void delay(uint32_t);
6+
#ifndef HIGH
7+
# define HIGH 0x1
8+
#endif
9+
#ifndef LOW
10+
# define LOW 0x0
11+
#endif
12+
#ifndef INPUT
13+
# define INPUT 0x0
14+
#endif
15+
#ifndef OUTPUT
16+
# define OUTPUT 0x1
17+
#endif
18+
#ifndef INPUT_PULLUP
19+
# define INPUT_PULLUP 0x2
1620
#endif
21+
#endif
22+
1723

1824
#ifdef __cplusplus
1925
extern "C" {
2026
#endif
2127

22-
23-
24-
// pinMode gives linker error if called from c for Nano BLE Sense
25-
void arduino_pin_mode(int pin, int mode);
28+
#ifndef ARDUINO
29+
extern void pinMode(int, int);
30+
extern void digitalWrite(int, int);
31+
extern void delay(uint32_t);
32+
#endif
2633

2734

2835
#ifdef __cplusplus

0 commit comments

Comments
 (0)