Skip to content

Commit 567a941

Browse files
Enriquez Garcia Juan Antonio (IFAG DES TCP EDS)Enriquez Garcia Juan Antonio (IFAG DES TCP EDS)
authored andcommitted
Merge branch 'develop' into xmc4400
2 parents d3f2435 + 11e5c0c commit 567a941

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

cores/Tone.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ uint8_t tone_init = 0;
5050

5151
static int8_t toneBegin( uint8_t _pin )
5252
{
53-
int8_t i = -1;
53+
int8_t i;
5454

5555
// check all arrays initialised
5656
if( tone_init == 0 )
@@ -80,7 +80,7 @@ return ( i < NUM_TONE_PINS ) ? i : -1;
8080
}
8181

8282

83-
// frequency (in hertz) and duration (in milliseconds).
83+
// Frequency (in hertz) and duration (in milliseconds).
8484
// Max frequency usable = 500 Hz
8585
// Min frequency usable = 1 Hz
8686
// Duration default of 0 for permanently on
@@ -101,7 +101,7 @@ if( frequency > 0 && frequency <= 500 )
101101
timer_toggle_count[ _timer ] = 2 * frequency * duration/1000;
102102
else
103103
timer_toggle_count[ _timer ] = -1; // Continuous
104-
// Set int task parameters
104+
// Set internal task parameters
105105
setParam( _timer, _timer );
106106
setInterval( _timer, (unsigned int)FREQUENCY_TO_MILLIS( frequency ) );
107107
startTask( _timer );
@@ -113,7 +113,7 @@ if( frequency > 0 && frequency <= 500 )
113113
// Stops tone at next 1ms Systick
114114
void noTone( uint8_t _pin )
115115
{
116-
int8_t i = -1;
116+
int8_t i;
117117

118118
for( i = 0; i < NUM_TONE_PINS; i++ )
119119
if( tone_pins[ i ] == _pin )

cores/wiring_time.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,10 @@ int (* tasks[_MAX_TASKS])( int, int16_t );
161161
struct TaskList taskTable[ _MAX_TASKS ];
162162

163163
unsigned long old_ms = 0; // last execution time
164-
int running; // Current task ID being checked or run
164+
int running = _MAX_TASKS; // Current task ID being checked or run
165+
// Initialise to avoid fast CPU EXTREME edge case of
166+
// requesting task (mainly first Tone task) BEFORE the
167+
// FIRST SysTick interrupt (1 ms) after power up.
165168

166169
/* SysTick counter */
167170
volatile uint32_t g_systick_count = 0U;

0 commit comments

Comments
 (0)