Skip to content

Commit bd33b74

Browse files
committed
Compile errors nano ble sense
1 parent 22c6294 commit bd33b74

File tree

7 files changed

+26
-7
lines changed

7 files changed

+26
-7
lines changed

src/Common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define RESULT_OK 0 /*!< error_t value indicating success (no error) */
1212
#define RESULT_FAIL -1 /*!< Generic error_t code indicating failure */
1313
#define ERROR_INVALID_ARG 1
14-
#define END true
14+
#define I2C_END true
1515

1616
// Define the default gain for the microphone amp (see values from
1717
// es_mic_gain_t) Alternativly you can call es8388_set_mic_gain(es_mic_gain_t

src/Driver.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class CodecConfig : public codec_config_t {
2929
i2s.mode = MODE_SLAVE;
3030
}
3131
codec_mode_t get_mode() {
32-
codec_mode_t mode;
32+
//codec_mode_t mode;
3333
bool is_input = false;
3434
bool is_output = false;
3535

src/Driver/es7243/es7243.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
#include <string.h>
2626
#include "es7243.h"
27+
#include "Utils/etc.h"
2728
#include "Arduino.h"
2829

2930
#define MCLK_PULSES_NUMBER (20)
@@ -68,7 +69,7 @@ error_t es7243_adc_set_addr(int addr)
6869

6970
static error_t es7243_mclk_active(uint8_t mclk_gpio)
7071
{
71-
pinMode(mclk_gpio, OUTPUT);
72+
arduino_pin_mode(mclk_gpio, OUTPUT);
7273
/*
7374
Before initializing es7243, it is necessary to output
7475
mclk to es7243 to activate the I2C configuration.

src/DriverPins.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ struct PinsSPI {
107107
cs);
108108
p_spi->begin(clk, miso, mosi, cs);
109109
#elif defined(ARDUINO_ARCH_AVR)
110-
LOGW("setting up SPI w/o pins");
110+
AUDIODRIVER_LOGW("setting up SPI w/o pins");
111111
p_spi->begin();
112112
#endif
113113
}
@@ -168,7 +168,6 @@ struct PinsI2C {
168168
#else
169169
AUDIODRIVER_LOGW("setting up I2C w/o pins");
170170
p_wire->begin();
171-
}
172171
#endif
173172
}
174173
AUDIODRIVER_LOGI("Setting i2c clock: %u", frequency);

src/Utils/I2C.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ error_t i2c_bus_write_bytes(i2c_bus_handle_t bus, int addr, uint8_t *reg,
1818
p_wire->beginTransmission(addr >> 1);
1919
p_wire->write(reg[0]);
2020
p_wire->write(data[0]);
21-
int rc = p_wire->endTransmission(END);
21+
int rc = p_wire->endTransmission(I2C_END);
2222
if (rc != 0) {
2323
AUDIODRIVER_LOGE("->p_wire->endTransmission: %d", rc);
2424
result = RESULT_FAIL;
@@ -36,7 +36,7 @@ error_t i2c_bus_write_data(i2c_bus_handle_t bus, int addr, uint8_t *data,
3636
int result = RESULT_OK;
3737
p_wire->beginTransmission(addr >> 1);
3838
p_wire->write(data, datalen);
39-
int rc = p_wire->endTransmission(END);
39+
int rc = p_wire->endTransmission(I2C_END);
4040
if (rc != 0) {
4141
AUDIODRIVER_LOGE("->p_wire->endTransmission: %d", rc);
4242
result = RESULT_FAIL;

src/Utils/etc.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#include "Arduino.h"
2+
#include "etc.h"
3+
4+
void arduino_pin_mode(int pin, int mode){
5+
pinMode(pin, mode);
6+
}

src/Utils/etc.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#pragma once
2+
3+
#ifdef __cplusplus
4+
extern "C" {
5+
#endif
6+
7+
// pinMode gives linker error if called from c for Nano BLE Sense
8+
void arduino_pin_mode(int pin, int mode);
9+
10+
11+
#ifdef __cplusplus
12+
}
13+
#endif

0 commit comments

Comments
 (0)