Skip to content

Commit c2d2322

Browse files
authored
Merge snapshot for v1.1.3 (#14)
Commits: d338d9d Updating GNSS example to use GPS satellites 8e394ab Fix bug that object I/F can't select output device 33db1f8 Increase number of buffer for audio filtered data 138fdb8 Change save_file name for separate spk between debug and release ec95377 Remove ESP configuration from platform.txt e986e15 Support for arduino-cli tool 6658e62 Improve performance of EEPROM access
1 parent 75dfb72 commit c2d2322

File tree

13 files changed

+205
-86
lines changed

13 files changed

+205
-86
lines changed

Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/boards.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,14 @@ spresense.build.stack=-Wl,--defsym,__stack=_vectors+{upload.maximum_size}
2626

2727
spresense.menu.Debug.Disabled=Disabled
2828
spresense.menu.Debug.Disabled.build.debug=
29-
spresense.menu.Debug.Disabled.build.kernel={runtime.tools.spresense-sdk.path}/spresense/release
29+
spresense.menu.Debug.Disabled.build.type=release
30+
spresense.menu.Debug.Disabled.build.kernel={runtime.tools.spresense-sdk.path}/spresense/{build.type}
3031
spresense.menu.Debug.Disabled.build.libpath={build.kernel}/prebuilt
3132

3233
spresense.menu.Debug.Enabled=Enabled
3334
spresense.menu.Debug.Enabled.build.debug=-DBRD_DEBUG
34-
spresense.menu.Debug.Enabled.build.kernel={runtime.tools.spresense-sdk.path}/spresense/debug
35+
spresense.menu.Debug.Enabled.build.type=debug
36+
spresense.menu.Debug.Enabled.build.kernel={runtime.tools.spresense-sdk.path}/spresense/{build.type}
3537
spresense.menu.Debug.Enabled.build.libpath={build.kernel}/prebuilt
3638

3739
spresense.menu.UploadSpeed.115200=115200

Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/MediaPlayer.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ err_t MediaPlayer::create(PlayerId id, AudioAttentionCb attcb)
102102
}
103103

104104
/*--------------------------------------------------------------------------*/
105+
err_t MediaPlayer::activate(PlayerId id, MediaPlayerCallback mpcb)
106+
{
107+
return MediaPlayer::activate(id, AS_SETPLAYER_OUTPUTDEVICE_SPHP, mpcb);
108+
}
109+
105110
err_t MediaPlayer::activate(PlayerId id, uint8_t output_device, MediaPlayerCallback mpcb)
106111
{
107112
CMN_SimpleFifoHandle *handle =

Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/MediaPlayer.h

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,16 +129,28 @@ class MediaPlayer
129129
* @brief Activate the MediaPlayer
130130
*
131131
* @details This function activates media player system.
132-
* You should specify output device which you would like to sound.
133-
* You can set "Speaker/HeadPhone-out" or "I2S-out".
134132
* The result of APIs will be returnd by callback function which is
135133
* specified by this function.
136134
*
137135
*/
138136

139137
err_t activate(
140138
PlayerId id, /**< Select Player ID. */
141-
uint8_t output_device, /**< Set output device. AS_SETPLAYER_OUTPUTDEVICE_SPHP, AS_SETPLAYER_OUTPUTDEVICE_I2SOUTPUT*/
139+
MediaPlayerCallback mpcb /**< Sepcify callback function which is called to notify API results. */
140+
);
141+
142+
/**
143+
* @brief Activate the MediaPlayer (old interface)
144+
*
145+
* @details This function activates media player system.
146+
* The result of APIs will be returnd by callback function which is
147+
* specified by this function.
148+
*
149+
*/
150+
151+
err_t activate(
152+
PlayerId id, /**< Select Player ID. */
153+
uint8_t output_device, /**< Set output device.(_not supported_)*/
142154
MediaPlayerCallback mpcb /**< Sepcify callback function which is called to notify API results. */
143155
);
144156

Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/OutputMixer.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,17 @@ err_t OutputMixer::create(AudioAttentionCb attcb)
9393

9494
/*--------------------------------------------------------------------------*/
9595
err_t OutputMixer::activate(AsOutputMixerHandle handle, OutputMixerCallback omcb)
96+
{
97+
return activate(handle, HPOutputDevice, omcb);
98+
}
99+
100+
err_t OutputMixer::activate(AsOutputMixerHandle handle,
101+
uint8_t output_device,
102+
OutputMixerCallback omcb)
96103
{
97104
AsActivateOutputMixer mixer_act;
98105

99-
mixer_act.output_device = HPOutputDevice;
106+
mixer_act.output_device = output_device;
100107
mixer_act.mixer_type = MainOnly;
101108
mixer_act.cb = omcb;
102109

Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/OutputMixer.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,26 @@ class OutputMixer
100100
* @details This function activates output mixer system.
101101
* The result of APIs will be returnd by callback function which is
102102
* specified by this function.
103+
* Output device is speaker output fixed.
104+
*/
105+
106+
err_t activate(
107+
AsOutputMixerHandle handle, /**< Select output mixer handle. OutputMixer0 or OutputMixer1 */
108+
OutputMixerCallback omcb /**< Sepcify callback function which is called to notify API results. */
109+
);
110+
111+
/**
112+
* @brief Activate the OutputMixer with specify output device
103113
*
114+
* @details This function activates output mixer system.
115+
* The result of APIs will be returnd by callback function which is
116+
* specified by this function.
117+
* This I/F can specify output device as speaker or i2s.
104118
*/
105119

106120
err_t activate(
107121
AsOutputMixerHandle handle, /**< Select output mixer handle. OutputMixer0 or OutputMixer1 */
122+
uint8_t output_device, /**< Select output device. HPOutputDevice or I2SOutputDevice */
108123
OutputMixerCallback omcb /**< Sepcify callback function which is called to notify API results. */
109124
);
110125

Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/examples/application/player_ObjIf/player_ObjIf.ino

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,17 @@ void setup()
159159

160160
theMixer->setRenderingClkMode(OUTPUTMIXER_RNDCLK_NORMAL);
161161

162-
/* Activate Objects. Set output device to Speakers/Headphones */
163-
thePlayer->activate(MediaPlayer::Player0, AS_SETPLAYER_OUTPUTDEVICE_SPHP, mediaplayer_done_callback);
162+
/* Activate Player Object */
164163

165-
theMixer->activate(OutputMixer0, outputmixer_done_callback);
164+
thePlayer->activate(MediaPlayer::Player0, mediaplayer_done_callback);
165+
166+
/* Activate Mixer Object.
167+
* Set output device to speaker with 2nd argument.
168+
* If you want to change the output device to I2S,
169+
* specify "I2SOutputDevice" as an argument.
170+
*/
171+
172+
theMixer->activate(OutputMixer0, HPOutputDevice, outputmixer_done_callback);
166173

167174
usleep(100 * 1000);
168175

Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/memutil/mem_layout.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -197,43 +197,43 @@
197197
/* Remainder AUDIO_WORK_AREA=0x00003884 */
198198

199199
/* Layout1: */
200-
#define MEMMGR_L1_WORK_SIZE 0x00000060
200+
#define MEMMGR_L1_WORK_SIZE 0x00000068
201201

202202
/* Skip 0x0004 bytes for alignment. */
203203
#define L1_OUTPUT_BUF_POOL_ALIGN 0x00000008
204204
#define L1_OUTPUT_BUF_POOL_L_FENCE 0x000c0004
205205
#define L1_OUTPUT_BUF_POOL_ADDR 0x000c0008
206-
#define L1_OUTPUT_BUF_POOL_SIZE 0x00006000
207-
#define L1_OUTPUT_BUF_POOL_U_FENCE 0x000c6008
208-
#define L1_OUTPUT_BUF_POOL_NUM_SEG 0x00000002
206+
#define L1_OUTPUT_BUF_POOL_SIZE 0x0000f000
207+
#define L1_OUTPUT_BUF_POOL_U_FENCE 0x000cf008
208+
#define L1_OUTPUT_BUF_POOL_NUM_SEG 0x00000005
209209
#define L1_OUTPUT_BUF_POOL_SEG_SIZE 0x00003000
210210

211211
#define L1_MIC_IN_BUF_POOL_ALIGN 0x00000008
212-
#define L1_MIC_IN_BUF_POOL_L_FENCE 0x000c600c
213-
#define L1_MIC_IN_BUF_POOL_ADDR 0x000c6010
212+
#define L1_MIC_IN_BUF_POOL_L_FENCE 0x000cf00c
213+
#define L1_MIC_IN_BUF_POOL_ADDR 0x000cf010
214214
#define L1_MIC_IN_BUF_POOL_SIZE 0x00014000
215-
#define L1_MIC_IN_BUF_POOL_U_FENCE 0x000da010
215+
#define L1_MIC_IN_BUF_POOL_U_FENCE 0x000e3010
216216
#define L1_MIC_IN_BUF_POOL_NUM_SEG 0x00000005
217217
#define L1_MIC_IN_BUF_POOL_SEG_SIZE 0x00004000
218218

219219
#define L1_ENC_APU_CMD_POOL_ALIGN 0x00000008
220-
#define L1_ENC_APU_CMD_POOL_L_FENCE 0x000da014
221-
#define L1_ENC_APU_CMD_POOL_ADDR 0x000da018
220+
#define L1_ENC_APU_CMD_POOL_L_FENCE 0x000e3014
221+
#define L1_ENC_APU_CMD_POOL_ADDR 0x000e3018
222222
#define L1_ENC_APU_CMD_POOL_SIZE 0x00000114
223-
#define L1_ENC_APU_CMD_POOL_U_FENCE 0x000da12c
223+
#define L1_ENC_APU_CMD_POOL_U_FENCE 0x000e312c
224224
#define L1_ENC_APU_CMD_POOL_NUM_SEG 0x00000003
225225
#define L1_ENC_APU_CMD_POOL_SEG_SIZE 0x0000005c
226226

227227
/* Skip 0x0004 bytes for alignment. */
228228
#define L1_SRC_APU_CMD_POOL_ALIGN 0x00000008
229-
#define L1_SRC_APU_CMD_POOL_L_FENCE 0x000da134
230-
#define L1_SRC_APU_CMD_POOL_ADDR 0x000da138
229+
#define L1_SRC_APU_CMD_POOL_L_FENCE 0x000e3134
230+
#define L1_SRC_APU_CMD_POOL_ADDR 0x000e3138
231231
#define L1_SRC_APU_CMD_POOL_SIZE 0x00000114
232-
#define L1_SRC_APU_CMD_POOL_U_FENCE 0x000da24c
232+
#define L1_SRC_APU_CMD_POOL_U_FENCE 0x000e324c
233233
#define L1_SRC_APU_CMD_POOL_NUM_SEG 0x00000003
234234
#define L1_SRC_APU_CMD_POOL_SEG_SIZE 0x0000005c
235235

236-
/* Remainder AUDIO_WORK_AREA=0x00022db0 */
236+
/* Remainder AUDIO_WORK_AREA=0x00019db0 */
237237

238238
/* Layout2: */
239239
#define MEMMGR_L2_WORK_SIZE 0x00000090

Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/Audio/memutil/pool_layout.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ extern const PoolAttr MemoryPoolLayouts[NUM_MEM_LAYOUTS][NUM_MEM_POOLS] = {
5959
},
6060
{/* Layout:1 */
6161
/* pool_ID type seg fence addr size */
62-
{ OUTPUT_BUF_POOL , BasicType, 2, true, 0x000c0008, 0x00006000 }, /* AUDIO_WORK_AREA */
63-
{ MIC_IN_BUF_POOL , BasicType, 5, true, 0x000c6010, 0x00014000 }, /* AUDIO_WORK_AREA */
64-
{ ENC_APU_CMD_POOL, BasicType, 3, true, 0x000da018, 0x00000114 }, /* AUDIO_WORK_AREA */
65-
{ SRC_APU_CMD_POOL, BasicType, 3, true, 0x000da138, 0x00000114 }, /* AUDIO_WORK_AREA */
62+
{ OUTPUT_BUF_POOL , BasicType, 5, true, 0x000c0008, 0x0000f000 }, /* AUDIO_WORK_AREA */
63+
{ MIC_IN_BUF_POOL , BasicType, 5, true, 0x000cf010, 0x00014000 }, /* AUDIO_WORK_AREA */
64+
{ ENC_APU_CMD_POOL, BasicType, 3, true, 0x000e3018, 0x00000114 }, /* AUDIO_WORK_AREA */
65+
{ SRC_APU_CMD_POOL, BasicType, 3, true, 0x000e3138, 0x00000114 }, /* AUDIO_WORK_AREA */
6666
},
6767
{/* Layout:2 */
6868
/* pool_ID type seg fence addr size */

Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/EEPROM/examples/eeprom_clear/eeprom_clear.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ void setup() {
1515
pinMode(LED_BUILTIN, OUTPUT);
1616

1717
#if defined(ARDUINO_ARCH_SPRESENSE)
18-
// Just remove a eeprom emulation file. When EEPROM is used later,
19-
// the a zero-filled eeprom file is newly generated.
20-
unlink(EEPROM_EMU);
18+
// After removing a eeprom emulation file, the a zero-filled eeprom file
19+
// is newly generated.
20+
EEPROM.clear();
2121
#else
2222
/***
2323
Iterate through each byte of the EEPROM storage.

Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/EEPROM/examples/eeprom_crc/eeprom_crc.ino

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ void loop() {
3232
/* Empty loop */
3333
}
3434

35+
#if defined(ARDUINO_ARCH_SPRESENSE)
36+
uint8_t eeprom[E2END];
37+
#endif
38+
3539
unsigned long eeprom_crc(void) {
3640

3741
const unsigned long crc_table[16] = {
@@ -43,10 +47,19 @@ unsigned long eeprom_crc(void) {
4347

4448
unsigned long crc = ~0L;
4549

50+
#if defined(ARDUINO_ARCH_SPRESENSE)
51+
EEPROM.get(0, eeprom);
52+
for (int index = 0 ; index < EEPROM.length() ; ++index) {
53+
crc = crc_table[(crc ^ eeprom[index]) & 0x0f] ^ (crc >> 4);
54+
crc = crc_table[(crc ^ (eeprom[index] >> 4)) & 0x0f] ^ (crc >> 4);
55+
crc = ~crc;
56+
}
57+
#else
4658
for (int index = 0 ; index < EEPROM.length() ; ++index) {
4759
crc = crc_table[(crc ^ EEPROM[index]) & 0x0f] ^ (crc >> 4);
4860
crc = crc_table[(crc ^ (EEPROM[index] >> 4)) & 0x0f] ^ (crc >> 4);
4961
crc = ~crc;
5062
}
63+
#endif
5164
return crc;
5265
}

Arduino15/packages/SPRESENSE/hardware/spresense/1.0.0/libraries/EEPROM/src/EEPROM.cpp

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -24,49 +24,13 @@
2424

2525
#include "EEPROM.h"
2626

27-
// Create a eeprom emulation file if it doesn't exist
28-
void EERef::createInitialFile() const
29-
{
30-
int ret;
31-
FILE *fp = NULL;
32-
struct stat statBuf;
33-
long filesize = -1;
34-
long eepromsize = E2END;
35-
36-
/* Check whether the eeprom emulation file has already existed or not */
37-
if (0 == stat(EEPROM_EMU, &statBuf)) {
38-
filesize = statBuf.st_size;
39-
}
40-
41-
if (eepromsize == filesize) {
42-
/* Already existed if the file size is equal to the eeprom size */
43-
return;
44-
}
45-
46-
/* Create a new file */
47-
if ((fp = fopen(EEPROM_EMU, "wb")) == NULL) {
48-
printf("ERROR: eeprom open failure\n");
49-
}
50-
uint8_t *ptr = (uint8_t*)zalloc(eepromsize);
51-
ret = fwrite(ptr, 1, eepromsize, fp);
52-
if (ret != eepromsize) {
53-
printf("ERROR: eeprom init failure (%d)\n", ret);
54-
}
55-
56-
fclose(fp);
57-
return;
58-
}
59-
6027
// Read a byte from the address specified by index on a eeprom emulation file
6128
uint8_t EERef::operator*() const
6229
{
6330
int ret;
6431
FILE *fp = NULL;
6532
uint8_t value = 0;
6633

67-
/* Create a new file if the emulation file doesn't exist */
68-
createInitialFile();
69-
7034
if ((fp = fopen(EEPROM_EMU, "rb")) == NULL) {
7135
printf("ERROR: eeprom open failure\n");
7236
goto errout;
@@ -94,9 +58,6 @@ EERef& EERef::operator=( uint8_t in )
9458
int ret;
9559
FILE *fp = NULL;
9660

97-
/* Create a new file if the emulation file doesn't exist */
98-
createInitialFile();
99-
10061
if ((fp = fopen(EEPROM_EMU, "ab+")) == NULL) {
10162
printf("ERROR: eeprom open failure\n");
10263
goto errout;
@@ -118,3 +79,5 @@ EERef& EERef::operator=( uint8_t in )
11879
errout:
11980
return *this;
12081
}
82+
83+
EEPROMClass EEPROM;

0 commit comments

Comments
 (0)