Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 25b720e

Browse files
author
Nathan Seidle
committedJul 8, 2019
Merge branch 'master' into Servo
2 parents ea03647 + 82089ed commit 25b720e

File tree

8 files changed

+309
-173
lines changed

8 files changed

+309
-173
lines changed
 

‎README.md

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,38 @@
33

44
## Contents
55

6-
* [Development Status]()
76
* [Installation]()
7+
* [Development Status]()
88
* [Issue Template]()
99
* [Repo Contents]()
1010
* [Acknowledgements]()
1111

12+
13+
## Installation
14+
15+
The structure of this repo is such that it will most closely resemble the structure required when it is time to add it to the Arduino boards manager. Until then you'll have to use the manual installation process.
16+
17+
* [Using Arduino IDE Boards Manager](https://github.com/sparkfun/Arduino_Boards) (Reccomended)
18+
* Follow the instructions at the [SparkFun Arduino Boards Repo](https://github.com/sparkfun/Arduino_Boards)
19+
* Open 'Boards Manager' and select 'SparkFun Apollo3 Boards,' install the latest version.
20+
* JSON boards manager link for convenience: https://raw.githubusercontent.com/sparkfun/Arduino_Boards/master/IDE_Board_Manager/package_sparkfun_index.json
21+
22+
23+
* [Manually Install in Arduino Sketchbook]()
24+
* **First** Install the Arduino SAMD Boards through the Arduino Board Manager. This is required for the ARM Cortex-M toolchain.
25+
* Open your Arduno sketchbook folder, listed in Arduino's preferences pane (it is where your libraries folder lives)
26+
* If there is no ```hardware``` folder create it
27+
* Inside the ```hardware``` folder create ```SparkFun```
28+
* Choose to clone with Git or download the .zip of this repo
29+
* Cloning
30+
* Clone this repo into ```SparkFun``` and give it the name ```apollo3```
31+
* .ZIP
32+
* Download the .ZIP of this repository
33+
* Within ```SparkFun``` create the ```apollo3``` directory
34+
* Unzip the contents of the .ZIP into the ```apollo3``` directory
35+
* Restart Arduino IDE for good measure
36+
37+
1238
## Development Status
1339

1440
The basic necesseties are in-place. This means that you can compile and upload code to your Apollo3 board. Development can be done with the whole range of Hardware Abstraction Layer functions provided in the AmbiqSuite Software Development Kit (based on Release2.1.0).
@@ -35,30 +61,6 @@ Current focus is to begin building support for the essential Arduino libraries i
3561
* Working: transfers with SPISettings.
3662

3763

38-
## Installation
39-
40-
41-
The structure of this repo is such that it will most closely resemble the structure required when it is time to add it to the Arduino boards manager. Until then you'll have to use the manual installation process.
42-
43-
* [Using Arduino IDE Boards Manager](https://github.com/sparkfun/Arduino_Boards) (Reccomended)
44-
* Follow the instructions at the [SparkFun Arduino Boards Repo](https://github.com/sparkfun/Arduino_Boards)
45-
* Open 'Boards Manager' and select 'SparkFun Apollo3 Boards,' install the latest version.
46-
* JSON boards manager link for convenience: https://raw.githubusercontent.com/sparkfun/Arduino_Boards/master/IDE_Board_Manager/package_sparkfun_index.json
47-
48-
49-
* [Manually Install in Arduino Sketchbook]()
50-
* **First** Install the Arduino SAMD Boards through the Arduino Board Manager. This is required for the ARM Cortex-M toolchain.
51-
* Open your Arduno sketchbook folder, listed in Arduino's preferences pane (it is where your libraries folder lives)
52-
* If there is no ```hardware``` folder create it
53-
* Inside the ```hardware``` folder create ```SparkFun```
54-
* Choose to clone with Git or download the .zip of this repo
55-
* Cloning
56-
* Clone this repo into ```SparkFun``` and give it the name ```apollo3```
57-
* .ZIP
58-
* Download the .ZIP of this repository
59-
* Within ```SparkFun``` create the ```apollo3``` directory
60-
* Unzip the contents of the .ZIP into the ```apollo3``` directory
61-
* Restart Arduino IDE for good measure
6264

6365
## How to Contribute
6466
The goal of this Arduino Core is to provide excellent Apollo3 support in a clear and extendable manner. The guidelines for contributing and submitting issues are designed to make it easy to integrate work from many people.

‎cores/arduino/ard_sup/analog/ap3_analog.cpp

Lines changed: 238 additions & 128 deletions
Large diffs are not rendered by default.

‎cores/arduino/ard_sup/ap3_analog.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,14 @@ ap3_err_t ap3_set_pin_to_analog(uint8_t pinNumber);
4141
ap3_err_t ap3_analog_pad_funcsel(ap3_gpio_pad_t padNumber, uint8_t *funcsel);
4242
ap3_err_t ap3_change_channel(ap3_gpio_pad_t padNumber);
4343

44+
bool power_adc_disable();
4445
uint16_t analogRead(uint8_t pinNumber);
4546
void analogReadResolution(uint8_t bits);
4647

47-
ap3_err_t analogWriteResolution( uint8_t res );
48-
ap3_err_t analogWrite( uint8_t pin, uint32_t val );
49-
ap3_err_t servoWriteResolution( uint8_t res );
50-
ap3_err_t servoWrite( uint8_t pin, uint32_t val );
51-
48+
ap3_err_t ap3_pwm_output(uint8_t pin, uint32_t th, uint32_t fw, uint32_t clk);
49+
ap3_err_t analogWriteResolution(uint8_t res);
50+
ap3_err_t analogWrite(uint8_t pin, uint32_t val);
51+
ap3_err_t servoWriteResolution(uint8_t res);
52+
ap3_err_t servoWrite(uint8_t pin, uint32_t val);
5253

5354
#endif // _AP3_ANALOG_H_

‎cores/arduino/ard_sup/uart/ap3_uart.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,20 @@ void Uart::begin(unsigned long baudrate, am_hal_uart_config_t config)
6767

6868
void Uart::end()
6969
{
70-
// todo:
70+
if (_handle != NULL)
71+
{
72+
flush();
73+
74+
// Power down the UART, and surrender the handle.
75+
am_hal_uart_power_control(_handle, AM_HAL_SYSCTRL_DEEPSLEEP, false);
76+
am_hal_uart_deinitialize(_handle);
77+
78+
// Disable the UART pins.
79+
am_hal_gpio_pinconfig(_pinTX, g_AM_HAL_GPIO_DISABLE);
80+
am_hal_gpio_pinconfig(_pinRX, g_AM_HAL_GPIO_DISABLE);
81+
82+
_handle = NULL;
83+
}
7184
}
7285

7386
int Uart::available()
@@ -93,7 +106,8 @@ int Uart::read()
93106

94107
void Uart::flush()
95108
{
96-
// todo:
109+
// Make sure the UART has finished sending everything it's going to send.
110+
am_hal_uart_tx_flush(_handle);
97111
}
98112

99113
size_t Uart::write(const uint8_t data)

‎docs/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ This is a record of the major changes between versions of the SparkFun Arduino A
55

66
Each log entry will use the version number of the release that contains the changes listed. Newest version at the top of the file (just below this line)
77

8+
1.0.1
9+
=====
10+
- Add burst mode support (PR #13)
11+
- Made examples under 'Core Testing' visible through File->Examples menu (PR #10)
12+
- Add EEPROM library (PR #11)
13+
- Fix handling of spaces in paths (PR #20)
14+
- Fix paths to SparkFun SVL for Mac and Linux
15+
- Add ADC power functions and Serial end/flush (PR #18)
16+
817
1.0.0
918
=====
1019
- Add SparkFun Variable Bootloader

‎libraries/Examples/examples/Example9_analogWrite/Example9_analogWrite.ino

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ void setup()
3232
Serial.println("SparkFun Arduino Apollo3 analogWrite() Example");
3333
Serial.printf("Compiled on %s, %s\n\n", __DATE__, __TIME__); // Look! You can use printf, if you so choose
3434

35-
analogWrite(46, 127); // analogWrite uses a high frequency counter/timer module to generate a PWM value with f ~= 350 Hz
36-
analogWriteResolution(15); // you can increase the resolution of the write from the default (8-bit, 0-255) to up to 15 bits (0-32767)
37-
analogWrite(37, 16383); // subsequent cals to analogWrite use the new resolution, so both this call and the original have a 50% duty cycle, or 3.3/2 V
35+
analogWrite(46, 127); // analogWrite uses a high frequency counter/timer module to generate a PWM value with f ~= 180 Hz
36+
analogWriteResolution(16); // you can increase the resolution of the write from the default (8-bit, 0-255) to up to 16 bits (0-65535)
37+
analogWrite(37, 32767); // subsequent cals to analogWrite use the new resolution, so both this call and the original have a 50% duty cycle, or 3.3/2 V
3838

3939
servoWrite(44, 127); // The servoWrite function produces a PWM signal with a pulse width between 1 and 2 ms at 500 Hz
40-
servoWriteResolution(15); // You can also increase the servoWrite() resolution
41-
servoWrite(47, 16383); // This and the above write should both produce 1.5 ms wide pulses, though using different resolutions
40+
servoWriteResolution(16); // You can also increase the servoWrite() resolution
41+
servoWrite(47, 32767); // This and the above write should both produce 1.5 ms wide pulses, though using different resolutions
4242

4343
delay(5000);
4444
}
@@ -56,8 +56,8 @@ void loop()
5656
servoWrite(44, val);
5757
servoWrite(47, val);
5858

59-
val += 5 * sign;
60-
if (val > 32767)
59+
val += 10 * sign;
60+
if (val > 65535)
6161
{
6262
sign = -1;
6363
}

‎platform.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ ap3core.ambiq_sdk.path={ap3core.path}/am_sdk_ap3
4343

4444
## Core Includes
4545
includes.extra=
46-
includes.ambiq_sdk=-I{ap3core.ambiq_sdk.path}/mcu/apollo3 -I{ap3core.ambiq_sdk.path}/mcu/apollo3/hal -I{ap3core.ambiq_sdk.path}/mcu/apollo3/regs -I{ap3core.ambiq_sdk.path}/utils
47-
includes.cmsis=-I{ap3core.ambiq_sdk.path}/CMSIS/AmbiqMicro/Include -I{ap3core.ambiq_sdk.path}/CMSIS/ARM/Include
48-
includes.core=-I{ap3core.path}/ard_sup -I{ap3core.path}/ard_sup/ard_supers {includes}
49-
includes.variant={build.includes}
46+
includes.ambiq_sdk="-I{ap3core.ambiq_sdk.path}/mcu/apollo3" "-I{ap3core.ambiq_sdk.path}/mcu/apollo3/hal" "-I{ap3core.ambiq_sdk.path}/mcu/apollo3/regs" "-I{ap3core.ambiq_sdk.path}/utils"
47+
includes.cmsis="-I{ap3core.ambiq_sdk.path}/CMSIS/AmbiqMicro/Include" "-I{ap3core.ambiq_sdk.path}/CMSIS/ARM/Include"
48+
includes.core="-I{ap3core.path}/ard_sup" "-I{ap3core.path}/ard_sup/ard_supers" {includes}
49+
includes.variant="{build.includes}"
5050

5151

5252
## Precompiled Libraries
@@ -154,11 +154,11 @@ tools.ambiq_bin2board.upload.pattern={pgm} {args}
154154
##### The following tool settings are for the SparkFun variable bootloader (Artemis SVL) (Saturn Five Loader)
155155

156156
# Linux
157-
tools.artemis_svl.pgm={runtime.platform.path}/tools/ambiq/linux/artemis_svl/artemis_svl
157+
tools.artemis_svl.pgm={runtime.platform.path}/tools/artemis/linux/artemis_svl/artemis_svl
158158
tools.artemis_svl.args="{serial.port}" -f "{build.path}/{build.project_name}.bin" -b {upload.baud} {upload.verbose}
159159

160160
# MacOSX
161-
tools.artemis_svl.pgm.macosx={runtime.platform.path}/tools/ambiq/macosx/artemis_svl/artemis_svl
161+
tools.artemis_svl.pgm.macosx={runtime.platform.path}/tools/artemis/macosx/artemis_svl/artemis_svl
162162
tools.artemis_svl.args.macosx="{serial.port}" -f "{build.path}/{build.project_name}.bin" -b {upload.baud} {upload.verbose}
163163

164164
# Windows

0 commit comments

Comments
 (0)
Please sign in to comment.