diff --git a/README.MD b/README.MD index acaaeee..f84bed9 100644 --- a/README.MD +++ b/README.MD @@ -9,6 +9,7 @@ An mbed-os enabled Arduino core for Ambiq Apollo3 based boards - [Installation](#installation) - [**Arduino Boards Manager** (recommended)](#arduino-boards-manager-recommended) - [**Git** (development)](#git-development) + - [Getting Started](#getting-started) - [Development Status](#development-status) - [Priorities](#priorities) - [More](#more) @@ -26,14 +27,33 @@ An mbed-os enabled Arduino core for Ambiq Apollo3 based boards ### **Git** (development) - Ensure the proper directory structure exists by following the [Arduino Boards Manager](#arduino-boards-manager) instructions (install latest) - - Locate and enter the ```Arduino15``` directory - - ```cd ~/.../Arduino15``` - - Run the ```dev-install.sh``` script - - ```./packages/SparkFun/hardware/apollo3/*/tools/scripts/dev-install.sh``` + - navigate to your directory with the latest version + - rename the directory from 2.x.x to .bckup2.x.x (or simply delete it and download it later if wanted) + - clone this repo + `git clone https://github.com/sparkfun/Arduino_Apollo3.git` + - checkout desired branch + `cd Arduino_Apollo3` + `git checkout release-candidate` + - update all submodules + `git submodule update --init --recursive` + - rename directory from Arduino_Apollo3 to 2.x.x from above + - restart Arduino and enjoy. + +## Getting Started +For in depth tutorials, checkout out the [Artemis page](https://www.sparkfun.com/artemis) for the latest. Tutorials that may be of interest include: + - [Installing Board Definitions in the Arduino IDE](https://learn.sparkfun.com/tutorials/installing-board-definitions-in-the-arduino-ide) + - [Artemis Development with the Arduino IDE](https://learn.sparkfun.com/tutorials/artemis-development-with-the-arduino-ide) + +If you are comfortable with the arduino IDE and already have the boards installed, we recommend trying some examples from within the arduino IDE. Start with the "Built-in Examples" from arduino, but don't forget to checkout out some of the board specific examples that we have included with the package. These demonstrate how to use some of the libraries that make our Artemis board unique, and can take your next project to a new level! ## Development Status -* v2.0.0 based on an [mbed-os](https://github.com/ARMmbed/mbed-os) framework +* v2.0.0 Based on an [mbed-os](https://github.com/ARMmbed/mbed-os) framework +* v2.1.0 Contains latest fixes for the v2 core and feature that have been added since v2 release + +For more information on how to contribute or how to navigate this repo, check out the [Contributing](./docs/CONTRIBUTING.md) page. + +As mentioned MbedOS is the framework to our latest Arduino Core. To contribute to, or use these targets on, MbedOS check out the [main repo by ARM](https://github.com/ARMmbed/mbed-os). This library uses mbed libraries built from a fork of mbed that is maintained by us. The latest version of that repo can be found [here](https://github.com/sparkfun/mbed-os-ambiq-apollo3/tree/ambiq-apollo3-arduino). **Main Arduino Features** * Serial: ✅ @@ -56,11 +76,11 @@ An mbed-os enabled Arduino core for Ambiq Apollo3 based boards * PDM Microphones / I2S: ✅ * BLE: ✅ * RTC: ✅ - * Watchdog Timer: 🤔 - * Multi-bit SPI: 🤔 + * Watchdog Timer: ✅ + * Burst Mode: ✅ ## More -### [License](./docs/ISSUES.md) +### [License](./docs/LICENSE.md) ### [Contributing](./docs/CONTRIBUTING.md) ### [Issue Template](./docs/ISSUES.md) ### [Acknowledgements](./docs/ACKNOWLEDGEMENTS.md) diff --git a/boards.txt b/boards.txt index 4a7d8fd..c9934f6 100644 --- a/boards.txt +++ b/boards.txt @@ -36,11 +36,11 @@ sfe_artemis.build.defines= sfe_artemis.build.includes= sfe_artemis.build.libs= -sfe_artemis.menu.svl_baud.921600=921600 sfe_artemis.menu.svl_baud.460800=460800 sfe_artemis.menu.svl_baud.230400=230400 sfe_artemis.menu.svl_baud.115200=115200 sfe_artemis.menu.svl_baud.57600=57600 +sfe_artemis.menu.svl_baud.921600=921600 sfe_artemis.menu.loader.option_svl=SparkFun Variable Loader (Recommended) sfe_artemis.menu.loader.option_asb=Ambiq Secure Bootloader (Advanced) @@ -72,11 +72,11 @@ sfe_artemis_atp.build.defines= sfe_artemis_atp.build.includes= sfe_artemis_atp.build.libs= -sfe_artemis_atp.menu.svl_baud.921600=921600 sfe_artemis_atp.menu.svl_baud.460800=460800 sfe_artemis_atp.menu.svl_baud.230400=230400 sfe_artemis_atp.menu.svl_baud.115200=115200 sfe_artemis_atp.menu.svl_baud.57600=57600 +sfe_artemis_atp.menu.svl_baud.921600=921600 sfe_artemis_atp.menu.loader.option_svl=SparkFun Variable Loader (Recommended) sfe_artemis_atp.menu.loader.option_asb=Ambiq Secure Bootloader (Advanced) @@ -108,11 +108,11 @@ sfe_artemis_nano.build.defines= sfe_artemis_nano.build.includes= sfe_artemis_nano.build.libs= -sfe_artemis_nano.menu.svl_baud.921600=921600 sfe_artemis_nano.menu.svl_baud.460800=460800 sfe_artemis_nano.menu.svl_baud.230400=230400 sfe_artemis_nano.menu.svl_baud.115200=115200 sfe_artemis_nano.menu.svl_baud.57600=57600 +sfe_artemis_nano.menu.svl_baud.921600=921600 sfe_artemis_nano.menu.loader.option_svl=SparkFun Variable Loader (Recommended) sfe_artemis_nano.menu.loader.option_asb=Ambiq Secure Bootloader (Advanced) @@ -144,11 +144,11 @@ sfe_artemis_thing_plus.build.defines= sfe_artemis_thing_plus.build.includes= sfe_artemis_thing_plus.build.libs= -sfe_artemis_thing_plus.menu.svl_baud.921600=921600 sfe_artemis_thing_plus.menu.svl_baud.460800=460800 sfe_artemis_thing_plus.menu.svl_baud.230400=230400 sfe_artemis_thing_plus.menu.svl_baud.115200=115200 sfe_artemis_thing_plus.menu.svl_baud.57600=57600 +sfe_artemis_thing_plus.menu.svl_baud.921600=921600 sfe_artemis_thing_plus.menu.loader.option_svl=SparkFun Variable Loader (Recommended) sfe_artemis_thing_plus.menu.loader.option_asb=Ambiq Secure Bootloader (Advanced) @@ -180,12 +180,12 @@ sfe_edge.build.defines= sfe_edge.build.includes= sfe_edge.build.libs= -sfe_edge.menu.svl_baud.921600=921600 + sfe_edge.menu.svl_baud.460800=460800 sfe_edge.menu.svl_baud.230400=230400 sfe_edge.menu.svl_baud.115200=115200 sfe_edge.menu.svl_baud.57600=57600 - +sfe_edge.menu.svl_baud.921600=921600 sfe_edge.menu.asb_baud.921600=921600 (SparkFun.com) sfe_edge.menu.asb_baud.115200=115200 (TensorFlow Conference) @@ -221,11 +221,11 @@ sfe_edge2.build.defines= sfe_edge2.build.includes= sfe_edge2.build.libs= -sfe_edge2.menu.svl_baud.921600=921600 sfe_edge2.menu.svl_baud.460800=460800 sfe_edge2.menu.svl_baud.230400=230400 sfe_edge2.menu.svl_baud.115200=115200 sfe_edge2.menu.svl_baud.57600=57600 +sfe_edge2.menu.svl_baud.921600=921600 sfe_edge2.menu.loader.option_svl=SparkFun Variable Loader (Recommended) sfe_edge2.menu.loader.option_asb=Ambiq Secure Bootloader (Advanced) @@ -257,11 +257,11 @@ sfe_artemis_mm_pb.build.defines= sfe_artemis_mm_pb.build.includes= sfe_artemis_mm_pb.build.libs= -sfe_artemis_mm_pb.menu.svl_baud.921600=921600 sfe_artemis_mm_pb.menu.svl_baud.460800=460800 sfe_artemis_mm_pb.menu.svl_baud.230400=230400 sfe_artemis_mm_pb.menu.svl_baud.115200=115200 sfe_artemis_mm_pb.menu.svl_baud.57600=57600 +sfe_artemis_mm_pb.menu.svl_baud.921600=921600 sfe_artemis_mm_pb.menu.loader.option_svl=SparkFun Variable Loader (Recommended) sfe_artemis_mm_pb.menu.loader.option_asb=Ambiq Secure Bootloader (Advanced) @@ -293,11 +293,11 @@ sfe_artemis_module.build.defines= sfe_artemis_module.build.includes= sfe_artemis_module.build.libs= -sfe_artemis_module.menu.svl_baud.921600=921600 sfe_artemis_module.menu.svl_baud.460800=460800 sfe_artemis_module.menu.svl_baud.230400=230400 sfe_artemis_module.menu.svl_baud.115200=115200 sfe_artemis_module.menu.svl_baud.57600=57600 +sfe_artemis_module.menu.svl_baud.921600=921600 sfe_artemis_module.menu.loader.option_svl=SparkFun Variable Loader (Recommended) sfe_artemis_module.menu.loader.option_asb=Ambiq Secure Bootloader (Advanced) @@ -337,11 +337,11 @@ lora_thing_plus.build.defs= lora_thing_plus.build.libs= -lora_thing_plus.menu.svl_baud.921600=921600 lora_thing_plus.menu.svl_baud.460800=460800 lora_thing_plus.menu.svl_baud.230400=230400 lora_thing_plus.menu.svl_baud.115200=115200 lora_thing_plus.menu.svl_baud.57600=57600 +lora_thing_plus.menu.svl_baud.921600=921600 lora_thing_plus.menu.loader.option_svl=SparkFun Variable Loader (Recommended) lora_thing_plus.menu.loader.option_asb=Ambiq Secure Bootloader (Advanced) diff --git a/cores/arduino/sdk/core-implement/CommonAnalog.cpp b/cores/arduino/sdk/core-implement/CommonAnalog.cpp index 64e4514..9b1da29 100644 --- a/cores/arduino/sdk/core-implement/CommonAnalog.cpp +++ b/cores/arduino/sdk/core-implement/CommonAnalog.cpp @@ -213,10 +213,11 @@ ap3_err_t analogWriteFrameWidth(uint32_t width){ ap3_err_t analogWriteFrequency(float freq){ uint32_t new_width = (uint32_t)(AP3_ANALOG_CLK_FREQ / freq); + if (new_width > AP3_MAX_ANALOG_WRITE_WIDTH){ return AP3_ERR; } - if (new_width < AP3_MAX_ANALOG_WRITE_WIDTH){ + if (new_width < AP3_MIN_ANALOG_WRITE_WIDTH){ return AP3_ERR; } _analogWriteWidth = new_width; diff --git a/cores/mbed-os b/cores/mbed-os index 0773105..be07f05 160000 --- a/cores/mbed-os +++ b/cores/mbed-os @@ -1 +1 @@ -Subproject commit 0773105959af71b6d21a6f722635d837b49ba344 +Subproject commit be07f057170a4e9ed4a286abb2170b9df3d52de3 diff --git a/libraries/BurstMode/examples/Example1_EnableDisable/Example1_EnableDisable.ino b/libraries/BurstMode/examples/Example1_EnableDisable/Example1_EnableDisable.ino new file mode 100644 index 0000000..2ca1dc3 --- /dev/null +++ b/libraries/BurstMode/examples/Example1_EnableDisable/Example1_EnableDisable.ino @@ -0,0 +1,42 @@ +//Burst Mode example +//TEST_PIN is toggled as fast as possible, with burst mode enable and disabled. +//Use a logic analyzer to view the difference in output +#include "BurstMode.h" + +#define TEST_PIN D2 //Change to whatever pin you would like + +#define NUM_TOGGLES 20 //Number of times to toggle the gpio as an example task + +void setup() { + Serial.begin(115200); + Serial.println("BurstMode Example1 - Enable and Disable"); +} + +void loop() { + long startTime, endTime; + enableBurstMode(); //Go to 96MHz + //Toggle the with digital write as fast as possible, 20 times + startTime = micros(); + for(int i = 0; i < NUM_TOGGLES; i++) + { + digitalWrite(TEST_PIN, HIGH); + digitalWrite(TEST_PIN, LOW); + } + endTime = micros(); + Serial.printf("Time (in microseconds) to toggle GPIO %d times = %d, at clock speed %d \r\n", + NUM_TOGGLES, (endTime - startTime), getCpuFreqMHz()); + + disableBurstMode(); //Go back to 48MHz + //Toggle the with digital write as fast as possible, 20 times + startTime = micros(); + for(int i = 0; i < NUM_TOGGLES; i++) + { + digitalWrite(TEST_PIN, HIGH); + digitalWrite(TEST_PIN, LOW); + } + endTime = micros(); + Serial.printf("Time (in microseconds) to toggle GPIO %d times = %d, at clock speed %d \r\n", + NUM_TOGGLES, (endTime - startTime), getCpuFreqMHz()); + + delay(1000); +} \ No newline at end of file diff --git a/libraries/BurstMode/keywords.txt b/libraries/BurstMode/keywords.txt new file mode 100644 index 0000000..ae3066f --- /dev/null +++ b/libraries/BurstMode/keywords.txt @@ -0,0 +1,16 @@ +# Syntax Coloring Map For 'libraries/BurstMode' + +# Datatypes (KEYWORD1) + + +# Functions (KEYWORD2) +enableBurstMode KEYWORD2 +disableBurstMode KEYWORD2 +getCpuFreqMHz KEYWORD2 + +# Structures (KEYWORD3) + +# Constants (LITERAL1) + +# Properties (LITERAL2) + diff --git a/libraries/BurstMode/library.properties b/libraries/BurstMode/library.properties new file mode 100644 index 0000000..924ce7e --- /dev/null +++ b/libraries/BurstMode/library.properties @@ -0,0 +1,9 @@ +name=BurstMode +version=2.0.0 +author=SparkFun Electronics +maintainer=SparkFun Electronics +sentence=Burst Mode library for the SparkFun Artemis +paragraph=Allows for enabling, disabling, and checking status of burst mode which changes the clock from 48Mhz to 96Mhz +category= +url= +architectures=apollo3 diff --git a/libraries/BurstMode/src/BurstMode.cpp b/libraries/BurstMode/src/BurstMode.cpp new file mode 100644 index 0000000..9ee6ecc --- /dev/null +++ b/libraries/BurstMode/src/BurstMode.cpp @@ -0,0 +1,50 @@ +#include "BurstMode.h" + +uint32_t cpuFreq = 48000000; //At POR core is 48MHz + +//Turns main processor from 48MHz to 96MHz +//Returns false if burst mode failed to enable +bool enableBurstMode(void) +{ + // Check that the Burst Feature is available. + am_hal_burst_avail_e eBurstModeAvailable; + if (AM_HAL_STATUS_SUCCESS != am_hal_burst_mode_initialize(&eBurstModeAvailable)) + { + return (false); + } + + // Put the MCU into "Burst" mode. + am_hal_burst_mode_e eBurstMode; + if (AM_HAL_STATUS_SUCCESS != am_hal_burst_mode_enable(&eBurstMode)) + { + return (false); + } + cpuFreq = 96000000; + return (true); +} + +//Turns main processor from 96MHz to 48MHz +//Returns false if disable fails +bool disableBurstMode(void) +{ + am_hal_burst_mode_e eBurstMode; + if (AM_HAL_STATUS_SUCCESS == am_hal_burst_mode_disable(&eBurstMode)) + { + if (AM_HAL_NORMAL_MODE != eBurstMode) + { + return (false); + } + } + else + { + return (false); + } + cpuFreq = 48000000; + return (true); +} + +//Returns the current core speed +uint32_t getCpuFreqMHz(void) +{ + return (cpuFreq); +} \ No newline at end of file diff --git a/libraries/BurstMode/src/BurstMode.h b/libraries/BurstMode/src/BurstMode.h new file mode 100644 index 0000000..b232775 --- /dev/null +++ b/libraries/BurstMode/src/BurstMode.h @@ -0,0 +1,31 @@ +/* +Copyright (c) 2019 SparkFun Electronics + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +#ifndef _AP3_CLOCK_SOURCES_H_ +#define _AP3_CLOCK_SOURCES_H_ + +#include "Arduino.h" + +bool enableBurstMode(); +bool disableBurstMode(); +uint32_t getCpuFreqMHz(); + +#endif //_AP3_GPIO_H_ \ No newline at end of file diff --git a/libraries/EEPROM/examples/Example1_PutGet/Example1_PutGet.ino b/libraries/EEPROM/examples/Example1_PutGet/Example1_PutGet.ino index 097b7f0..90b9d90 100644 --- a/libraries/EEPROM/examples/Example1_PutGet/Example1_PutGet.ino +++ b/libraries/EEPROM/examples/Example1_PutGet/Example1_PutGet.ino @@ -13,6 +13,7 @@ void setup() { SERIAL.begin(115200); SERIAL.println("EEPROM Example1_PutGet"); + EEPROM.init(); // use EEPROM.get(int index, T type) to retrieve // an arbitrary type from flash memory diff --git a/libraries/PDM/examples/Example2_ConfigureMic/Example2_ConfigureMic.ino b/libraries/PDM/examples/Example2_ConfigureMic/Example2_ConfigureMic.ino index 1517814..1e887d3 100644 --- a/libraries/PDM/examples/Example2_ConfigureMic/Example2_ConfigureMic.ino +++ b/libraries/PDM/examples/Example2_ConfigureMic/Example2_ConfigureMic.ino @@ -36,8 +36,8 @@ void setup() // The variant files for Artemis carrier boards have Mic data and clock pins defined // but these pins can be passed to the the .begin function - //if (myPDM.begin() == false) //Use Data, clock defines from variant file - if (myPDM.begin(22, 23) == false) //Data, clock on Artemis Nano - These are the pin names from variant file, not pad names + if (myPDM.begin() == false) //Use Data, clock defines from variant file + //if (myPDM.begin(22, 23) == false) //Data, clock on Artemis Nano - These are the pin names from variant file, not pad names { Serial.println("PDM Init failed. Are you sure these pins are PDM capable?"); while (1) diff --git a/libraries/PDM/examples/Example4_RecordToWav/ConvertToWav.py b/libraries/PDM/examples/Example4_RecordToWav/ConvertToWav.py new file mode 100644 index 0000000..37e9335 --- /dev/null +++ b/libraries/PDM/examples/Example4_RecordToWav/ConvertToWav.py @@ -0,0 +1,132 @@ +#!/usr/bin/python +from __future__ import division + +""" +Author: Justice Amoh +Date: 11/01/2019 +Description: Python script to stream audio from Artemis Apollo3 PDM microphone +""" +import sys +import serial +import numpy as np +import matplotlib.pyplot as plt + +from serial.tools import list_ports +from time import sleep +from scipy.io import wavfile +from datetime import datetime + + +# Controls +do_plot = True +do_save = True +wavname = 'recording_%s.wav'%(datetime.now().strftime("%m%d_%H%M")) +runtime = 50#100 # runtime in frames, sec/10 + +# Find Artemis Serial Port +ports = list_ports.comports() +try: + sPort = [p[0] for p in ports if 'cu.wchusbserial' in p[0]][0] +except Exception as e: + print 'Cannot find serial port!' + sys.exit(3) + +# Serial Config +ser = serial.Serial(sPort,115200) +ser.reset_input_buffer() +ser.reset_output_buffer() + + +# Audio Format & Datatype +dtype = np.int16 # Data type to read data +typelen = np.dtype(dtype).itemsize # Length of data type +maxval = 32768. # 2**15 # For 16bit signed + +# Plot Parameters +delay = .00001 # Use 1us pauses - as in matlab +fsamp = 16000 # Sampling rate +nframes = 10 # No. of frames to read at a time +buflen = fsamp//10 # Buffer length +bufsize = buflen*typelen # Resulting number of bytes to read +window = fsamp*10 # window of signal to plot at a time in samples + + +# Variables +x = [0]*window +t = np.arange(window)/fsamp # [x/fsamp for x in range(10)] + +#--------------- +# Plot & Figures +#--------------- +plt.ion() +plt.show() + + +# Configure Figure +with plt.style.context(('dark_background')): + fig,axs = plt.subplots(1,1,figsize=(7,2.5)) + + lw, = axs.plot(t,x,'r') + axs.set_xlim(0,window/fsamp) + axs.grid(which='major', alpha=0.2) + axs.set_ylim(-1,1) + axs.set_xlabel('Time (s)') + axs.set_ylabel('Amplitude') + axs.set_title('Streaming Audio') + plt.tight_layout() + plt.pause(0.001) + + + +# Start Transmission +ser.write('START') # Send Start command +sleep(1) + +for i in range(runtime): + buf = ser.read(bufsize) # Read audio data + buf = np.frombuffer(buf,dtype=dtype) # Convert to int16 + buf = buf/maxval # convert to float + x.extend(buf) # Append to waveform array + + # Update Plot lines + lw.set_ydata(x[-window:]) + + plt.pause(0.001) + sleep(delay) + + +# Stop Streaming +ser.write('STOP') +sleep(0.5) +ser.reset_input_buffer() +ser.reset_output_buffer() +ser.close() + +# Remove initial zeros +x = x[window:] + + +# Helper Functions +def plotAll(): + t = np.arange(len(x))/fsamp + with plt.style.context(('dark_background')): + fig,axs = plt.subplots(1,1,figsize=(7,2.5)) + lw, = axs.plot(t,x,'r') + axs.grid(which='major', alpha=0.2) + axs.set_xlim(0,t[-1]) + plt.tight_layout() + return + +# Plot All +if do_plot: + plt.close(fig) + plotAll() + +# Save Recorded Audio +if do_save: + wavfile.write(wavname,fsamp,np.array(x)) + print "Recording saved to file: %s"%wavname + + + + diff --git a/libraries/PDM/examples/Example4_RecordToWav/ConvertToWav3.py b/libraries/PDM/examples/Example4_RecordToWav/ConvertToWav3.py new file mode 100644 index 0000000..db2bf31 --- /dev/null +++ b/libraries/PDM/examples/Example4_RecordToWav/ConvertToWav3.py @@ -0,0 +1,130 @@ +#!/usr/bin/python + + +""" +Author: Justice Amoh +Date: 11/01/2019 +Description: Python script to stream audio from Artemis Apollo3 PDM microphone +""" +import sys +import serial +import numpy as np +import matplotlib.pyplot as plt + +from serial.tools import list_ports +from time import sleep +from scipy.io import wavfile +from datetime import datetime + + +# Controls +do_plot = True +do_save = True +wavname = 'recording_%s.wav' % (datetime.now().strftime("%m%d_%H%M")) +runtime = 50 # 100 # runtime in frames, sec/10 + +# Auto port assignment for Mac/Linux machines +# try: +# sPort = [p[0] for p in ports if 'cu.wchusbserial' in p[0]][0] +# except Exception as e: +# print('Cannot find serial port!') +# sys.exit(3) + +# Manual port assignment for windows machines +sPort = "COM16" + +# Serial Config +ser = serial.Serial(sPort, 500000) +ser.reset_input_buffer() +ser.reset_output_buffer() + + +# Audio Format & Datatype +dtype = np.int16 # Data type to read data +typelen = np.dtype(dtype).itemsize # Length of data type +maxval = 32768. # 2**15 # For 16bit signed + +# Plot Parameters +delay = .00001 # Use 1us pauses - as in matlab +fsamp = 16000 # Sampling rate +nframes = 10 # No. of frames to read at a time +buflen = fsamp//10 # Buffer length +bufsize = buflen*typelen # Resulting number of bytes to read +window = fsamp*10 # window of signal to plot at a time in samples + + +# Variables +x = [0]*window +t = np.arange(window)/fsamp # [x/fsamp for x in range(10)] + +# --------------- +# Plot & Figures +# --------------- +plt.ion() +plt.show() + + +# Configure Figure +with plt.style.context(('dark_background')): + fig, axs = plt.subplots(1, 1, figsize=(7, 2.5)) + + lw, = axs.plot(t, x, 'r') + axs.set_xlim(0, window/fsamp) + axs.grid(which='major', alpha=0.2) + axs.set_ylim(-1, 1) + axs.set_xlabel('Time (s)') + axs.set_ylabel('Amplitude') + axs.set_title('Streaming Audio') + plt.tight_layout() + plt.pause(0.001) + + +# Start Transmission +ser.write('START'.encode()) # Send Start command +sleep(1) + +for i in range(runtime): + buf = ser.read(bufsize) # Read audio data + buf = np.frombuffer(buf, dtype=dtype) # Convert to int16 + buf = buf/maxval # convert to float + x.extend(buf) # Append to waveform array + + # Update Plot lines + lw.set_ydata(x[-window:]) + + plt.pause(0.001) + sleep(delay) + + +# Stop Streaming +ser.write('STOP'.encode()) +sleep(0.5) +ser.reset_input_buffer() +ser.reset_output_buffer() +ser.close() + +# Remove initial zeros +x = x[window:] + + +# Helper Functions +def plotAll(): + t = np.arange(len(x))/fsamp + with plt.style.context(('dark_background')): + fig, axs = plt.subplots(1, 1, figsize=(7, 2.5)) + lw, = axs.plot(t, x, 'r') + axs.grid(which='major', alpha=0.2) + axs.set_xlim(0, t[-1]) + plt.tight_layout() + return + + +# Plot All +if do_plot: + plt.close(fig) + plotAll() + +# Save Recorded Audio +if do_save: + wavfile.write(wavname, fsamp, np.array(x)) + print("Recording saved to file: %s" % wavname) diff --git a/libraries/PDM/examples/Example4_RecordToWav/CorruptOutput.wav b/libraries/PDM/examples/Example4_RecordToWav/CorruptOutput.wav new file mode 100644 index 0000000..99e4a03 Binary files /dev/null and b/libraries/PDM/examples/Example4_RecordToWav/CorruptOutput.wav differ diff --git a/libraries/PDM/examples/Example4_RecordToWav/ExampleOutput.wav b/libraries/PDM/examples/Example4_RecordToWav/ExampleOutput.wav new file mode 100644 index 0000000..478f0d4 Binary files /dev/null and b/libraries/PDM/examples/Example4_RecordToWav/ExampleOutput.wav differ diff --git a/libraries/PDM/examples/Example4_RecordToWav/readme.md b/libraries/PDM/examples/Example4_RecordToWav/readme.md new file mode 100644 index 0000000..de29276 --- /dev/null +++ b/libraries/PDM/examples/Example4_RecordToWav/readme.md @@ -0,0 +1,11 @@ +Author: @justiceamoh and Nathan Seidle +Created: November 19th, 2019 +License: MIT. See SparkFun Arduino Apollo3 Project for more information + +This example demonstrates how to read audio data and output it to a WAV file. A sketch reads PDM data and outputs raw serial, and the ConverToWav python script (python versions 2 and 3 are both available) visualizes and coverts the serial data to a WAV file. + +Gotchas: + +* You will need to modify the python script to match the COM port used on your computer. For Windows based machines find the +* You may need to use VLC to play the WAV clips. The bitrate is 256kbps which is higher than some audio players can handle. +* Audio samples are generated fast enough that we need to output serial at 500kbps. \ No newline at end of file diff --git a/libraries/PDM/src/PDM.cpp b/libraries/PDM/src/PDM.cpp index 360b261..c32756e 100644 --- a/libraries/PDM/src/PDM.cpp +++ b/libraries/PDM/src/PDM.cpp @@ -23,15 +23,6 @@ SOFTWARE. AP3_PDM *ap3_pdm_handle = 0; -// AP3_PDM::AP3_PDM(uint16_t *userBuffer, uint32_t bufferSize) -// { -// _userBuffer = userBuffer; -// _userBufferSize = bufferSize; - -// _readHead = 0; -// _writeHead = 0; -// } - bool AP3_PDM::begin(pin_size_t pinPDMData, pin_size_t pinPDMClock) { _PDMhandle = NULL; @@ -48,7 +39,6 @@ bool AP3_PDM::begin(pin_size_t pinPDMData, pin_size_t pinPDMClock) bool AP3_PDM::available(void) { - // if (_readHead != _writeHead) if (buff1New || buff2New) return (true); return (false); @@ -76,6 +66,7 @@ uint32_t AP3_PDM::_begin(void) { return retval; } + pincfg.uFuncSel = funcsel; // set the proper function select option for this instance/pin/type combination retval = am_hal_gpio_pinconfig(_pinPDMData, pincfg); if (retval != AP3_OK) @@ -88,6 +79,7 @@ uint32_t AP3_PDM::_begin(void) { return retval; } + pincfg.uFuncSel = funcsel; // set the proper function select option for this instance/pin/type combination retval = am_hal_gpio_pinconfig(_pinPDMClock, pincfg); if (retval != AP3_OK) @@ -107,16 +99,19 @@ uint32_t AP3_PDM::_begin(void) return retval; } } + retval = (uint32_t)am_hal_pdm_power_control(_PDMhandle, AM_HAL_PDM_POWER_ON, false); if (retval != AP3_OK) { return retval; } + retval = (uint32_t)am_hal_pdm_configure(_PDMhandle, &_PDMconfig); if (retval != AP3_OK) { return retval; } + retval = (uint32_t)am_hal_pdm_enable(_PDMhandle); if (retval != AP3_OK) { @@ -128,7 +123,6 @@ uint32_t AP3_PDM::_begin(void) // completion). // am_hal_pdm_interrupt_enable(_PDMhandle, (AM_HAL_PDM_INT_DERR | AM_HAL_PDM_INT_DCMP | AM_HAL_PDM_INT_UNDFL | AM_HAL_PDM_INT_OVF)); - //am_hal_interrupt_master_enable(); NVIC_EnableIRQ(PDM_IRQn); // Register the class into the local list @@ -312,12 +306,6 @@ uint32_t AP3_PDM::getData(uint16_t *externalBuffer, uint32_t externalBufferSize) } buff2New = false; } - // for (int x = 0; x < externalBufferSize; x++) - // { - // externalBuffer[x] = _userBuffer[_readHead]; - // _readHead++; //Advance the read head - // _readHead %= _userBufferSize; //Wrap if necessary - // } return (externalBufferSize); } @@ -327,69 +315,42 @@ inline void AP3_PDM::pdm_isr(void) uint32_t ui32Status; // Read the interrupt status. - am_hal_pdm_interrupt_status_get(_PDMhandle, &ui32Status, true); - am_hal_pdm_interrupt_clear(_PDMhandle, ui32Status); - - if (ui32Status & AM_HAL_PDM_INT_DCMP) + if(_PDMhandle) { - uint32_t tempReadAmt = _pdmBufferSize; - - // if (_writeHead + _pdmBufferSize > _userBufferSize) - // { - // //Goes past the end of our buffer, adjust the amout to read so we hit end of buffer - // tempReadAmt = _userBufferSize - _writeHead; //16384 - 16000 = 384 - // } - - // int i; - // for (i = 0; i < tempReadAmt; i++) - // { - // _userBuffer[_writeHead + i] = _pdmDataBuffer[i]; - // } - - // _writeHead += tempReadAmt; //Advance the head - // _writeHead %= _userBufferSize; //Wrap the head - - // if (tempReadAmt < _pdmBufferSize) - // { - // //Finish the read where i had left off - // for (; i < _pdmBufferSize; i++) - // { - // _userBuffer[i - tempReadAmt] = _pdmDataBuffer[i]; - // } - - // _writeHead += _pdmBufferSize - tempReadAmt; - // } - //Check for overflow - //if (_writeHead + pdmBufferSize - - //Store in the first available buffer - if (buff1New == false) + am_hal_pdm_interrupt_status_get(_PDMhandle, &ui32Status, true); + am_hal_pdm_interrupt_clear(_PDMhandle, ui32Status); + + if (ui32Status & AM_HAL_PDM_INT_DCMP) { - for (int i = 0; i < _pdmBufferSize; i++) + uint32_t tempReadAmt = _pdmBufferSize; + + //Store in the first available buffer + if (buff1New == false) { - outBuffer1[i] = pi16Buffer[i]; + for (int i = 0; i < _pdmBufferSize; i++) + { + outBuffer1[i] = pi16Buffer[i]; + } + buff1New = true; } - buff1New = true; - } - else if (buff2New == false) - { - for (int i = 0; i < _pdmBufferSize; i++) + else if (buff2New == false) { - outBuffer2[i] = pi16Buffer[i]; + for (int i = 0; i < _pdmBufferSize; i++) + { + outBuffer2[i] = pi16Buffer[i]; + } + buff2New = true; + } + else + { + _overrun = true; + buff2New=false; + buff1New=false; } - buff2New = true; - } - else - { - _overrun = true; - //Used for debugging - Serial.println("\n\rOver flow!"); - while (1) - ; - } - //Start next conversion - am_hal_pdm_dma_start(_PDMhandle, &sTransfer); + //Start next conversion + am_hal_pdm_dma_start(_PDMhandle, &sTransfer); + } } } @@ -398,7 +359,7 @@ inline void AP3_PDM::pdm_isr(void) // PDM interrupt handler. // //***************************************************************************** -extern "C" void am_pdm_isr(void) +extern "C" void am_pdm0_isr(void) { ap3_pdm_handle->pdm_isr(); } diff --git a/libraries/RTC/examples/Example1_Get_Time/Example1_Get_Time.ino b/libraries/RTC/examples/Example1_Get_Time/Example1_Get_Time.ino index 5f4af7a..1c85b5f 100644 --- a/libraries/RTC/examples/Example1_Get_Time/Example1_Get_Time.ino +++ b/libraries/RTC/examples/Example1_Get_Time/Example1_Get_Time.ino @@ -3,7 +3,7 @@ Created: Septempter 27th, 2019 This example demonstrates how to initialize and read from the on-board RTC. - + Most SparkFun Artemis boards have the necessary external 32kHz crystal to enable the RTC. If you are using the Artemis module bare you will either need an external 32kHz xtal or use the internal LFRC. Read the datasheet @@ -12,7 +12,7 @@ This example is based on the Ambiq SDK EVB2 RTC example. */ -/* +/* // This file is subject to the terms and conditions defined in // file 'LICENSE.md', which is part of this source code package. */ @@ -25,28 +25,28 @@ void setup() Serial.println("SparkFun RTC Example"); // Easily set RTC using the system __DATE__ and __TIME__ macros from compiler - RTC.setToCompilerTime(); + rtc.setToCompilerTime(); - // // Manually set RTC date and time - // RTC.setTime(0, 50, 59, 12, 3, 6, 20); // 12:59:50.000, June 3rd, 2020 (hund, ss, mm, hh, dd, mm, yy) + // Manually set RTC date and time + // rtc.setTime(0, 50, 59, 12, 3, 6, 20); // 12:59:50.000, June 3rd, 2020 (hund, ss, mm, hh, dd, mm, yy) } void loop() { - RTC.getTime(); + rtc.getTime(); Serial.printf("It is now "); - Serial.printf("%d:", RTC.hour); - Serial.printf("%02d:", RTC.minute); - Serial.printf("%02d.", RTC.seconds); - Serial.printf("%02d", RTC.hundredths); + Serial.printf("%d:", rtc.hour); + Serial.printf("%02d:", rtc.minute); + Serial.printf("%02d.", rtc.seconds); + Serial.printf("%02d", rtc.hundredths); - Serial.printf(" %02d/", RTC.month); - Serial.printf("%02d/", RTC.dayOfMonth); - Serial.printf("%02d", RTC.year); + Serial.printf(" %02d/", rtc.month); + Serial.printf("%02d/", rtc.dayOfMonth); + Serial.printf("%02d", rtc.year); - Serial.printf(" Day of week: %d =", RTC.weekday); - Serial.printf(" %s", RTC.textWeekday); + Serial.printf(" Day of week: %d =", rtc.weekday); + Serial.printf(" %s", rtc.textWeekday); Serial.println(); diff --git a/libraries/RTC/examples/Example2_Set_Alarms/Example2_Set_Alarms.ino b/libraries/RTC/examples/Example2_Set_Alarms/Example2_Set_Alarms.ino index 3669da7..a2af583 100644 --- a/libraries/RTC/examples/Example2_Set_Alarms/Example2_Set_Alarms.ino +++ b/libraries/RTC/examples/Example2_Set_Alarms/Example2_Set_Alarms.ino @@ -28,13 +28,13 @@ void setup() Serial.println("SparkFun RTC Set Alarm Example"); // // Easily set RTC using the system __DATE__ and __TIME__ macros from compiler - // RTC.setToCompilerTime(); + // rtc.setToCompilerTime(); // Manually set RTC date and time - RTC.setTime(0, 50, 59, 12, 3, 6, 20); // 12:59:50.000, June 3rd, 2020 (hund, ss, mm, hh, dd, mm, yy) + rtc.setTime(0, 50, 59, 12, 3, 6, 20); // 12:59:50.000, June 3rd, 2020 (hund, ss, mm, hh, dd, mm, yy) // Set the RTC's alarm - RTC.setAlarm(0, 0, 0, 13, 3, 6); // 13:00:00.000, June 3rd (hund, ss, mm, hh, dd, mm). Note: No year alarm register + rtc.setAlarm(0, 0, 0, 13, 3, 6); // 13:00:00.000, June 3rd (hund, ss, mm, hh, dd, mm). Note: No year alarm register // Set the RTC alarm mode /* @@ -47,8 +47,8 @@ void setup() 6: Alarm match every minute (hundredths, seconds) 7: Alarm match every second (hundredths) */ - RTC.setAlarmMode(6); // Set the RTC alarm to match on minutes rollover - RTC.attachInterrupt(); // Attach RTC alarm interrupt + rtc.setAlarmMode(6); // Set the RTC alarm to match on minutes rollover + rtc.attachInterrupt(); // Attach RTC alarm interrupt // Print the RTC's alarm date and time Serial.print("Next alarm: "); printAlarm(); @@ -77,31 +77,29 @@ void loop() // Print the RTC's current date and time void printDateTime() { - RTC.getTime(); - char dateTimeBuffer[25]; - sprintf(dateTimeBuffer, "20%02d-%02d-%02d %02d:%02d:%02d.%03d", - RTC.year, RTC.month, RTC.dayOfMonth, - RTC.hour, RTC.minute, RTC.seconds, RTC.hundredths); - Serial.println(dateTimeBuffer); + rtc.getTime(); + Serial.printf("20%02d-%02d-%02d %02d:%02d:%02d.%03d\n", + rtc.year, rtc.month, rtc.dayOfMonth, + rtc.hour, rtc.minute, rtc.seconds, rtc.hundredths); } // Print the RTC's alarm void printAlarm() { - RTC.getAlarm(); - char alarmBuffer[25]; - sprintf(alarmBuffer, "2020-%02d-%02d %02d:%02d:%02d.%03d", - RTC.alarmMonth, RTC.alarmDayOfMonth, - RTC.alarmHour, RTC.alarmMinute, - RTC.alarmSeconds, RTC.alarmHundredths); - Serial.println(alarmBuffer); + rtc.getAlarm(); + + Serial.printf("2020-%02d-%02d %02d:%02d:%02d.%03d\n", + rtc.alarmMonth, rtc.alarmDayOfMonth, + rtc.alarmHour, rtc.alarmMinute, + rtc.alarmSeconds, rtc.alarmHundredths); + Serial.println(); } // Interrupt handler for the RTC extern "C" void am_rtc_isr(void) { // Clear the RTC alarm interrupt. - am_hal_rtc_int_clear(AM_HAL_RTC_INT_ALM); + rtc.clearInterrupt(); // Set alarm flag alarmFlag = true; diff --git a/libraries/RTC/examples/Example3_Test_RTC/Example3_Test_RTC.ino b/libraries/RTC/examples/Example3_Test_RTC/Example3_Test_RTC.ino index 79bb2c4..5bddffb 100644 --- a/libraries/RTC/examples/Example3_Test_RTC/Example3_Test_RTC.ino +++ b/libraries/RTC/examples/Example3_Test_RTC/Example3_Test_RTC.ino @@ -21,13 +21,13 @@ void setup() Serial.println("Artemis RTC Testing"); // Manually set RTC date and time to the start of 2020 so that RTC contains valid times - RTC.setTime(0, 59, 59, 23, 1, 1, 20); // Set to 1 second before midnight Jan 1 + rtc.setTime(0, 59, 59, 23, 1, 1, 20); // Set to 1 second before midnight Jan 1 } void loop() { - RTC.setTime(99, 59, 59, 23, RTC.dayOfMonth, RTC.month, RTC.year); // Manually set RTC 1/100th of a second from the next day - previousDay = RTC.weekday; + rtc.setTime(99, 59, 59, 23, rtc.dayOfMonth, rtc.month, rtc.year); // Manually set RTC 1/100th of a second from the next day + previousDay = rtc.weekday; delay(11); //Allow us to roll from midnight the night before to the new day printArtemisTime(); @@ -38,8 +38,8 @@ void printArtemisTime() char buf[50]; char weekdayBuf[4]; - RTC.getTime(); - int i = RTC.weekday + 1; + rtc.getTime(); + int i = rtc.weekday + 1; switch (i) { case (1): @@ -69,15 +69,15 @@ void printArtemisTime() break; } - sprintf(buf, "%02d-%02d-%02d (%s) %02d:%02d:%02d.%02d", RTC.year, RTC.month, RTC.dayOfMonth, weekdayBuf, RTC.hour, RTC.minute, RTC.seconds, RTC.hundredths); + sprintf(buf, "%02d-%02d-%02d (%s) %02d:%02d:%02d.%02d", rtc.year, rtc.month, rtc.dayOfMonth, weekdayBuf, rtc.hour, rtc.minute, rtc.seconds, rtc.hundredths); Serial.print(buf); //Move the previous day forward one day and make sure it matches today - if ((previousDay + 1) % 7 != RTC.weekday) + if ((previousDay + 1) % 7 != rtc.weekday) { - Serial.printf(" Error! previousDay: %d today: %d\n", previousDay, RTC.weekday); + Serial.printf(" Error! previousDay: %d today: %d\n", previousDay, rtc.weekday); while (1){}; } Serial.println(); -} \ No newline at end of file +} diff --git a/libraries/RTC/examples/Example4_Set_Epoch/Example4_Set_Epoch.ino b/libraries/RTC/examples/Example4_Set_Epoch/Example4_Set_Epoch.ino index 9cf4541..12959d2 100644 --- a/libraries/RTC/examples/Example4_Set_Epoch/Example4_Set_Epoch.ino +++ b/libraries/RTC/examples/Example4_Set_Epoch/Example4_Set_Epoch.ino @@ -18,13 +18,13 @@ void setup() Serial.println("SparkFun RTC Set UNIX Epoch Time Example"); // Set the RTC time using UNIX Epoch time - RTC.setEpoch(1591185600); // E.g. 12:00:00, June 3rd, 2020 + rtc.setEpoch(1591185600); // E.g. 12:00:00, June 3rd, 2020 } void loop() { // Print UNIX Epoch timestamp - Serial.print("Epoch time: "); Serial.println(RTC.getEpoch()); + Serial.print("Epoch time: "); Serial.println(rtc.getEpoch()); // Print RTC's date and time Serial.print("Timestamp: "); printDateTime(); @@ -35,10 +35,9 @@ void loop() // Print the RTC's current date and time void printDateTime() { - RTC.getTime(); - char dateTime[20]; - sprintf(dateTime, "20%02d-%02d-%02d %02d:%02d:%02d", - RTC.year, RTC.month, RTC.dayOfMonth, - RTC.hour, RTC.minute, RTC.seconds); - Serial.println(dateTime); + rtc.getTime(); + Serial.printf("20%02d-%02d-%02d %02d:%02d:%02d\n", + rtc.year, rtc.month, rtc.dayOfMonth, + rtc.hour, rtc.minute, rtc.seconds); + Serial.println(); } diff --git a/libraries/RTC/examples/Example5_Rolling_Alarms/Example5_Rolling_Alarms.ino b/libraries/RTC/examples/Example5_Rolling_Alarms/Example5_Rolling_Alarms.ino index 5a82bf2..aac0bd3 100644 --- a/libraries/RTC/examples/Example5_Rolling_Alarms/Example5_Rolling_Alarms.ino +++ b/libraries/RTC/examples/Example5_Rolling_Alarms/Example5_Rolling_Alarms.ino @@ -2,17 +2,17 @@ Author: Adam Garbo and Nathan Seidle Created: June 3rdrd, 2020 - This example demonstrates how to read and set rolling RTC alarms. Each time - the alarm triggers, a user-specified additional amount of time (seconds, - minutes or hours) can be added to create a rolling RTC alarm. Second, + This example demonstrates how to read and set rolling RTC alarms. Each time + the alarm triggers, a user-specified additional amount of time (seconds, + minutes or hours) can be added to create a rolling RTC alarm. Second, minute and hour rollovers are handled using modulo calculations. - The current code is configured as a 5-second rolling RTC alarm. + The current code is configured as a 5-second rolling RTC alarm. */ -/* -// This file is subject to the terms and conditions defined in -// file 'LICENSE.md', which is part of this source code package. +/* + // This file is subject to the terms and conditions defined in + // file 'LICENSE.md', which is part of this source code package. */ #include "RTC.h" @@ -31,10 +31,10 @@ void setup() // RTC.setToCompilerTime(); // Manually set RTC date and time - RTC.setTime(0, 50, 59, 12, 3, 6, 20); // 12:59:50.000, June 3rd, 2020 (hund, ss, mm, hh, dd, mm, yy) + rtc.setTime(0, 50, 59, 12, 3, 6, 20); // 12:59:50.000, June 3rd, 2020 (hund, ss, mm, hh, dd, mm, yy) // Set the RTC's alarm - RTC.setAlarm(0, 0, 0, 13, 3, 6); // 13:00:00.000, June 3rd (hund, ss, mm, hh, dd, mm). Note: No year alarm register + rtc.setAlarm(0, 0, 0, 13, 3, 6); // 13:00:00.000, June 3rd (hund, ss, mm, hh, dd, mm). Note: No year alarm register // Set the RTC alarm mode /* @@ -47,8 +47,8 @@ void setup() 6: Alarm match every minute (hundredths, seconds) 7: Alarm match every second (hundredths) */ - RTC.setAlarmMode(6); // Set the RTC alarm to match on minutes rollover - RTC.attachInterrupt(); // Attach RTC alarm interrupt + rtc.setAlarmMode(6); // Set the RTC alarm to match on minutes rollover + rtc.attachInterrupt(); // Attach RTC alarm interrupt // Print the RTC's alarm date and time Serial.print("Next alarm: "); printAlarm(); @@ -66,13 +66,13 @@ void loop() alarmFlag = false; // Set the RTC's rolling alarm - RTC.setAlarm(0, - (RTC.seconds + alarmSeconds) % 60, - (RTC.minute + alarmMinutes) % 60, - (RTC.hour + alarmHours) % 24, - RTC.dayOfMonth, - RTC.month); - RTC.setAlarmMode(6); + rtc.setAlarm(0, + (rtc.seconds + alarmSeconds) % 60, + (rtc.minute + alarmMinutes) % 60, + (rtc.hour + alarmHours) % 24, + rtc.dayOfMonth, + rtc.month); + rtc.setAlarmMode(6); // Print next RTC alarm date and time Serial.print("Next rolling alarm: "); printAlarm(); @@ -82,31 +82,29 @@ void loop() // Print the RTC's current date and time void printDateTime() { - RTC.getTime(); - char dateTimeBuffer[25]; - sprintf(dateTimeBuffer, "20%02d-%02d-%02d %02d:%02d:%02d.%03d", - RTC.year, RTC.month, RTC.dayOfMonth, - RTC.hour, RTC.minute, RTC.seconds, RTC.hundredths); - Serial.println(dateTimeBuffer); + rtc.getTime(); + Serial.printf("20%02d-%02d-%02d %02d:%02d:%02d.%03d\n", + rtc.year, rtc.month, rtc.dayOfMonth, + rtc.hour, rtc.minute, rtc.seconds, rtc.hundredths); + Serial.println(); } // Print the RTC's alarm void printAlarm() { - RTC.getAlarm(); - char alarmBuffer[25]; - sprintf(alarmBuffer, "2020-%02d-%02d %02d:%02d:%02d.%03d", - RTC.alarmMonth, RTC.alarmDayOfMonth, - RTC.alarmHour, RTC.alarmMinute, - RTC.alarmSeconds, RTC.alarmHundredths); - Serial.println(alarmBuffer); + rtc.getAlarm(); + Serial.printf("2020-%02d-%02d %02d:%02d:%02d.%03d\n", + rtc.alarmMonth, rtc.alarmDayOfMonth, + rtc.alarmHour, rtc.alarmMinute, + rtc.alarmSeconds, rtc.alarmHundredths); + Serial.println(); } // Interrupt handler for the RTC extern "C" void am_rtc_isr(void) { // Clear the RTC alarm interrupt. - am_hal_rtc_int_clear(AM_HAL_RTC_INT_ALM); + rtc.clearInterrupt(); // Set alarm flag alarmFlag = true; diff --git a/libraries/RTC/examples/Example6_LowPower_Alarm/Example6_LowPower_Alarm.ino b/libraries/RTC/examples/Example6_LowPower_Alarm/Example6_LowPower_Alarm.ino index f59ab51..9cbcecf 100644 --- a/libraries/RTC/examples/Example6_LowPower_Alarm/Example6_LowPower_Alarm.ino +++ b/libraries/RTC/examples/Example6_LowPower_Alarm/Example6_LowPower_Alarm.ino @@ -16,8 +16,6 @@ // file 'LICENSE.md', which is part of this source code package. */ -#ifdef I_WANT_TO_BRICK_MY_BOARD - #include "RTC.h" void setup() @@ -29,10 +27,10 @@ void setup() // RTC.setToCompilerTime(); // Manually set RTC date and time - RTC.setTime(0, 50, 59, 12, 3, 6, 20); // 12:59:50.000, June 3rd, 2020 (hund, ss, mm, hh, dd, mm, yy) + rtc.setTime(0, 50, 59, 12, 3, 6, 20); // 12:59:50.000, June 3rd, 2020 (hund, ss, mm, hh, dd, mm, yy) // Set the RTC's alarm - RTC.setAlarm(0, 0, 0, 13, 3, 6); // 13:00:00.000, June 3rd (hund, ss, mm, hh, dd, mm). Note: No year alarm register + rtc.setAlarm(0, 0, 0, 13, 3, 6); // 13:00:00.000, June 3rd (hund, ss, mm, hh, dd, mm). Note: No year alarm register // Set the RTC alarm mode /* @@ -45,8 +43,8 @@ void setup() 6: Alarm match every minute (hundredths, seconds) 7: Alarm match every second (hundredths) */ - RTC.setAlarmMode(6); // Set the RTC alarm to match on minutes rollover - RTC.attachInterrupt(); // Attach RTC alarm interrupt + rtc.setAlarmMode(6); // Set the RTC alarm to match on minutes rollover + rtc.attachInterrupt(); // Attach RTC alarm interrupt } void loop() @@ -61,12 +59,12 @@ void loop() // Print the RTC's current date and time void printDateTime() { - RTC.getTime(); - char dateTimeBuffer[25]; - sprintf(dateTimeBuffer, "20%02d-%02d-%02d %02d:%02d:%02d.%03d", - RTC.year, RTC.month, RTC.dayOfMonth, - RTC.hour, RTC.minute, RTC.seconds, RTC.hundredths); - Serial.println(dateTimeBuffer); + rtc.getTime(); + + Serial.printf("20%02d-%02d-%02d %02d:%02d:%02d.%03d\n", + rtc.year, rtc.month, rtc.dayOfMonth, + rtc.hour, rtc.minute, rtc.seconds, rtc.hundredths); + Serial.println(); } // Power down gracefully @@ -89,16 +87,14 @@ void goToSleep() am_hal_pwrctrl_periph_disable(AM_HAL_PWRCTRL_PERIPH_UART0); am_hal_pwrctrl_periph_disable(AM_HAL_PWRCTRL_PERIPH_UART1); - // Disable all pads + // Disable all pads (except UART TX/RX) for (int x = 0 ; x < 50 ; x++) am_hal_gpio_pinconfig(x, g_AM_HAL_GPIO_DISABLE); - //Power down Flash, SRAM, cache - am_hal_pwrctrl_memory_deepsleep_powerdown(AM_HAL_PWRCTRL_MEM_CACHE); // Turn off CACHE - am_hal_pwrctrl_memory_deepsleep_powerdown(AM_HAL_PWRCTRL_MEM_FLASH_512K); // Turn off everything but lower 512k - am_hal_pwrctrl_memory_deepsleep_powerdown(AM_HAL_PWRCTRL_MEM_SRAM_64K_DTCM); // Turn off everything but lower 64k - //am_hal_pwrctrl_memory_deepsleep_powerdown(AM_HAL_PWRCTRL_MEM_ALL); //Turn off all memory (doesn't recover) - + //Power down CACHE, flashand SRAM + am_hal_pwrctrl_memory_deepsleep_powerdown(AM_HAL_PWRCTRL_MEM_ALL); // Turn off CACHE and flash + am_hal_pwrctrl_memory_deepsleep_retain(AM_HAL_PWRCTRL_MEM_SRAM_384K); // Retain all SRAM (0.6 uA) + // Keep the 32kHz clock running for RTC am_hal_stimer_config(AM_HAL_STIMER_CFG_CLEAR | AM_HAL_STIMER_CFG_FREEZE); am_hal_stimer_config(AM_HAL_STIMER_XTAL_32KHZ); @@ -112,6 +108,10 @@ void goToSleep() // Power up gracefully void wakeUp() { + // Go back to using the main clock + am_hal_stimer_config(AM_HAL_STIMER_CFG_CLEAR | AM_HAL_STIMER_CFG_FREEZE); + am_hal_stimer_config(AM_HAL_STIMER_HFRC_3MHZ); + // Power up SRAM, turn on entire Flash am_hal_pwrctrl_memory_deepsleep_powerdown(AM_HAL_PWRCTRL_MEM_MAX); @@ -119,6 +119,13 @@ void wakeUp() am_hal_stimer_config(AM_HAL_STIMER_CFG_CLEAR | AM_HAL_STIMER_CFG_FREEZE); am_hal_stimer_config(AM_HAL_STIMER_HFRC_3MHZ); + // Renable UART0 pins + am_hal_gpio_pinconfig(48, g_AM_BSP_GPIO_COM_UART_TX); + am_hal_gpio_pinconfig(49, g_AM_BSP_GPIO_COM_UART_RX); + + // Renable power to UART0 + am_hal_pwrctrl_periph_enable(AM_HAL_PWRCTRL_PERIPH_UART0); + // Enable ADC initializeADC(); @@ -130,7 +137,5 @@ void wakeUp() extern "C" void am_rtc_isr(void) { // Clear the RTC alarm interrupt - am_hal_rtc_int_clear(AM_HAL_RTC_INT_ALM); + rtc.clearInterrupt(); } - -#endif // I_WANT_TO_BRICK_MY_BOARD diff --git a/libraries/RTC/keywords.txt b/libraries/RTC/keywords.txt index cf6b8a5..ed80925 100644 --- a/libraries/RTC/keywords.txt +++ b/libraries/RTC/keywords.txt @@ -15,6 +15,7 @@ setAlarm KEYWORD2 setAlarmMode KEYWORD2 attachInterrupt KEYWORD2 detachInterrupt KEYWORD2 +clearInterrupt KEYWORD2 # Structures (KEYWORD3) @@ -40,4 +41,4 @@ alarmMinute LITERAL2 alarmSeconds LITERAL2 alarmHundredths LITERAL2 alarmTextWeekday LITERAL2 -RTC LITERAL2 +rtc LITERAL2 diff --git a/libraries/RTC/src/RTC.cpp b/libraries/RTC/src/RTC.cpp index 4eeb8b6..a3deb6d 100644 --- a/libraries/RTC/src/RTC.cpp +++ b/libraries/RTC/src/RTC.cpp @@ -6,7 +6,7 @@ #include "RTC.h" #include -Apollo3RTC RTC; +Apollo3RTC rtc; am_hal_rtc_time_t hal_time; am_hal_rtc_time_t alm_time; @@ -201,6 +201,11 @@ void Apollo3RTC::detachInterrupt() { am_hal_rtc_int_disable(AM_HAL_RTC_INT_ALM); } +void Apollo3RTC::clearInterrupt() { + // Clear the RTC alarm interrupt + am_hal_rtc_int_clear(AM_HAL_RTC_INT_ALM); +} + // mthToIndex() converts a string indicating a month to an index value. // The return value is a value 0-12, with 0-11 indicating the month given // by the string, and 12 indicating that the string is not a month. diff --git a/libraries/RTC/src/RTC.h b/libraries/RTC/src/RTC.h index 75d38dd..3a165fd 100644 --- a/libraries/RTC/src/RTC.h +++ b/libraries/RTC/src/RTC.h @@ -8,8 +8,8 @@ #include -#ifdef RTC -#undef RTC +#ifdef rtc +#undef rtc #endif class Apollo3RTC { @@ -34,6 +34,7 @@ class Apollo3RTC { void setAlarmMode(uint8_t mode); //Set the RTC alarm repeat interval void attachInterrupt(); //Attach the RTC alarm interrupt void detachInterrupt(); //Detach the RTC alarm interrupt + void clearInterrupt(); //Clear RTC alarm interrupt uint32_t weekday; //0 to 6 representing the day of the week uint32_t century; @@ -56,6 +57,6 @@ class Apollo3RTC { const char *alarmTextWeekday; }; -extern Apollo3RTC RTC; +extern Apollo3RTC rtc; #endif // _APOLLO3_LIBRARIES_RTC_H_ diff --git a/libraries/WDT/examples/Example1_WDT_Basic/Example1_WDT_Basic.ino b/libraries/WDT/examples/Example1_WDT_Basic/Example1_WDT_Basic.ino new file mode 100644 index 0000000..d59bc3d --- /dev/null +++ b/libraries/WDT/examples/Example1_WDT_Basic/Example1_WDT_Basic.ino @@ -0,0 +1,81 @@ +/* + Author: Adam Garbo + Created: February 1st, 2021 + License: MIT. See SparkFun Arduino Apollo3 Project for more information + + This example demonstrates a simple configuration of the Artemis Watchdog Timer. + + The code will configure the watchdog for both interrupt and reset generation, + and immediately start the watchdog timer. + + The watchdog ISR provided will 'pet' the watchdog four times. On the fifth + interrupt, the watchdog will not be pet, so the 'reset' action can occur. + On the sixth timeout event, the WDT will issue a system reset, and the + program will start over from the beginning. + + The watchdogCounter will show the number of ticks before the watchdog + reset occurs. + + This example is based on the Ambiq SDK 2.4.2 watchdog.c example. + + Tested with SparkFun Artemis Redboard. +*/ + +#include "WDT.h" + +volatile bool watchdogFlag = false; // Watchdog Timer ISR flag +volatile int watchdogInterrupt = 0; // Watchdog interrupt counter +unsigned long currentMillis = 0, + previousMillis = 0; + +void setup() { + + Serial.begin(115200); + + Serial.println("Artemis Watchdog Timer Example"); + + pinMode(LED_BUILTIN, OUTPUT); + + // Start the watchdog + wdt.start(); +} + +void loop() +{ + // Check for watchdog interrupts + if (watchdogFlag) + { + // Calculate duration between watchdog interrupts + currentMillis = millis() - previousMillis; + previousMillis = millis(); + + Serial.print("Interrupt: "); Serial.print(watchdogInterrupt); + Serial.print(" Period: "); Serial.print(currentMillis); Serial.println(" ms "); + + if (watchdogInterrupt == 5) + { + Serial.println("Warning: Watchdog has triggered a system reset"); + } + } + watchdogFlag = false; // Clear watchdog flag + delay(1); +} + +// Interrupt handler for the watchdog +extern "C" void am_watchdog_isr(void) +{ + // Clear the watchdog interrupt + wdt.clear(); + + // Catch the first four watchdog interrupts, but let the fifth through untouched + if ( watchdogInterrupt < 4 ) + { + wdt.restart(); // "Pet" the dog + } + else { + digitalWrite(LED_BUILTIN, HIGH); // Visual indication of system reset trigger + } + + watchdogFlag = true; // Set watchdog flag + watchdogInterrupt++; // Increment watchdog interrupt counter +} diff --git a/libraries/WDT/examples/Example2_WDT_Config/Example2_WDT_Config.ino b/libraries/WDT/examples/Example2_WDT_Config/Example2_WDT_Config.ino new file mode 100644 index 0000000..34dbfdd --- /dev/null +++ b/libraries/WDT/examples/Example2_WDT_Config/Example2_WDT_Config.ino @@ -0,0 +1,109 @@ +/* + Author: Adam Garbo + Created: February 1st, 2021 + License: MIT. See SparkFun Arduino Apollo3 Project for more information + + This example demonstrates how to modify the configuration of the Artemis + Watchdog Timer (WDT). + + The watchdog timer is controlled by a clock divider, interrupt ticks and + reset ticks. To achieve desired watchdog timing, a simple calculation can be made: + + period = # ticks / clock divider frequency + + Examples: + 128 interrupt ticks / 128 Hz clock = 1 second + 64 interrupt ticks / 16 Hz clock = 4 seconds + 32 interrupt ticks / 1 Hz clock = 32 seconds + 16 interrupt ticks / 1/16 Hz clock = 256 seconds + + The following code will configure the watchdog for both interrupt and reset + generation, and immediately start the watchdog timer. + The watchdog ISR provided will 'pet' the watchdog four times. On the fifth + interrupt, the watchdog will not be pet, so the 'reset' action can occur. + On the sixth timeout event, the WDT will issue a system reset, and the + program will start over from the beginning. + + This example is based on the Ambiq SDK 2.4.2 watchdog.c example. + + Tested with SparkFun Artemis Redboard. +*/ + +#include "WDT.h" + +volatile bool watchdogFlag = false; // Watchdog Timer ISR flag +volatile int watchdogInterrupt = 0; // Watchdog interrupt counter + +unsigned long currentMillis = 0, + previousMillis = 0; + +void setup() +{ + Serial.begin(115200); + + Serial.println("Artemis Watchdog Timer Example"); + + pinMode(LED_BUILTIN, OUTPUT); + // Configure the watchdog + /* + Available watchdog timer clock dividers. + Users can choose either the clock definition (i.e. WDT_128HZ) or Apoll3 core enumeration (i.e. 1) + WDT_OFF = 0 = Low Power Mode. This setting disables the watch dog timer + WDT_128HZ = 1 = 128 Hz + WDT_16HZ = 2 = 16 Hz + WDT_1HZ = 3 = 1 Hz + WDT1_16HZ = 4 = 1/16th Hz + */ + // Set watchdog timer clock to 128 Hz + // Set watchdog interrupt to 1 seconds (128 ticks / 128 Hz = 1 second) + // Set watchdog reset ~2 seconds (255 ticks / 128 Hz = 1.99 seconds) + // Note: Ticks are limited to 255 (8-bit) + wdt.configure(WDT_128HZ, 128, 255); // Equivalent to: wdt.configure(1, 128, 255); + wdt.start(); // Start the watchdog +} + +void loop() +{ + // Check for watchdog interrupts + if (watchdogFlag) + { + // Calculate duration between watchdog interrupts + currentMillis = millis() - previousMillis; + previousMillis = millis(); + + Serial.print("Interrupt: "); Serial.print(watchdogInterrupt); + Serial.print(" Period: "); Serial.print(currentMillis); Serial.println(" ms"); + + // The watchdog configurations can also be set individually + wdt.setClock(WDT_16HZ); // Set watchdog timer clock to 16 Hz + wdt.setInterrupt(64); // Set watchdog interrupt to 4 second (64 ticks / 16 Hz = 4 seconds) + wdt.setReset(96); // Set watchdog reset to 8 seconds (96 ticks / 16 Hz = 8 seconds) + + if (watchdogInterrupt == 9) + { + Serial.println("Warning: Watchdog has triggered a system reset"); + } + } + watchdogFlag = false; // Clear watchdog flag + delay(1); +} + +// Interrupt handler for the watchdog +extern "C" void am_watchdog_isr(void) +{ + // Clear the watchdog interrupt + wdt.clear(); + + // Catch the first eight watchdog interrupts, but let the ninth through untouched + if ( watchdogInterrupt < 8 ) + { + wdt.restart(); // "Pet" the dog + } + else + { + digitalWrite(LED_BUILTIN, HIGH); // Visual indication of system reset trigger + } + + watchdogFlag = true; // Set watchdog flag + watchdogInterrupt++; // Increment watchdog interrupt counter +} diff --git a/libraries/WDT/examples/Example3_WDT_LowPower/Example3_WDT_LowPower.ino b/libraries/WDT/examples/Example3_WDT_LowPower/Example3_WDT_LowPower.ino new file mode 100644 index 0000000..cec1cba --- /dev/null +++ b/libraries/WDT/examples/Example3_WDT_LowPower/Example3_WDT_LowPower.ino @@ -0,0 +1,171 @@ +/* + Author: Adam Garbo + Created: March 26, 2021 + License: MIT. See SparkFun Arduino Apollo3 Project for more information + + This example demonstrates the combined use of the Artemis Watchdog Timer (WDT) + and real-time clock (RTC). + + Both RTC and WDT interrupts will wake the system, print the date and time, + and then re-enter deep sleep. + + The WDT is configured to trigger every 10 seconds. If the WDT is not "pet" + after 100 seconds, a system reset will be triggered. + + The RTC alarm is configured to trigger every minute and enter deep sleep + between interrupts. Alarm interuptswill also restart the WDT and reset + the watchdog interrput counter. +*/ + +#include "RTC.h" +#include "WDT.h" + +volatile bool alarmFlag = false; // RTC ISR flag +volatile bool watchdogFlag = false; // Watchdog Timer ISR flag +volatile int watchdogInterrupt = 0; // Watchdog interrupt counter + +void setup() +{ + Serial.begin(115200); + + Serial.println("Artemis Watchdog Low Power Example"); + + // Set the RTC time using UNIX Epoch time + rtc.setEpoch(1596240000); // Saturday, August 1, 2020 00:00:00 + + // Set the RTC's alarm + rtc.setAlarm(0, 0, 0, 0, 0, 0); // Set alarm (hund, ss, mm, hh, dd, mm) + rtc.setAlarmMode(6); // Set the RTC alarm to trigger every minute + rtc.attachInterrupt(); // Attach RTC alarm interrupt + + // Configure the watchdog timer + // See Example2_WDT_Config for more information on how to configure the watchdog + wdt.configure(WDT_16HZ, 160, 240); // 16 Hz clock, 10-second interrupt period, 15-second reset period + + // Start the watchdog + wdt.start(); +} + +void loop() +{ + // Check for alarm interrupt + if (alarmFlag) + { + Serial.print("Alarm interrupt: "); + printDateTime(); // Print RTC's date and time + alarmFlag = false; + + wdt.restart(); // "Pet" the dog + watchdogInterrupt = 0; // Reset watchdog interrupt counter + } + + // Check for watchdog interrupt + if (watchdogFlag) + { + Serial.print("Watchdog interrupt: "); + printDateTime(); // Print RTC's date and time + watchdogFlag = false; // Clear watchdog flag + } + + goToSleep(); // Enter deep sleep +} + +// Print the RTC's current date and time +void printDateTime() +{ + rtc.getTime(); + Serial.printf("20%02d-%02d-%02d %02d:%02d:%02d.%02d\n", + rtc.year, rtc.month, rtc.dayOfMonth, + rtc.hour, rtc.minute, rtc.seconds, rtc.hundredths); + Serial.println(); +} + +// Power down gracefully +void goToSleep() +{ + // Disable UART + Serial.end(); + + // Disable ADC + powerControlADC(false); + + // Force the peripherals off + am_hal_pwrctrl_periph_disable(AM_HAL_PWRCTRL_PERIPH_IOM0); + am_hal_pwrctrl_periph_disable(AM_HAL_PWRCTRL_PERIPH_IOM1); + am_hal_pwrctrl_periph_disable(AM_HAL_PWRCTRL_PERIPH_IOM2); + am_hal_pwrctrl_periph_disable(AM_HAL_PWRCTRL_PERIPH_IOM3); + am_hal_pwrctrl_periph_disable(AM_HAL_PWRCTRL_PERIPH_IOM4); + am_hal_pwrctrl_periph_disable(AM_HAL_PWRCTRL_PERIPH_IOM5); + am_hal_pwrctrl_periph_disable(AM_HAL_PWRCTRL_PERIPH_ADC); + am_hal_pwrctrl_periph_disable(AM_HAL_PWRCTRL_PERIPH_UART0); + am_hal_pwrctrl_periph_disable(AM_HAL_PWRCTRL_PERIPH_UART1); + + // Disable all pads (except UART TX/RX) + for (int x = 0 ; x < 50 ; x++) + am_hal_gpio_pinconfig(x, g_AM_HAL_GPIO_DISABLE); + + //Power down CACHE, flashand SRAM + am_hal_pwrctrl_memory_deepsleep_powerdown(AM_HAL_PWRCTRL_MEM_ALL); // Turn off CACHE and flash + am_hal_pwrctrl_memory_deepsleep_retain(AM_HAL_PWRCTRL_MEM_SRAM_384K); // Retain all SRAM (0.6 uA) + + // Keep the 32kHz clock running for RTC + am_hal_stimer_config(AM_HAL_STIMER_CFG_CLEAR | AM_HAL_STIMER_CFG_FREEZE); + am_hal_stimer_config(AM_HAL_STIMER_XTAL_32KHZ); + + am_hal_sysctrl_sleep(AM_HAL_SYSCTRL_SLEEP_DEEP); // Sleep forever + + // And we're back! + wakeUp(); +} + +// Power up gracefully +void wakeUp() +{ + // Go back to using the main clock + am_hal_stimer_config(AM_HAL_STIMER_CFG_CLEAR | AM_HAL_STIMER_CFG_FREEZE); + am_hal_stimer_config(AM_HAL_STIMER_HFRC_3MHZ); + + // Renable UART0 pins + am_hal_gpio_pinconfig(48, g_AM_BSP_GPIO_COM_UART_TX); + am_hal_gpio_pinconfig(49, g_AM_BSP_GPIO_COM_UART_RX); + + // Renable power to UART0 + am_hal_pwrctrl_periph_enable(AM_HAL_PWRCTRL_PERIPH_UART0); + + // Enable ADC + initializeADC(); + + // Enable ADC + initializeADC(); + + // Enable Serial + Serial.begin(115200); +} + +// Interrupt handler for the RTC +extern "C" void am_rtc_isr(void) +{ + // Clear the RTC alarm interrupt + rtc.clearInterrupt(); + + alarmFlag = true; // Set alarm flag +} + +// Interrupt handler for the watchdog. +extern "C" void am_watchdog_isr(void) +{ + // Clear the watchdog interrupt + wdt.clear(); + + // Perform system reset after 10 watchdog interrupts (should not occur) + if ( watchdogInterrupt < 10 ) + { + wdt.restart(); // "Pet" the dog + } + else { + while (1); // Wait for reset to occur + } + + watchdogFlag = true; // Set the watchdog flag + watchdogInterrupt++; // Increment watchdog interrupt counter +} diff --git a/libraries/WDT/keywords.txt b/libraries/WDT/keywords.txt new file mode 100644 index 0000000..12d296c --- /dev/null +++ b/libraries/WDT/keywords.txt @@ -0,0 +1,29 @@ +# Syntax Coloring Map For 'libraries/WDT' + +# Datatypes (KEYWORD1) +Apollo3WDT KEYWORD1 + +# Functions (KEYWORD2) +configure KEYWORD2 +start KEYWORD2 +stop KEYWORD2 +restart KEYWORD2 +clear KEYWORD2 +getCounter KEYWORD2 +configure KEYWORD2 +setClock KEYWORD2 +setInterrupt KEYWORD2 +setReset KEYWORD2 + +# Structures (KEYWORD3) + +# Constants (LITERAL1) +_APOLLO3_LIBRARIES_WDT_H_ LITERAL1 + +# Properties (LITERAL2) +WDT_OFF KEYWORD2 +WDT_128HZ KEYWORD2 +WDT_16 KEYWORD2 +WDT_1HZ KEYWORD2 +WDT1_16HZ KEYWORD2 +wdt LITERAL2 diff --git a/libraries/WDT/library.properties b/libraries/WDT/library.properties new file mode 100644 index 0000000..dff958c --- /dev/null +++ b/libraries/WDT/library.properties @@ -0,0 +1,9 @@ +name=WDT +version=2.0.0 +author=SparkFun Electronics +maintainer=SparkFun Electronics +sentence=Watchdog Timer (WDT) library for the SparkFun Artemis +paragraph=Enables the setting and reading of the internal Watchdog Timer built into Apollo based modules like the Artemis. +category= +url= +architectures=apollo3 diff --git a/libraries/WDT/src/WDT.cpp b/libraries/WDT/src/WDT.cpp new file mode 100644 index 0000000..e2c673f --- /dev/null +++ b/libraries/WDT/src/WDT.cpp @@ -0,0 +1,100 @@ +/* +// This file is subject to the terms and conditions defined in +// file 'LICENSE.md', which is part of this source code package. +*/ + +#include "WDT.h" + +Apollo3WDT wdt; + +// Constructor +Apollo3WDT::Apollo3WDT() +{ + // The watchdog only runs off of the LFRC + am_hal_clkgen_control(AM_HAL_CLKGEN_CONTROL_LFRC_START, 0); + am_hal_wdt_init(&watchdogConfig); +} + +// Configure the watchdog timer +// clock: set the LFRC clock frequency of the watchdog timer (see setClock below) +// interrupt: number of watchdog timer ticks allowed before a watchdog interrupt event is generated +// reset: number of watchdog timer ticks allowed before the watchdog will issue a system reset +void Apollo3WDT::configure(uint8_t clock, uint8_t interrupt, uint8_t reset) +{ + if(clock <= 4) + { + WDT->CFG_b.CLKSEL = clock; + } + else + { + WDT->CFG_b.CLKSEL = WDT_CFG_CLKSEL_16HZ; // Default to 16Hz LFRC clock divider + } + WDT->CFG_b.INTVAL = interrupt; + WDT->CFG_b.RESVAL = reset; +} + +// Set the LFRC clock frequency of the watchdog timer +// WDT_OFF WDT_CFG_CLKSEL_OFF // = 0 Low Power Mode. This setting disables the watch dog timer +// WDT_128HZ WDT_CFG_CLKSEL_128HZ // = 1, 128 Hz LFRC clock +// WDT_16HZ WDT_CFG_CLKSEL_16HZ // = 2 16 Hz LFRC clock +// WDT_1HZ WDT_CFG_CLKSEL_1HZ // = 3, 1 Hz LFRC clock +// WDT_1_16HZ WDT_CFG_CLKSEL_1_16HZ // = 4, 1/16th Hz LFRC clock +void Apollo3WDT::setClock(uint8_t clock) +{ + if(clock <= 4) + { + WDT->CFG_b.CLKSEL = clock; + } + else + { + WDT->CFG_b.CLKSEL = WDT_CFG_CLKSEL_16HZ; // Default to 16Hz LFRC clock divider + } +} + +// Set number of watchdog timer ticks allowed before a watchdog interrupt event is generated +void Apollo3WDT::setInterrupt(uint8_t interrupt) +{ + WDT->CFG_b.INTVAL = interrupt; +} + +// Set number of watchdog timer ticks allowed before the watchdog will issue a system reset +void Apollo3WDT::setReset(uint8_t reset) +{ + WDT->CFG_b.RESVAL = reset; +} + +// Enable the watchdog +void Apollo3WDT::start() +{ + am_hal_interrupt_master_enable(); // Enable interrupts to the core + NVIC_EnableIRQ(WDT_IRQn); // Enable the interrupt for the watchdog in the NVIC + am_hal_wdt_start(); +} + +// Disable the watchdog +void Apollo3WDT::stop() +{ + // Disable the interrupt for the watchdog in the NVIC + NVIC_DisableIRQ(WDT_IRQn); + // Disable the watchdog timer tick by clearing the 'enable' bit in the + // watchdog configuration register + am_hal_wdt_halt(); +} + +// Restart the watchdog +void Apollo3WDT::restart() +{ + am_hal_wdt_restart(); +} + +// Clear the watchdog interrupt +void Apollo3WDT::clear() +{ + am_hal_wdt_int_clear(); +} + +// Read the current value of watch dog timer counter register +uint32_t Apollo3WDT::getCounter() +{ + return am_hal_wdt_counter_get(); +} \ No newline at end of file diff --git a/libraries/WDT/src/WDT.h b/libraries/WDT/src/WDT.h new file mode 100644 index 0000000..1ecf8e7 --- /dev/null +++ b/libraries/WDT/src/WDT.h @@ -0,0 +1,56 @@ +/* +// This file is subject to the terms and conditions defined in +// file 'LICENSE.md', which is part of this source code package. +*/ + +#ifndef _APOLLO3_LIBRARIES_WDT_H_ +#define _APOLLO3_LIBRARIES_WDT_H_ + +#include + +#ifdef wdt +#undef wdt +#endif + +// Simplified WDT Clock Divider Selections +#define WDT_OFF WDT_CFG_CLKSEL_OFF // = 0 Low Power Mode. This setting disables the watch dog timer +#define WDT_128HZ WDT_CFG_CLKSEL_128HZ // = 1, 128 Hz LFRC clock +#define WDT_16HZ WDT_CFG_CLKSEL_16HZ // = 2 16 Hz LFRC clock +#define WDT_1HZ WDT_CFG_CLKSEL_1HZ // = 3, 1 Hz LFRC clock +#define WDT_1_16HZ WDT_CFG_CLKSEL_1_16HZ // = 4, 1/16th Hz LFRC clock + +class Apollo3WDT { +private: + +protected: + +public: + Apollo3WDT(); + + // Default watchdog timer configuration structure + am_hal_wdt_config_t watchdogConfig = { + + // Configuration values for generated watchdog timer event. + .ui32Config = AM_HAL_WDT_LFRC_CLK_16HZ | AM_HAL_WDT_ENABLE_RESET | AM_HAL_WDT_ENABLE_INTERRUPT, + + // Number of watchdog timer ticks allowed before a watchdog interrupt event is generated + .ui16InterruptCount = 16 * 4, // Set WDT interrupt timeout for 4 seconds (16 * 4) / 16 = 4 + + // Number of watchdog timer ticks allowed before the watchdog will issue a system reset + .ui16ResetCount = 16 * 8 // Set WDT reset timeout for 8 seconds (16 * 8 ) / 16 = 8 + }; + + void start(); // Starts the watchdog timer + void stop(); // Disables the watchdog timer + void restart(); // Restarts the watchdog timer ("Pets" the dog) + void clear(); // Clears the watchdog interrupt + uint32_t getCounter(); // Reads the current value of watch dog timer counter register + void configure(uint8_t clock, uint8_t interrupt, uint8_t reset); + void setClock(uint8_t clock); // Set the clock frequency of the watchdog timer + void setInterrupt(uint8_t interrupt); // Set number of ticks before a watchdog interrupt event is generated + void setReset(uint8_t reset); // Set number of ticks before the watchdog will issue a system reset +}; + +extern Apollo3WDT wdt; + +#endif // _APOLLO3_LIBRARIES_RTC_H_ \ No newline at end of file diff --git a/libraries/Wire/src/Wire.cpp b/libraries/Wire/src/Wire.cpp index cda0fcb..3168014 100644 --- a/libraries/Wire/src/Wire.cpp +++ b/libraries/Wire/src/Wire.cpp @@ -5,7 +5,11 @@ #include "Wire.h" -arduino::MbedI2C::MbedI2C(int sda, int scl) : _sda(sda), _scl(scl), usedTxBuffer(0) {} +arduino::MbedI2C::MbedI2C(int sda, int scl) : _sda(sda), _scl(scl), usedTxBuffer(0), master(NULL) { + #ifdef DEVICE_I2CSLAVE + slave = NULL; + #endif +} void arduino::MbedI2C::begin() { if(!master){ diff --git a/libraries/Wire/src/Wire.h b/libraries/Wire/src/Wire.h index c8fc21b..881571c 100644 --- a/libraries/Wire/src/Wire.h +++ b/libraries/Wire/src/Wire.h @@ -11,6 +11,9 @@ #include "drivers/I2CSlave.h" #include "rtos.h" +#define AP3_WIRE_RX_BUFFER_LEN 256 +#define AP3_WIRE_TX_BUFFER_LEN 256 + typedef void (*voidFuncPtrParamInt)(int); namespace arduino { @@ -52,8 +55,8 @@ class MbedI2C : public HardwareI2C int _sda; int _scl; int _address; - RingBufferN<256> rxBuffer; - uint8_t txBuffer[256]; + RingBufferN rxBuffer; + uint8_t txBuffer[AP3_WIRE_TX_BUFFER_LEN]; uint32_t usedTxBuffer; voidFuncPtrParamInt onReceiveCb = NULL; voidFuncPtr onRequestCb = NULL; diff --git a/platform.txt b/platform.txt index 89ff087..551251d 100644 --- a/platform.txt +++ b/platform.txt @@ -14,7 +14,7 @@ defines.mbed=-DMBED_NO_GLOBAL_USING_DIRECTIVE defines.variant={build.defines} defines.extra= defines.all={defines.variant} {defines.arduino} {defines.mbed} {defines.extra} -DCORDIO_ZERO_COPY_HCI -defines.preproc={defines.all} +defines.preproc={defines.all} "@{build.variant.path}/mbed/.cxx-symbols" defines.asm={defines.all} "@{build.variant.path}/mbed/.asm-symbols" defines.c={defines.all} "@{build.variant.path}/mbed/.c-symbols" defines.cxx={defines.all} "@{build.variant.path}/mbed/.cxx-symbols" @@ -31,7 +31,7 @@ includes.all={includes.core} {includes.mbed} {includes.variant} {includes.extra} libs.core=-Wl,--whole-archive "{archive_file_path}" -Wl,--no-whole-archive libs.mbed=-Wl,--whole-archive "{build.variant.path}/mbed/libmbed-os.a" -Wl,--no-whole-archive libs.variant={build.libs} -libs.extra= +libs.extra=-Wl,--whole-archive "{cores.path}/mbed-os/targets/TARGET_Ambiq_Micro/TARGET_Apollo3/sdk/CMSIS/ARM/Lib/ARM/libarm_cortexM4lf_math.a" -Wl,--no-whole-archive libs.all={libs.core} {libs.mbed} {libs.variant} {libs.extra} # warnings diff --git a/variants/LoRa_THING_PLUS_expLoRaBLE/mbed/.c-flags b/variants/LoRa_THING_PLUS_expLoRaBLE/mbed/.c-flags index c37d635..33d97d2 100644 --- a/variants/LoRa_THING_PLUS_expLoRaBLE/mbed/.c-flags +++ b/variants/LoRa_THING_PLUS_expLoRaBLE/mbed/.c-flags @@ -1 +1 @@ --c -std=gnu11 -DMBED_MINIMAL_PRINTF -DMBED_TRAP_ERRORS_ENABLED=1 -Os -fdata-sections -ffunction-sections -fmessage-length=0 -fno-exceptions -fomit-frame-pointer -funsigned-char -g -mcpu=cortex-m4 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -mthumb \ No newline at end of file +-c -std=gnu11 -DMBED_MINIMAL_PRINTF -DMBED_TRAP_ERRORS_ENABLED=1 -Os -fdata-sections -ffunction-sections -fmessage-length=0 -fno-exceptions -fomit-frame-pointer -funsigned-char -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb \ No newline at end of file diff --git a/variants/LoRa_THING_PLUS_expLoRaBLE/mbed/.cxx-flags b/variants/LoRa_THING_PLUS_expLoRaBLE/mbed/.cxx-flags index 646bf27..9de4dbd 100644 --- a/variants/LoRa_THING_PLUS_expLoRaBLE/mbed/.cxx-flags +++ b/variants/LoRa_THING_PLUS_expLoRaBLE/mbed/.cxx-flags @@ -1 +1 @@ --c -fno-rtti -std=gnu++14 -DMBED_MINIMAL_PRINTF -DMBED_TRAP_ERRORS_ENABLED=1 -Os -fdata-sections -ffunction-sections -fmessage-length=0 -fno-exceptions -fomit-frame-pointer -funsigned-char -g -mcpu=cortex-m4 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -mthumb \ No newline at end of file +-c -fno-rtti -std=gnu++14 -DMBED_MINIMAL_PRINTF -DMBED_TRAP_ERRORS_ENABLED=1 -Os -fdata-sections -ffunction-sections -fmessage-length=0 -fno-exceptions -fomit-frame-pointer -funsigned-char -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb \ No newline at end of file diff --git a/variants/LoRa_THING_PLUS_expLoRaBLE/mbed/.ld-flags b/variants/LoRa_THING_PLUS_expLoRaBLE/mbed/.ld-flags index 65528a5..6341b37 100644 --- a/variants/LoRa_THING_PLUS_expLoRaBLE/mbed/.ld-flags +++ b/variants/LoRa_THING_PLUS_expLoRaBLE/mbed/.ld-flags @@ -1 +1 @@ --DMBED_BOOT_STACK_SIZE=1024 -DXIP_ENABLE=0 -Wl,--gc-sections -Wl,--wrap,_calloc_r -Wl,--wrap,_memalign_r -Wl,--wrap,atexit -Wl,--wrap,exit -Wl,--wrap,fprintf -Wl,--wrap,main -Wl,--wrap,printf -Wl,--wrap,snprintf -Wl,--wrap,sprintf -Wl,--wrap,vfprintf -Wl,--wrap,vprintf -Wl,--wrap,vsnprintf -Wl,--wrap,vsprintf -Wl,-n -mcpu=cortex-m4 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -mthumb \ No newline at end of file +-DMBED_BOOT_STACK_SIZE=1024 -DXIP_ENABLE=0 -Wl,--gc-sections -Wl,--wrap,_calloc_r -Wl,--wrap,_memalign_r -Wl,--wrap,atexit -Wl,--wrap,exit -Wl,--wrap,fprintf -Wl,--wrap,main -Wl,--wrap,printf -Wl,--wrap,snprintf -Wl,--wrap,sprintf -Wl,--wrap,vfprintf -Wl,--wrap,vprintf -Wl,--wrap,vsnprintf -Wl,--wrap,vsprintf -Wl,-n -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb \ No newline at end of file diff --git a/variants/LoRa_THING_PLUS_expLoRaBLE/mbed/.ld-symbols b/variants/LoRa_THING_PLUS_expLoRaBLE/mbed/.ld-symbols index 2d76af3..7a6cefd 100644 --- a/variants/LoRa_THING_PLUS_expLoRaBLE/mbed/.ld-symbols +++ b/variants/LoRa_THING_PLUS_expLoRaBLE/mbed/.ld-symbols @@ -1 +1 @@ --DAM_CUSTOM_BDADDR -DAM_PACKAGE_BGA -DARDUINO_BLE_FIX -DARM_MATH_CM4 -DCOMPONENT_FLASHIAP=1 -DCORDIO_ZERO_COPY_HCI -DDEVICE_FLASH=1 -DDEVICE_I2C=1 -DDEVICE_INTERRUPTIN=1 -DDEVICE_LPTICKER=1 -DDEVICE_MPU=1 -DDEVICE_SERIAL=1 -DDEVICE_SPI=1 -DDEVICE_STDIO_MESSAGES=1 -DDEVICE_USTICKER=1 -DFEATURE_BLE=1 -DMBED_BUILD_TIMESTAMP=1615920644.414514 -DTARGET_AMA3B1KK -DTARGET_Ambiq_Micro -DTARGET_Apollo3 -DTARGET_CORDIO -DTARGET_CORTEX -DTARGET_CORTEX_M -DTARGET_FAMILY_Apollo3 -DTARGET_LIKE_CORTEX_M4 -DTARGET_LIKE_MBED -DTARGET_LoRa_THING_PLUS_expLoRaBLE -DTARGET_M4 -DTARGET_NAME=LoRa_THING_PLUS_expLoRaBLE -DTARGET_RELEASE -DTARGET_RTOS_M4_M7 -DTOOLCHAIN_GCC -DTOOLCHAIN_GCC_ARM -D__CMSIS_RTOS -D__CORTEX_M4 -D__FPU_PRESENT=1 -D__MBED_CMSIS_RTOS_CM -D__MBED__=1 \ No newline at end of file +-DAM_CUSTOM_BDADDR -DAM_PACKAGE_BGA -DARDUINO_BLE_FIX -DARM_MATH_CM4 -DCOMPONENT_FLASHIAP=1 -DCORDIO_ZERO_COPY_HCI -DDEVICE_FLASH=1 -DDEVICE_I2C=1 -DDEVICE_INTERRUPTIN=1 -DDEVICE_LPTICKER=1 -DDEVICE_MPU=1 -DDEVICE_SERIAL=1 -DDEVICE_SPI=1 -DDEVICE_STDIO_MESSAGES=1 -DDEVICE_USTICKER=1 -DFEATURE_BLE=1 -DMBED_BUILD_TIMESTAMP=1620707381.3064024 -DTARGET_AMA3B1KK -DTARGET_Ambiq_Micro -DTARGET_Apollo3 -DTARGET_CORDIO -DTARGET_CORTEX -DTARGET_CORTEX_M -DTARGET_FAMILY_Apollo3 -DTARGET_LIKE_CORTEX_M4 -DTARGET_LIKE_MBED -DTARGET_LoRa_THING_PLUS_expLoRaBLE -DTARGET_M4 -DTARGET_NAME=LoRa_THING_PLUS_expLoRaBLE -DTARGET_RELEASE -DTARGET_RTOS_M4_M7 -DTOOLCHAIN_GCC -DTOOLCHAIN_GCC_ARM -D__CMSIS_RTOS -D__CORTEX_M4 -D__FPU_PRESENT=1 -D__MBED_CMSIS_RTOS_CM -D__MBED__=1 \ No newline at end of file diff --git a/variants/LoRa_THING_PLUS_expLoRaBLE/mbed/libmbed-os.a b/variants/LoRa_THING_PLUS_expLoRaBLE/mbed/libmbed-os.a index b75210e..f5a6dfb 100644 Binary files a/variants/LoRa_THING_PLUS_expLoRaBLE/mbed/libmbed-os.a and b/variants/LoRa_THING_PLUS_expLoRaBLE/mbed/libmbed-os.a differ diff --git a/variants/SFE_ARTEMIS/mbed/.c-flags b/variants/SFE_ARTEMIS/mbed/.c-flags index c37d635..33d97d2 100644 --- a/variants/SFE_ARTEMIS/mbed/.c-flags +++ b/variants/SFE_ARTEMIS/mbed/.c-flags @@ -1 +1 @@ --c -std=gnu11 -DMBED_MINIMAL_PRINTF -DMBED_TRAP_ERRORS_ENABLED=1 -Os -fdata-sections -ffunction-sections -fmessage-length=0 -fno-exceptions -fomit-frame-pointer -funsigned-char -g -mcpu=cortex-m4 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -mthumb \ No newline at end of file +-c -std=gnu11 -DMBED_MINIMAL_PRINTF -DMBED_TRAP_ERRORS_ENABLED=1 -Os -fdata-sections -ffunction-sections -fmessage-length=0 -fno-exceptions -fomit-frame-pointer -funsigned-char -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb \ No newline at end of file diff --git a/variants/SFE_ARTEMIS/mbed/.cxx-flags b/variants/SFE_ARTEMIS/mbed/.cxx-flags index 646bf27..9de4dbd 100644 --- a/variants/SFE_ARTEMIS/mbed/.cxx-flags +++ b/variants/SFE_ARTEMIS/mbed/.cxx-flags @@ -1 +1 @@ --c -fno-rtti -std=gnu++14 -DMBED_MINIMAL_PRINTF -DMBED_TRAP_ERRORS_ENABLED=1 -Os -fdata-sections -ffunction-sections -fmessage-length=0 -fno-exceptions -fomit-frame-pointer -funsigned-char -g -mcpu=cortex-m4 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -mthumb \ No newline at end of file +-c -fno-rtti -std=gnu++14 -DMBED_MINIMAL_PRINTF -DMBED_TRAP_ERRORS_ENABLED=1 -Os -fdata-sections -ffunction-sections -fmessage-length=0 -fno-exceptions -fomit-frame-pointer -funsigned-char -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb \ No newline at end of file diff --git a/variants/SFE_ARTEMIS/mbed/.ld-flags b/variants/SFE_ARTEMIS/mbed/.ld-flags index 65528a5..6341b37 100644 --- a/variants/SFE_ARTEMIS/mbed/.ld-flags +++ b/variants/SFE_ARTEMIS/mbed/.ld-flags @@ -1 +1 @@ --DMBED_BOOT_STACK_SIZE=1024 -DXIP_ENABLE=0 -Wl,--gc-sections -Wl,--wrap,_calloc_r -Wl,--wrap,_memalign_r -Wl,--wrap,atexit -Wl,--wrap,exit -Wl,--wrap,fprintf -Wl,--wrap,main -Wl,--wrap,printf -Wl,--wrap,snprintf -Wl,--wrap,sprintf -Wl,--wrap,vfprintf -Wl,--wrap,vprintf -Wl,--wrap,vsnprintf -Wl,--wrap,vsprintf -Wl,-n -mcpu=cortex-m4 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -mthumb \ No newline at end of file +-DMBED_BOOT_STACK_SIZE=1024 -DXIP_ENABLE=0 -Wl,--gc-sections -Wl,--wrap,_calloc_r -Wl,--wrap,_memalign_r -Wl,--wrap,atexit -Wl,--wrap,exit -Wl,--wrap,fprintf -Wl,--wrap,main -Wl,--wrap,printf -Wl,--wrap,snprintf -Wl,--wrap,sprintf -Wl,--wrap,vfprintf -Wl,--wrap,vprintf -Wl,--wrap,vsnprintf -Wl,--wrap,vsprintf -Wl,-n -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb \ No newline at end of file diff --git a/variants/SFE_ARTEMIS/mbed/.ld-symbols b/variants/SFE_ARTEMIS/mbed/.ld-symbols index 444ef32..72cf8ce 100644 --- a/variants/SFE_ARTEMIS/mbed/.ld-symbols +++ b/variants/SFE_ARTEMIS/mbed/.ld-symbols @@ -1 +1 @@ --DAM_CUSTOM_BDADDR -DAM_PACKAGE_BGA -DARDUINO_BLE_FIX -DARM_MATH_CM4 -DCOMPONENT_FLASHIAP=1 -DCORDIO_ZERO_COPY_HCI -DDEVICE_FLASH=1 -DDEVICE_I2C=1 -DDEVICE_INTERRUPTIN=1 -DDEVICE_LPTICKER=1 -DDEVICE_MPU=1 -DDEVICE_SERIAL=1 -DDEVICE_SPI=1 -DDEVICE_STDIO_MESSAGES=1 -DDEVICE_USTICKER=1 -DFEATURE_BLE=1 -DMBED_BUILD_TIMESTAMP=1615920823.0840802 -DTARGET_AMA3B1KK -DTARGET_Ambiq_Micro -DTARGET_Apollo3 -DTARGET_CORDIO -DTARGET_CORTEX -DTARGET_CORTEX_M -DTARGET_FAMILY_Apollo3 -DTARGET_LIKE_CORTEX_M4 -DTARGET_LIKE_MBED -DTARGET_M4 -DTARGET_NAME=SFE_ARTEMIS -DTARGET_RELEASE -DTARGET_RTOS_M4_M7 -DTARGET_SFE_ARTEMIS -DTOOLCHAIN_GCC -DTOOLCHAIN_GCC_ARM -D__CMSIS_RTOS -D__CORTEX_M4 -D__FPU_PRESENT=1 -D__MBED_CMSIS_RTOS_CM -D__MBED__=1 \ No newline at end of file +-DAM_CUSTOM_BDADDR -DAM_PACKAGE_BGA -DARDUINO_BLE_FIX -DARM_MATH_CM4 -DCOMPONENT_FLASHIAP=1 -DCORDIO_ZERO_COPY_HCI -DDEVICE_FLASH=1 -DDEVICE_I2C=1 -DDEVICE_INTERRUPTIN=1 -DDEVICE_LPTICKER=1 -DDEVICE_MPU=1 -DDEVICE_SERIAL=1 -DDEVICE_SPI=1 -DDEVICE_STDIO_MESSAGES=1 -DDEVICE_USTICKER=1 -DFEATURE_BLE=1 -DMBED_BUILD_TIMESTAMP=1620707537.7050505 -DTARGET_AMA3B1KK -DTARGET_Ambiq_Micro -DTARGET_Apollo3 -DTARGET_CORDIO -DTARGET_CORTEX -DTARGET_CORTEX_M -DTARGET_FAMILY_Apollo3 -DTARGET_LIKE_CORTEX_M4 -DTARGET_LIKE_MBED -DTARGET_M4 -DTARGET_NAME=SFE_ARTEMIS -DTARGET_RELEASE -DTARGET_RTOS_M4_M7 -DTARGET_SFE_ARTEMIS -DTOOLCHAIN_GCC -DTOOLCHAIN_GCC_ARM -D__CMSIS_RTOS -D__CORTEX_M4 -D__FPU_PRESENT=1 -D__MBED_CMSIS_RTOS_CM -D__MBED__=1 \ No newline at end of file diff --git a/variants/SFE_ARTEMIS/mbed/libmbed-os.a b/variants/SFE_ARTEMIS/mbed/libmbed-os.a index 23b7a67..117c38a 100644 Binary files a/variants/SFE_ARTEMIS/mbed/libmbed-os.a and b/variants/SFE_ARTEMIS/mbed/libmbed-os.a differ diff --git a/variants/SFE_ARTEMIS_ATP/mbed/.c-flags b/variants/SFE_ARTEMIS_ATP/mbed/.c-flags index c37d635..33d97d2 100644 --- a/variants/SFE_ARTEMIS_ATP/mbed/.c-flags +++ b/variants/SFE_ARTEMIS_ATP/mbed/.c-flags @@ -1 +1 @@ --c -std=gnu11 -DMBED_MINIMAL_PRINTF -DMBED_TRAP_ERRORS_ENABLED=1 -Os -fdata-sections -ffunction-sections -fmessage-length=0 -fno-exceptions -fomit-frame-pointer -funsigned-char -g -mcpu=cortex-m4 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -mthumb \ No newline at end of file +-c -std=gnu11 -DMBED_MINIMAL_PRINTF -DMBED_TRAP_ERRORS_ENABLED=1 -Os -fdata-sections -ffunction-sections -fmessage-length=0 -fno-exceptions -fomit-frame-pointer -funsigned-char -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb \ No newline at end of file diff --git a/variants/SFE_ARTEMIS_ATP/mbed/.cxx-flags b/variants/SFE_ARTEMIS_ATP/mbed/.cxx-flags index 646bf27..9de4dbd 100644 --- a/variants/SFE_ARTEMIS_ATP/mbed/.cxx-flags +++ b/variants/SFE_ARTEMIS_ATP/mbed/.cxx-flags @@ -1 +1 @@ --c -fno-rtti -std=gnu++14 -DMBED_MINIMAL_PRINTF -DMBED_TRAP_ERRORS_ENABLED=1 -Os -fdata-sections -ffunction-sections -fmessage-length=0 -fno-exceptions -fomit-frame-pointer -funsigned-char -g -mcpu=cortex-m4 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -mthumb \ No newline at end of file +-c -fno-rtti -std=gnu++14 -DMBED_MINIMAL_PRINTF -DMBED_TRAP_ERRORS_ENABLED=1 -Os -fdata-sections -ffunction-sections -fmessage-length=0 -fno-exceptions -fomit-frame-pointer -funsigned-char -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb \ No newline at end of file diff --git a/variants/SFE_ARTEMIS_ATP/mbed/.ld-flags b/variants/SFE_ARTEMIS_ATP/mbed/.ld-flags index 65528a5..6341b37 100644 --- a/variants/SFE_ARTEMIS_ATP/mbed/.ld-flags +++ b/variants/SFE_ARTEMIS_ATP/mbed/.ld-flags @@ -1 +1 @@ --DMBED_BOOT_STACK_SIZE=1024 -DXIP_ENABLE=0 -Wl,--gc-sections -Wl,--wrap,_calloc_r -Wl,--wrap,_memalign_r -Wl,--wrap,atexit -Wl,--wrap,exit -Wl,--wrap,fprintf -Wl,--wrap,main -Wl,--wrap,printf -Wl,--wrap,snprintf -Wl,--wrap,sprintf -Wl,--wrap,vfprintf -Wl,--wrap,vprintf -Wl,--wrap,vsnprintf -Wl,--wrap,vsprintf -Wl,-n -mcpu=cortex-m4 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -mthumb \ No newline at end of file +-DMBED_BOOT_STACK_SIZE=1024 -DXIP_ENABLE=0 -Wl,--gc-sections -Wl,--wrap,_calloc_r -Wl,--wrap,_memalign_r -Wl,--wrap,atexit -Wl,--wrap,exit -Wl,--wrap,fprintf -Wl,--wrap,main -Wl,--wrap,printf -Wl,--wrap,snprintf -Wl,--wrap,sprintf -Wl,--wrap,vfprintf -Wl,--wrap,vprintf -Wl,--wrap,vsnprintf -Wl,--wrap,vsprintf -Wl,-n -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb \ No newline at end of file diff --git a/variants/SFE_ARTEMIS_ATP/mbed/.ld-symbols b/variants/SFE_ARTEMIS_ATP/mbed/.ld-symbols index cd7f819..9895c2d 100644 --- a/variants/SFE_ARTEMIS_ATP/mbed/.ld-symbols +++ b/variants/SFE_ARTEMIS_ATP/mbed/.ld-symbols @@ -1 +1 @@ --DAM_CUSTOM_BDADDR -DAM_PACKAGE_BGA -DARDUINO_BLE_FIX -DARM_MATH_CM4 -DCOMPONENT_FLASHIAP=1 -DCORDIO_ZERO_COPY_HCI -DDEVICE_FLASH=1 -DDEVICE_I2C=1 -DDEVICE_INTERRUPTIN=1 -DDEVICE_LPTICKER=1 -DDEVICE_MPU=1 -DDEVICE_SERIAL=1 -DDEVICE_SPI=1 -DDEVICE_STDIO_MESSAGES=1 -DDEVICE_USTICKER=1 -DFEATURE_BLE=1 -DMBED_BUILD_TIMESTAMP=1615921001.2275898 -DTARGET_AMA3B1KK -DTARGET_Ambiq_Micro -DTARGET_Apollo3 -DTARGET_CORDIO -DTARGET_CORTEX -DTARGET_CORTEX_M -DTARGET_FAMILY_Apollo3 -DTARGET_LIKE_CORTEX_M4 -DTARGET_LIKE_MBED -DTARGET_M4 -DTARGET_NAME=SFE_ARTEMIS_ATP -DTARGET_RELEASE -DTARGET_RTOS_M4_M7 -DTARGET_SFE_ARTEMIS_ATP -DTOOLCHAIN_GCC -DTOOLCHAIN_GCC_ARM -D__CMSIS_RTOS -D__CORTEX_M4 -D__FPU_PRESENT=1 -D__MBED_CMSIS_RTOS_CM -D__MBED__=1 \ No newline at end of file +-DAM_CUSTOM_BDADDR -DAM_PACKAGE_BGA -DARDUINO_BLE_FIX -DARM_MATH_CM4 -DCOMPONENT_FLASHIAP=1 -DCORDIO_ZERO_COPY_HCI -DDEVICE_FLASH=1 -DDEVICE_I2C=1 -DDEVICE_INTERRUPTIN=1 -DDEVICE_LPTICKER=1 -DDEVICE_MPU=1 -DDEVICE_SERIAL=1 -DDEVICE_SPI=1 -DDEVICE_STDIO_MESSAGES=1 -DDEVICE_USTICKER=1 -DFEATURE_BLE=1 -DMBED_BUILD_TIMESTAMP=1620707676.6016016 -DTARGET_AMA3B1KK -DTARGET_Ambiq_Micro -DTARGET_Apollo3 -DTARGET_CORDIO -DTARGET_CORTEX -DTARGET_CORTEX_M -DTARGET_FAMILY_Apollo3 -DTARGET_LIKE_CORTEX_M4 -DTARGET_LIKE_MBED -DTARGET_M4 -DTARGET_NAME=SFE_ARTEMIS_ATP -DTARGET_RELEASE -DTARGET_RTOS_M4_M7 -DTARGET_SFE_ARTEMIS_ATP -DTOOLCHAIN_GCC -DTOOLCHAIN_GCC_ARM -D__CMSIS_RTOS -D__CORTEX_M4 -D__FPU_PRESENT=1 -D__MBED_CMSIS_RTOS_CM -D__MBED__=1 \ No newline at end of file diff --git a/variants/SFE_ARTEMIS_ATP/mbed/libmbed-os.a b/variants/SFE_ARTEMIS_ATP/mbed/libmbed-os.a index 9a0717a..1cbbdd5 100644 Binary files a/variants/SFE_ARTEMIS_ATP/mbed/libmbed-os.a and b/variants/SFE_ARTEMIS_ATP/mbed/libmbed-os.a differ diff --git a/variants/SFE_ARTEMIS_DK/mbed/.c-flags b/variants/SFE_ARTEMIS_DK/mbed/.c-flags index c37d635..33d97d2 100644 --- a/variants/SFE_ARTEMIS_DK/mbed/.c-flags +++ b/variants/SFE_ARTEMIS_DK/mbed/.c-flags @@ -1 +1 @@ --c -std=gnu11 -DMBED_MINIMAL_PRINTF -DMBED_TRAP_ERRORS_ENABLED=1 -Os -fdata-sections -ffunction-sections -fmessage-length=0 -fno-exceptions -fomit-frame-pointer -funsigned-char -g -mcpu=cortex-m4 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -mthumb \ No newline at end of file +-c -std=gnu11 -DMBED_MINIMAL_PRINTF -DMBED_TRAP_ERRORS_ENABLED=1 -Os -fdata-sections -ffunction-sections -fmessage-length=0 -fno-exceptions -fomit-frame-pointer -funsigned-char -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb \ No newline at end of file diff --git a/variants/SFE_ARTEMIS_DK/mbed/.cxx-flags b/variants/SFE_ARTEMIS_DK/mbed/.cxx-flags index 646bf27..9de4dbd 100644 --- a/variants/SFE_ARTEMIS_DK/mbed/.cxx-flags +++ b/variants/SFE_ARTEMIS_DK/mbed/.cxx-flags @@ -1 +1 @@ --c -fno-rtti -std=gnu++14 -DMBED_MINIMAL_PRINTF -DMBED_TRAP_ERRORS_ENABLED=1 -Os -fdata-sections -ffunction-sections -fmessage-length=0 -fno-exceptions -fomit-frame-pointer -funsigned-char -g -mcpu=cortex-m4 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -mthumb \ No newline at end of file +-c -fno-rtti -std=gnu++14 -DMBED_MINIMAL_PRINTF -DMBED_TRAP_ERRORS_ENABLED=1 -Os -fdata-sections -ffunction-sections -fmessage-length=0 -fno-exceptions -fomit-frame-pointer -funsigned-char -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb \ No newline at end of file diff --git a/variants/SFE_ARTEMIS_DK/mbed/.ld-flags b/variants/SFE_ARTEMIS_DK/mbed/.ld-flags index 65528a5..6341b37 100644 --- a/variants/SFE_ARTEMIS_DK/mbed/.ld-flags +++ b/variants/SFE_ARTEMIS_DK/mbed/.ld-flags @@ -1 +1 @@ --DMBED_BOOT_STACK_SIZE=1024 -DXIP_ENABLE=0 -Wl,--gc-sections -Wl,--wrap,_calloc_r -Wl,--wrap,_memalign_r -Wl,--wrap,atexit -Wl,--wrap,exit -Wl,--wrap,fprintf -Wl,--wrap,main -Wl,--wrap,printf -Wl,--wrap,snprintf -Wl,--wrap,sprintf -Wl,--wrap,vfprintf -Wl,--wrap,vprintf -Wl,--wrap,vsnprintf -Wl,--wrap,vsprintf -Wl,-n -mcpu=cortex-m4 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -mthumb \ No newline at end of file +-DMBED_BOOT_STACK_SIZE=1024 -DXIP_ENABLE=0 -Wl,--gc-sections -Wl,--wrap,_calloc_r -Wl,--wrap,_memalign_r -Wl,--wrap,atexit -Wl,--wrap,exit -Wl,--wrap,fprintf -Wl,--wrap,main -Wl,--wrap,printf -Wl,--wrap,snprintf -Wl,--wrap,sprintf -Wl,--wrap,vfprintf -Wl,--wrap,vprintf -Wl,--wrap,vsnprintf -Wl,--wrap,vsprintf -Wl,-n -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb \ No newline at end of file diff --git a/variants/SFE_ARTEMIS_DK/mbed/.ld-symbols b/variants/SFE_ARTEMIS_DK/mbed/.ld-symbols index 052ab88..a23b46e 100644 --- a/variants/SFE_ARTEMIS_DK/mbed/.ld-symbols +++ b/variants/SFE_ARTEMIS_DK/mbed/.ld-symbols @@ -1 +1 @@ --DAM_CUSTOM_BDADDR -DAM_PACKAGE_BGA -DARDUINO_BLE_FIX -DARM_MATH_CM4 -DCOMPONENT_FLASHIAP=1 -DCOMPONENT_hm01b0=1 -DCOMPONENT_lis2dh12=1 -DCORDIO_ZERO_COPY_HCI -DDEVICE_FLASH=1 -DDEVICE_I2C=1 -DDEVICE_INTERRUPTIN=1 -DDEVICE_LPTICKER=1 -DDEVICE_MPU=1 -DDEVICE_SERIAL=1 -DDEVICE_SPI=1 -DDEVICE_STDIO_MESSAGES=1 -DDEVICE_USTICKER=1 -DFEATURE_BLE=1 -DMBED_BUILD_TIMESTAMP=1615921178.4891083 -DTARGET_AMA3B1KK -DTARGET_Ambiq_Micro -DTARGET_Apollo3 -DTARGET_CORDIO -DTARGET_CORTEX -DTARGET_CORTEX_M -DTARGET_FAMILY_Apollo3 -DTARGET_LIKE_CORTEX_M4 -DTARGET_LIKE_MBED -DTARGET_M4 -DTARGET_NAME=SFE_ARTEMIS_DK -DTARGET_RELEASE -DTARGET_RTOS_M4_M7 -DTARGET_SFE_ARTEMIS_DK -DTOOLCHAIN_GCC -DTOOLCHAIN_GCC_ARM -D__CMSIS_RTOS -D__CORTEX_M4 -D__FPU_PRESENT=1 -D__MBED_CMSIS_RTOS_CM -D__MBED__=1 \ No newline at end of file +-DAM_CUSTOM_BDADDR -DAM_PACKAGE_BGA -DARDUINO_BLE_FIX -DARM_MATH_CM4 -DCOMPONENT_FLASHIAP=1 -DCOMPONENT_hm01b0=1 -DCOMPONENT_lis2dh12=1 -DCORDIO_ZERO_COPY_HCI -DDEVICE_FLASH=1 -DDEVICE_I2C=1 -DDEVICE_INTERRUPTIN=1 -DDEVICE_LPTICKER=1 -DDEVICE_MPU=1 -DDEVICE_SERIAL=1 -DDEVICE_SPI=1 -DDEVICE_STDIO_MESSAGES=1 -DDEVICE_USTICKER=1 -DFEATURE_BLE=1 -DMBED_BUILD_TIMESTAMP=1620707817.221869 -DTARGET_AMA3B1KK -DTARGET_Ambiq_Micro -DTARGET_Apollo3 -DTARGET_CORDIO -DTARGET_CORTEX -DTARGET_CORTEX_M -DTARGET_FAMILY_Apollo3 -DTARGET_LIKE_CORTEX_M4 -DTARGET_LIKE_MBED -DTARGET_M4 -DTARGET_NAME=SFE_ARTEMIS_DK -DTARGET_RELEASE -DTARGET_RTOS_M4_M7 -DTARGET_SFE_ARTEMIS_DK -DTOOLCHAIN_GCC -DTOOLCHAIN_GCC_ARM -D__CMSIS_RTOS -D__CORTEX_M4 -D__FPU_PRESENT=1 -D__MBED_CMSIS_RTOS_CM -D__MBED__=1 \ No newline at end of file diff --git a/variants/SFE_ARTEMIS_DK/mbed/libmbed-os.a b/variants/SFE_ARTEMIS_DK/mbed/libmbed-os.a index d9a3fc3..37e8b62 100644 Binary files a/variants/SFE_ARTEMIS_DK/mbed/libmbed-os.a and b/variants/SFE_ARTEMIS_DK/mbed/libmbed-os.a differ diff --git a/variants/SFE_ARTEMIS_MM_PB/mbed/.c-flags b/variants/SFE_ARTEMIS_MM_PB/mbed/.c-flags index c37d635..33d97d2 100644 --- a/variants/SFE_ARTEMIS_MM_PB/mbed/.c-flags +++ b/variants/SFE_ARTEMIS_MM_PB/mbed/.c-flags @@ -1 +1 @@ --c -std=gnu11 -DMBED_MINIMAL_PRINTF -DMBED_TRAP_ERRORS_ENABLED=1 -Os -fdata-sections -ffunction-sections -fmessage-length=0 -fno-exceptions -fomit-frame-pointer -funsigned-char -g -mcpu=cortex-m4 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -mthumb \ No newline at end of file +-c -std=gnu11 -DMBED_MINIMAL_PRINTF -DMBED_TRAP_ERRORS_ENABLED=1 -Os -fdata-sections -ffunction-sections -fmessage-length=0 -fno-exceptions -fomit-frame-pointer -funsigned-char -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb \ No newline at end of file diff --git a/variants/SFE_ARTEMIS_MM_PB/mbed/.cxx-flags b/variants/SFE_ARTEMIS_MM_PB/mbed/.cxx-flags index 646bf27..9de4dbd 100644 --- a/variants/SFE_ARTEMIS_MM_PB/mbed/.cxx-flags +++ b/variants/SFE_ARTEMIS_MM_PB/mbed/.cxx-flags @@ -1 +1 @@ --c -fno-rtti -std=gnu++14 -DMBED_MINIMAL_PRINTF -DMBED_TRAP_ERRORS_ENABLED=1 -Os -fdata-sections -ffunction-sections -fmessage-length=0 -fno-exceptions -fomit-frame-pointer -funsigned-char -g -mcpu=cortex-m4 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -mthumb \ No newline at end of file +-c -fno-rtti -std=gnu++14 -DMBED_MINIMAL_PRINTF -DMBED_TRAP_ERRORS_ENABLED=1 -Os -fdata-sections -ffunction-sections -fmessage-length=0 -fno-exceptions -fomit-frame-pointer -funsigned-char -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb \ No newline at end of file diff --git a/variants/SFE_ARTEMIS_MM_PB/mbed/.ld-flags b/variants/SFE_ARTEMIS_MM_PB/mbed/.ld-flags index 65528a5..6341b37 100644 --- a/variants/SFE_ARTEMIS_MM_PB/mbed/.ld-flags +++ b/variants/SFE_ARTEMIS_MM_PB/mbed/.ld-flags @@ -1 +1 @@ --DMBED_BOOT_STACK_SIZE=1024 -DXIP_ENABLE=0 -Wl,--gc-sections -Wl,--wrap,_calloc_r -Wl,--wrap,_memalign_r -Wl,--wrap,atexit -Wl,--wrap,exit -Wl,--wrap,fprintf -Wl,--wrap,main -Wl,--wrap,printf -Wl,--wrap,snprintf -Wl,--wrap,sprintf -Wl,--wrap,vfprintf -Wl,--wrap,vprintf -Wl,--wrap,vsnprintf -Wl,--wrap,vsprintf -Wl,-n -mcpu=cortex-m4 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -mthumb \ No newline at end of file +-DMBED_BOOT_STACK_SIZE=1024 -DXIP_ENABLE=0 -Wl,--gc-sections -Wl,--wrap,_calloc_r -Wl,--wrap,_memalign_r -Wl,--wrap,atexit -Wl,--wrap,exit -Wl,--wrap,fprintf -Wl,--wrap,main -Wl,--wrap,printf -Wl,--wrap,snprintf -Wl,--wrap,sprintf -Wl,--wrap,vfprintf -Wl,--wrap,vprintf -Wl,--wrap,vsnprintf -Wl,--wrap,vsprintf -Wl,-n -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb \ No newline at end of file diff --git a/variants/SFE_ARTEMIS_MM_PB/mbed/.ld-symbols b/variants/SFE_ARTEMIS_MM_PB/mbed/.ld-symbols index 0df90bd..7de7cad 100644 --- a/variants/SFE_ARTEMIS_MM_PB/mbed/.ld-symbols +++ b/variants/SFE_ARTEMIS_MM_PB/mbed/.ld-symbols @@ -1 +1 @@ --DAM_CUSTOM_BDADDR -DAM_PACKAGE_BGA -DARDUINO_BLE_FIX -DARM_MATH_CM4 -DCOMPONENT_FLASHIAP=1 -DCORDIO_ZERO_COPY_HCI -DDEVICE_FLASH=1 -DDEVICE_I2C=1 -DDEVICE_INTERRUPTIN=1 -DDEVICE_LPTICKER=1 -DDEVICE_MPU=1 -DDEVICE_SERIAL=1 -DDEVICE_SPI=1 -DDEVICE_STDIO_MESSAGES=1 -DDEVICE_USTICKER=1 -DFEATURE_BLE=1 -DMBED_BUILD_TIMESTAMP=1615922070.715788 -DTARGET_AMA3B1KK -DTARGET_Ambiq_Micro -DTARGET_Apollo3 -DTARGET_CORDIO -DTARGET_CORTEX -DTARGET_CORTEX_M -DTARGET_FAMILY_Apollo3 -DTARGET_LIKE_CORTEX_M4 -DTARGET_LIKE_MBED -DTARGET_M4 -DTARGET_NAME=SFE_ARTEMIS_MM_PB -DTARGET_RELEASE -DTARGET_RTOS_M4_M7 -DTARGET_SFE_ARTEMIS_MM_PB -DTOOLCHAIN_GCC -DTOOLCHAIN_GCC_ARM -D__CMSIS_RTOS -D__CORTEX_M4 -D__FPU_PRESENT=1 -D__MBED_CMSIS_RTOS_CM -D__MBED__=1 \ No newline at end of file +-DAM_CUSTOM_BDADDR -DAM_PACKAGE_BGA -DARDUINO_BLE_FIX -DARM_MATH_CM4 -DCOMPONENT_FLASHIAP=1 -DCORDIO_ZERO_COPY_HCI -DDEVICE_FLASH=1 -DDEVICE_I2C=1 -DDEVICE_INTERRUPTIN=1 -DDEVICE_LPTICKER=1 -DDEVICE_MPU=1 -DDEVICE_SERIAL=1 -DDEVICE_SPI=1 -DDEVICE_STDIO_MESSAGES=1 -DDEVICE_USTICKER=1 -DFEATURE_BLE=1 -DMBED_BUILD_TIMESTAMP=1620708532.3121073 -DTARGET_AMA3B1KK -DTARGET_Ambiq_Micro -DTARGET_Apollo3 -DTARGET_CORDIO -DTARGET_CORTEX -DTARGET_CORTEX_M -DTARGET_FAMILY_Apollo3 -DTARGET_LIKE_CORTEX_M4 -DTARGET_LIKE_MBED -DTARGET_M4 -DTARGET_NAME=SFE_ARTEMIS_MM_PB -DTARGET_RELEASE -DTARGET_RTOS_M4_M7 -DTARGET_SFE_ARTEMIS_MM_PB -DTOOLCHAIN_GCC -DTOOLCHAIN_GCC_ARM -D__CMSIS_RTOS -D__CORTEX_M4 -D__FPU_PRESENT=1 -D__MBED_CMSIS_RTOS_CM -D__MBED__=1 \ No newline at end of file diff --git a/variants/SFE_ARTEMIS_MM_PB/mbed/libmbed-os.a b/variants/SFE_ARTEMIS_MM_PB/mbed/libmbed-os.a index 4578a59..4fcba56 100644 Binary files a/variants/SFE_ARTEMIS_MM_PB/mbed/libmbed-os.a and b/variants/SFE_ARTEMIS_MM_PB/mbed/libmbed-os.a differ diff --git a/variants/SFE_ARTEMIS_NANO/mbed/.c-flags b/variants/SFE_ARTEMIS_NANO/mbed/.c-flags index c37d635..33d97d2 100644 --- a/variants/SFE_ARTEMIS_NANO/mbed/.c-flags +++ b/variants/SFE_ARTEMIS_NANO/mbed/.c-flags @@ -1 +1 @@ --c -std=gnu11 -DMBED_MINIMAL_PRINTF -DMBED_TRAP_ERRORS_ENABLED=1 -Os -fdata-sections -ffunction-sections -fmessage-length=0 -fno-exceptions -fomit-frame-pointer -funsigned-char -g -mcpu=cortex-m4 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -mthumb \ No newline at end of file +-c -std=gnu11 -DMBED_MINIMAL_PRINTF -DMBED_TRAP_ERRORS_ENABLED=1 -Os -fdata-sections -ffunction-sections -fmessage-length=0 -fno-exceptions -fomit-frame-pointer -funsigned-char -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb \ No newline at end of file diff --git a/variants/SFE_ARTEMIS_NANO/mbed/.cxx-flags b/variants/SFE_ARTEMIS_NANO/mbed/.cxx-flags index 646bf27..9de4dbd 100644 --- a/variants/SFE_ARTEMIS_NANO/mbed/.cxx-flags +++ b/variants/SFE_ARTEMIS_NANO/mbed/.cxx-flags @@ -1 +1 @@ --c -fno-rtti -std=gnu++14 -DMBED_MINIMAL_PRINTF -DMBED_TRAP_ERRORS_ENABLED=1 -Os -fdata-sections -ffunction-sections -fmessage-length=0 -fno-exceptions -fomit-frame-pointer -funsigned-char -g -mcpu=cortex-m4 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -mthumb \ No newline at end of file +-c -fno-rtti -std=gnu++14 -DMBED_MINIMAL_PRINTF -DMBED_TRAP_ERRORS_ENABLED=1 -Os -fdata-sections -ffunction-sections -fmessage-length=0 -fno-exceptions -fomit-frame-pointer -funsigned-char -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb \ No newline at end of file diff --git a/variants/SFE_ARTEMIS_NANO/mbed/.ld-flags b/variants/SFE_ARTEMIS_NANO/mbed/.ld-flags index 65528a5..6341b37 100644 --- a/variants/SFE_ARTEMIS_NANO/mbed/.ld-flags +++ b/variants/SFE_ARTEMIS_NANO/mbed/.ld-flags @@ -1 +1 @@ --DMBED_BOOT_STACK_SIZE=1024 -DXIP_ENABLE=0 -Wl,--gc-sections -Wl,--wrap,_calloc_r -Wl,--wrap,_memalign_r -Wl,--wrap,atexit -Wl,--wrap,exit -Wl,--wrap,fprintf -Wl,--wrap,main -Wl,--wrap,printf -Wl,--wrap,snprintf -Wl,--wrap,sprintf -Wl,--wrap,vfprintf -Wl,--wrap,vprintf -Wl,--wrap,vsnprintf -Wl,--wrap,vsprintf -Wl,-n -mcpu=cortex-m4 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -mthumb \ No newline at end of file +-DMBED_BOOT_STACK_SIZE=1024 -DXIP_ENABLE=0 -Wl,--gc-sections -Wl,--wrap,_calloc_r -Wl,--wrap,_memalign_r -Wl,--wrap,atexit -Wl,--wrap,exit -Wl,--wrap,fprintf -Wl,--wrap,main -Wl,--wrap,printf -Wl,--wrap,snprintf -Wl,--wrap,sprintf -Wl,--wrap,vfprintf -Wl,--wrap,vprintf -Wl,--wrap,vsnprintf -Wl,--wrap,vsprintf -Wl,-n -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb \ No newline at end of file diff --git a/variants/SFE_ARTEMIS_NANO/mbed/.ld-symbols b/variants/SFE_ARTEMIS_NANO/mbed/.ld-symbols index f2cf025..17f8dc8 100644 --- a/variants/SFE_ARTEMIS_NANO/mbed/.ld-symbols +++ b/variants/SFE_ARTEMIS_NANO/mbed/.ld-symbols @@ -1 +1 @@ --DAM_CUSTOM_BDADDR -DAM_PACKAGE_BGA -DARDUINO_BLE_FIX -DARM_MATH_CM4 -DCOMPONENT_FLASHIAP=1 -DCORDIO_ZERO_COPY_HCI -DDEVICE_FLASH=1 -DDEVICE_I2C=1 -DDEVICE_INTERRUPTIN=1 -DDEVICE_LPTICKER=1 -DDEVICE_MPU=1 -DDEVICE_SERIAL=1 -DDEVICE_SPI=1 -DDEVICE_STDIO_MESSAGES=1 -DDEVICE_USTICKER=1 -DFEATURE_BLE=1 -DMBED_BUILD_TIMESTAMP=1615921357.529876 -DTARGET_AMA3B1KK -DTARGET_Ambiq_Micro -DTARGET_Apollo3 -DTARGET_CORDIO -DTARGET_CORTEX -DTARGET_CORTEX_M -DTARGET_FAMILY_Apollo3 -DTARGET_LIKE_CORTEX_M4 -DTARGET_LIKE_MBED -DTARGET_M4 -DTARGET_NAME=SFE_ARTEMIS_NANO -DTARGET_RELEASE -DTARGET_RTOS_M4_M7 -DTARGET_SFE_ARTEMIS_NANO -DTOOLCHAIN_GCC -DTOOLCHAIN_GCC_ARM -D__CMSIS_RTOS -D__CORTEX_M4 -D__FPU_PRESENT=1 -D__MBED_CMSIS_RTOS_CM -D__MBED__=1 \ No newline at end of file +-DAM_CUSTOM_BDADDR -DAM_PACKAGE_BGA -DARDUINO_BLE_FIX -DARM_MATH_CM4 -DCOMPONENT_FLASHIAP=1 -DCORDIO_ZERO_COPY_HCI -DDEVICE_FLASH=1 -DDEVICE_I2C=1 -DDEVICE_INTERRUPTIN=1 -DDEVICE_LPTICKER=1 -DDEVICE_MPU=1 -DDEVICE_SERIAL=1 -DDEVICE_SPI=1 -DDEVICE_STDIO_MESSAGES=1 -DDEVICE_USTICKER=1 -DFEATURE_BLE=1 -DMBED_BUILD_TIMESTAMP=1620707957.0535676 -DTARGET_AMA3B1KK -DTARGET_Ambiq_Micro -DTARGET_Apollo3 -DTARGET_CORDIO -DTARGET_CORTEX -DTARGET_CORTEX_M -DTARGET_FAMILY_Apollo3 -DTARGET_LIKE_CORTEX_M4 -DTARGET_LIKE_MBED -DTARGET_M4 -DTARGET_NAME=SFE_ARTEMIS_NANO -DTARGET_RELEASE -DTARGET_RTOS_M4_M7 -DTARGET_SFE_ARTEMIS_NANO -DTOOLCHAIN_GCC -DTOOLCHAIN_GCC_ARM -D__CMSIS_RTOS -D__CORTEX_M4 -D__FPU_PRESENT=1 -D__MBED_CMSIS_RTOS_CM -D__MBED__=1 \ No newline at end of file diff --git a/variants/SFE_ARTEMIS_NANO/mbed/libmbed-os.a b/variants/SFE_ARTEMIS_NANO/mbed/libmbed-os.a index 5026271..30fccdd 100644 Binary files a/variants/SFE_ARTEMIS_NANO/mbed/libmbed-os.a and b/variants/SFE_ARTEMIS_NANO/mbed/libmbed-os.a differ diff --git a/variants/SFE_ARTEMIS_NANO/variant.cpp b/variants/SFE_ARTEMIS_NANO/variant.cpp index b0beee8..8907223 100644 --- a/variants/SFE_ARTEMIS_NANO/variant.cpp +++ b/variants/SFE_ARTEMIS_NANO/variant.cpp @@ -5,8 +5,8 @@ #include "variant.h" -//UART Serial1(SERIAL1_TX, SERIAL1_RX); +UART Serial1(SERIAL1_TX, SERIAL1_RX); void initVariant(void){ - + } diff --git a/variants/SFE_ARTEMIS_THING_PLUS/mbed/.c-flags b/variants/SFE_ARTEMIS_THING_PLUS/mbed/.c-flags index c37d635..33d97d2 100644 --- a/variants/SFE_ARTEMIS_THING_PLUS/mbed/.c-flags +++ b/variants/SFE_ARTEMIS_THING_PLUS/mbed/.c-flags @@ -1 +1 @@ --c -std=gnu11 -DMBED_MINIMAL_PRINTF -DMBED_TRAP_ERRORS_ENABLED=1 -Os -fdata-sections -ffunction-sections -fmessage-length=0 -fno-exceptions -fomit-frame-pointer -funsigned-char -g -mcpu=cortex-m4 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -mthumb \ No newline at end of file +-c -std=gnu11 -DMBED_MINIMAL_PRINTF -DMBED_TRAP_ERRORS_ENABLED=1 -Os -fdata-sections -ffunction-sections -fmessage-length=0 -fno-exceptions -fomit-frame-pointer -funsigned-char -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb \ No newline at end of file diff --git a/variants/SFE_ARTEMIS_THING_PLUS/mbed/.cxx-flags b/variants/SFE_ARTEMIS_THING_PLUS/mbed/.cxx-flags index 646bf27..9de4dbd 100644 --- a/variants/SFE_ARTEMIS_THING_PLUS/mbed/.cxx-flags +++ b/variants/SFE_ARTEMIS_THING_PLUS/mbed/.cxx-flags @@ -1 +1 @@ --c -fno-rtti -std=gnu++14 -DMBED_MINIMAL_PRINTF -DMBED_TRAP_ERRORS_ENABLED=1 -Os -fdata-sections -ffunction-sections -fmessage-length=0 -fno-exceptions -fomit-frame-pointer -funsigned-char -g -mcpu=cortex-m4 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -mthumb \ No newline at end of file +-c -fno-rtti -std=gnu++14 -DMBED_MINIMAL_PRINTF -DMBED_TRAP_ERRORS_ENABLED=1 -Os -fdata-sections -ffunction-sections -fmessage-length=0 -fno-exceptions -fomit-frame-pointer -funsigned-char -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb \ No newline at end of file diff --git a/variants/SFE_ARTEMIS_THING_PLUS/mbed/.ld-flags b/variants/SFE_ARTEMIS_THING_PLUS/mbed/.ld-flags index 65528a5..6341b37 100644 --- a/variants/SFE_ARTEMIS_THING_PLUS/mbed/.ld-flags +++ b/variants/SFE_ARTEMIS_THING_PLUS/mbed/.ld-flags @@ -1 +1 @@ --DMBED_BOOT_STACK_SIZE=1024 -DXIP_ENABLE=0 -Wl,--gc-sections -Wl,--wrap,_calloc_r -Wl,--wrap,_memalign_r -Wl,--wrap,atexit -Wl,--wrap,exit -Wl,--wrap,fprintf -Wl,--wrap,main -Wl,--wrap,printf -Wl,--wrap,snprintf -Wl,--wrap,sprintf -Wl,--wrap,vfprintf -Wl,--wrap,vprintf -Wl,--wrap,vsnprintf -Wl,--wrap,vsprintf -Wl,-n -mcpu=cortex-m4 -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -mthumb \ No newline at end of file +-DMBED_BOOT_STACK_SIZE=1024 -DXIP_ENABLE=0 -Wl,--gc-sections -Wl,--wrap,_calloc_r -Wl,--wrap,_memalign_r -Wl,--wrap,atexit -Wl,--wrap,exit -Wl,--wrap,fprintf -Wl,--wrap,main -Wl,--wrap,printf -Wl,--wrap,snprintf -Wl,--wrap,sprintf -Wl,--wrap,vfprintf -Wl,--wrap,vprintf -Wl,--wrap,vsnprintf -Wl,--wrap,vsprintf -Wl,-n -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb \ No newline at end of file diff --git a/variants/SFE_ARTEMIS_THING_PLUS/mbed/.ld-symbols b/variants/SFE_ARTEMIS_THING_PLUS/mbed/.ld-symbols index c770910..50cd1a9 100644 --- a/variants/SFE_ARTEMIS_THING_PLUS/mbed/.ld-symbols +++ b/variants/SFE_ARTEMIS_THING_PLUS/mbed/.ld-symbols @@ -1 +1 @@ --DAM_CUSTOM_BDADDR -DAM_PACKAGE_BGA -DARDUINO_BLE_FIX -DARM_MATH_CM4 -DCOMPONENT_FLASHIAP=1 -DCORDIO_ZERO_COPY_HCI -DDEVICE_FLASH=1 -DDEVICE_I2C=1 -DDEVICE_INTERRUPTIN=1 -DDEVICE_LPTICKER=1 -DDEVICE_MPU=1 -DDEVICE_SERIAL=1 -DDEVICE_SPI=1 -DDEVICE_STDIO_MESSAGES=1 -DDEVICE_USTICKER=1 -DFEATURE_BLE=1 -DMBED_BUILD_TIMESTAMP=1615921535.7292666 -DTARGET_AMA3B1KK -DTARGET_Ambiq_Micro -DTARGET_Apollo3 -DTARGET_CORDIO -DTARGET_CORTEX -DTARGET_CORTEX_M -DTARGET_FAMILY_Apollo3 -DTARGET_LIKE_CORTEX_M4 -DTARGET_LIKE_MBED -DTARGET_M4 -DTARGET_NAME=SFE_ARTEMIS_THING_PLUS -DTARGET_RELEASE -DTARGET_RTOS_M4_M7 -DTARGET_SFE_ARTEMIS_THING_PLUS -DTOOLCHAIN_GCC -DTOOLCHAIN_GCC_ARM -D__CMSIS_RTOS -D__CORTEX_M4 -D__FPU_PRESENT=1 -D__MBED_CMSIS_RTOS_CM -D__MBED__=1 \ No newline at end of file +-DAM_CUSTOM_BDADDR -DAM_PACKAGE_BGA -DARDUINO_BLE_FIX -DARM_MATH_CM4 -DCOMPONENT_FLASHIAP=1 -DCORDIO_ZERO_COPY_HCI -DDEVICE_FLASH=1 -DDEVICE_I2C=1 -DDEVICE_INTERRUPTIN=1 -DDEVICE_LPTICKER=1 -DDEVICE_MPU=1 -DDEVICE_SERIAL=1 -DDEVICE_SPI=1 -DDEVICE_STDIO_MESSAGES=1 -DDEVICE_USTICKER=1 -DFEATURE_BLE=1 -DMBED_BUILD_TIMESTAMP=1620708094.7318206 -DTARGET_AMA3B1KK -DTARGET_Ambiq_Micro -DTARGET_Apollo3 -DTARGET_CORDIO -DTARGET_CORTEX -DTARGET_CORTEX_M -DTARGET_FAMILY_Apollo3 -DTARGET_LIKE_CORTEX_M4 -DTARGET_LIKE_MBED -DTARGET_M4 -DTARGET_NAME=SFE_ARTEMIS_THING_PLUS -DTARGET_RELEASE -DTARGET_RTOS_M4_M7 -DTARGET_SFE_ARTEMIS_THING_PLUS -DTOOLCHAIN_GCC -DTOOLCHAIN_GCC_ARM -D__CMSIS_RTOS -D__CORTEX_M4 -D__FPU_PRESENT=1 -D__MBED_CMSIS_RTOS_CM -D__MBED__=1 \ No newline at end of file diff --git a/variants/SFE_ARTEMIS_THING_PLUS/mbed/libmbed-os.a b/variants/SFE_ARTEMIS_THING_PLUS/mbed/libmbed-os.a index 34c3883..1d1fe65 100644 Binary files a/variants/SFE_ARTEMIS_THING_PLUS/mbed/libmbed-os.a and b/variants/SFE_ARTEMIS_THING_PLUS/mbed/libmbed-os.a differ diff --git a/variants/SFE_ARTEMIS_THING_PLUS/variant.h b/variants/SFE_ARTEMIS_THING_PLUS/variant.h index 0c5d8ff..b48ecad 100644 --- a/variants/SFE_ARTEMIS_THING_PLUS/variant.h +++ b/variants/SFE_ARTEMIS_THING_PLUS/variant.h @@ -11,7 +11,7 @@ #include "config/pins.h" #define VARIANT_SPI_INTFCS 1 -#define VARIANT_WIRE_INTFCS 1 +#define VARIANT_WIRE_INTFCS 2 // SPI #define VARIANT_SPI_SDI SPI_SDI @@ -22,6 +22,9 @@ #define VARIANT_Wire_SDA I2C_SDA #define VARIANT_Wire_SCL I2C_SCL +#define VARIANT_Wire1_SDA I2C1_SDA +#define VARIANT_Wire1_SCL I2C1_SCL + // UART extern UART Serial1; diff --git a/variants/SFE_EDGE/mbed/.c-flags b/variants/SFE_EDGE/mbed/.c-flags index c37d635..33d97d2 100644 --- a/variants/SFE_EDGE/mbed/.c-flags +++ b/variants/SFE_EDGE/mbed/.c-flags @@ -1 +1 @@ --c -std=gnu11 -DMBED_MINIMAL_PRINTF -DMBED_TRAP_ERRORS_ENABLED=1 -Os -fdata-sections -ffunction-sections -fmessage-length=0 -fno-exceptions -fomit-frame-pointer -{"code":"internal","msg":"git-diff-tree: context deadline exceeded","meta":{"cause":"*fmt.wrapError"}}