Skip to content
This repository was archived by the owner on Feb 21, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cores/arduino/Arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ typedef uint8 byte;
#include "variant.h"
#include "Tone.h"
#include "WCharacter.h"
#include "WMath.h"
4 changes: 3 additions & 1 deletion cores/arduino/HardwareTimer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@

#include "HardwareTimer.h"
#include "boards.h" // for CYCLES_PER_MICROSECOND
#include "wiring_math.h"
//#include "wiring_math.h"
#include "WMath.h"


#define NR_TIMERS 14

Expand Down
68 changes: 68 additions & 0 deletions cores/arduino/WMath.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
Copyright (c) 2011 Arduino. All right reserved.

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

extern "C" {
#include "stdlib.h"
#include "stdint.h"
}
#include "WMath.h"

extern void randomSeed( uint32_t dwSeed )
{
if ( dwSeed != 0 )
{
srand( dwSeed ) ;
}
}

extern long random( long howbig )
{
if ( howbig == 0 )
{
return 0 ;
}

return rand() % howbig;
}

extern long random( long howsmall, long howbig )
{
if (howsmall >= howbig)
{
return howsmall;
}

long diff = howbig - howsmall;

return random(diff) + howsmall;
}

extern long map(long x, long in_min, long in_max, long out_min, long out_max)
{
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}

extern uint16_t makeWord( uint16_t w )
{
return w ;
}

extern uint16_t makeWord( uint8_t h, uint8_t l )
{
return (h << 8) | l ;
}
47 changes: 47 additions & 0 deletions cores/arduino/WMath.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
Copyright (c) 2011 Arduino. All right reserved.

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

#ifndef _WIRING_MATH_
#define _WIRING_MATH_

extern long random( long ) ;
extern long random( long, long ) ;
extern void randomSeed( uint32_t dwSeed ) ;
extern long map( long, long, long, long, long ) ;

extern uint16_t makeWord( uint16_t w ) ;
extern uint16_t makeWord( uint8_t h, uint8_t l ) ;

#define word(...) makeWord(__VA_ARGS__)

#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
#define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))
#define radians(deg) ((deg)*DEG_TO_RAD)
#define degrees(rad) ((rad)*RAD_TO_DEG)
#define sq(x) ((x)*(x))

/* undefine stdlib's abs if encountered */
#ifdef abs
#undef abs
#endif
#define abs(x) (((x) > 0) ? (x) : -(x))


#endif /* _WIRING_MATH_ */
3 changes: 2 additions & 1 deletion cores/arduino/wiring.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
#include "pwm.h"
#include "interrupts.h"
#include "wiring_debug.h"
#include "wiring_math.h"
#include "WMath.h"

#include "wiring_time.h"
#include <wiring_constants.h>
#include "SPI.h"
Expand Down
49 changes: 0 additions & 49 deletions cores/arduino/wiring_math.cpp

This file was deleted.

151 changes: 0 additions & 151 deletions cores/arduino/wiring_math.h

This file was deleted.

4 changes: 3 additions & 1 deletion libraries/Audio/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

The Audio library enables an Arduino OTTO board to play back .wav files from a storage device like an SD card. It is an adaptation of library supported on DUE board.

For more information about this library please visit us at
For more information about this library for DUE and OTTO common methods, please visit us at
http://arduino.cc/en/Reference/Audio
for Otto specific implementation please visit
http://arduino.org/en/Reference/Audio

== License ==

Expand Down
4 changes: 2 additions & 2 deletions libraries/Audio/library.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name=Audio
version=1.0
author=Arduino
maintainer=Arduino <info@arduino.cc>
sentence=Allows playing audio files from an SD card. Adapted from Arduino DUE to OTTO.
maintainer=Arduino <swdev@arduino.org>
sentence=Allows playing audio files from an SD card. Adapted from Arduino DUE to OTTO. Use some Processing Methods To have more flexibility.
paragraph=With this library you can use the Arduino OTTO CODEC output to play audio files.<br />The audio files must be in the raw .wav format.
category=Signal Input/Output
url=http://arduino.cc/en/Reference/Audio
Expand Down
3 changes: 1 addition & 2 deletions platform.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# Arduino STM32F4 Core and platform
# ------------------------------
#
Expand Down Expand Up @@ -96,7 +95,7 @@ tools.dfu-util.cmd.windows=dfu-util.cmd

tools.dfu-util.upload.params.verbose=-v
tools.dfu-util.upload.params.quiet=
tools.dfu-util.upload.pattern="{path}/{cmd}" "{path}" {upload.usbID} {upload.altID} {upload.mem_start} "{build.path}/{build.project_name}.bin"
tools.dfu-util.upload.pattern="{path}/{cmd}" "{path}" {upload.usbID} {upload.altID} {upload.mem_start} "{build.path}/{build.project_name}.bin" "{serial.port}"

#
# USB Flags
Expand Down
Loading