From 8e2bf8591a70742addfd169832f03aa76210961c Mon Sep 17 00:00:00 2001 From: Joey Castillo Date: Fri, 3 Dec 2021 11:30:36 -0500 Subject: [PATCH 1/6] movement: allow watch faces to request zero ticks --- movement/movement.c | 2 +- movement/movement_config.h | 1 + movement/watch_faces/demos/character_set_face.c | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/movement/movement.c b/movement/movement.c index b41700b0..f627dbf5 100644 --- a/movement/movement.c +++ b/movement/movement.c @@ -104,7 +104,7 @@ void movement_request_tick_frequency(uint8_t freq) { RTC->MODE2.INTENCLR.reg = 0xFE; // disable all callbacks except the 128 Hz one movement_state.subsecond = 0; movement_state.tick_frequency = freq; - watch_rtc_register_periodic_callback(cb_tick, freq); + if (freq) watch_rtc_register_periodic_callback(cb_tick, freq); } void movement_illuminate_led() { diff --git a/movement/movement_config.h b/movement/movement_config.h index 2ef43ef0..b6b3c350 100644 --- a/movement/movement_config.h +++ b/movement/movement_config.h @@ -18,6 +18,7 @@ const watch_face_t watch_faces[] = { simple_clock_face, + character_set_face, preferences_face, set_time_face, }; diff --git a/movement/watch_faces/demos/character_set_face.c b/movement/watch_faces/demos/character_set_face.c index 7daea5a9..eabb133f 100644 --- a/movement/watch_faces/demos/character_set_face.c +++ b/movement/watch_faces/demos/character_set_face.c @@ -12,6 +12,7 @@ void character_set_face_activate(movement_settings_t *settings, void *context) { (void) settings; char *c = (char *)context; *c = '@'; + movement_request_tick_frequency(0); } bool character_set_face_loop(movement_event_t event, movement_settings_t *settings, void *context) { @@ -33,8 +34,6 @@ bool character_set_face_loop(movement_event_t event, movement_settings_t *settin sprintf(buf, "%c%c%c%c%c%c%c%c%c%c", *c, *c, *c, *c, *c, *c, *c, *c, *c, *c); watch_display_string(buf, 0); break; - case EVENT_TICK: - break; case EVENT_TIMEOUT: movement_move_to_face(0); break; @@ -48,4 +47,5 @@ bool character_set_face_loop(movement_event_t event, movement_settings_t *settin void character_set_face_resign(movement_settings_t *settings, void *context) { (void) settings; (void) context; + movement_request_tick_frequency(1); } From 00c1f656d3fdb5d72ce93e2977fee33c8ea9dfda Mon Sep 17 00:00:00 2001 From: Joey Castillo Date: Fri, 3 Dec 2021 11:45:40 -0500 Subject: [PATCH 2/6] add rev 05 board with red/green LED --- PCB/Main Boards/OSO-SWAT-A1-05.brd | 4191 ++++++++++++++++++++++ PCB/Main Boards/OSO-SWAT-A1-05.sch | 5324 ++++++++++++++++++++++++++++ 2 files changed, 9515 insertions(+) create mode 100644 PCB/Main Boards/OSO-SWAT-A1-05.brd create mode 100644 PCB/Main Boards/OSO-SWAT-A1-05.sch diff --git a/PCB/Main Boards/OSO-SWAT-A1-05.brd b/PCB/Main Boards/OSO-SWAT-A1-05.brd new file mode 100644 index 00000000..32a58e77 --- /dev/null +++ b/PCB/Main Boards/OSO-SWAT-A1-05.brd @@ -0,0 +1,4191 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +OSO-SWAT-A1-05 + + +Sensor Watch! +by joey castillo +A0: PB04 +SDA: PB30/SERCOM1.0 +SCL: PB31/SERCOM1.1 +A1/SCK:PB01/TC3.1/S3.3 +A2/MOSI:PB02/TC2.0/S3.0 + A3/CS: PB03/TC2.1 + A4/MISO: PB00/ + TC3.0/S3.2 + +IMPORTANT: +BUZZ: PA27/TCC.5 +LED1: PA20/TCC.6 +LED2: PA21/TCC.7 +REMOVE +BAT B4 +USING +USB!!! +except the +bear! +NOTE TO JLCPCB ENGINEER: +Please refer to order number +Y22-2862359A for correct +fabrication of the three holes +at the edge of the PCB. + +< 9-Pin conn. +RESET + Btn +BTN_LIGHT: + PA22 + /I6 +BTN_MODE: +PA23/I7 +BTN_ +ALARM: PA02 +/I2/RTC.IN2 +CC-BY-SA 4.0 + + + + + + + + + + + + + + + + + + + +<h2><b>microBuilder.eu</b> Eagle Footprint Library</h2> + +<p>Footprints for common components used in our projects and products. This is the same library that we use internally, and it is regularly updated. The newest version can always be found at <b>www.microBuilder.eu</b>. If you find this library useful, please feel free to purchase something from our online store. Please also note that all holes are optimised for metric drill bits!</p> + +<h3>Obligatory Warning</h3> +<p>While it probably goes without saying, there are no guarantees that the footprints or schematic symbols in this library are flawless, and we make no promises of fitness for production, prototyping or any other purpose. These libraries are provided for information puposes only, and are used at your own discretion. While we make every effort to produce accurate footprints, and many of the items found in this library have be proven in production, we can't make any promises of suitability for a specific purpose. If you do find any errors, though, please feel free to contact us at www.microbuilder.eu to let us know about it so that we can update the library accordingly!</p> + +<h3>License</h3> +<p>This work is placed in the public domain, and may be freely used for commercial and non-commercial work with the following conditions:</p> +<p>THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +</p> + + +<b>0402 MicroPitch<p> + + + + + +>NAME +>VALUE + + + + + +<b>0603 MicroPitch</b> + + + + + +>NAME +>VALUE + + + + + + + + + + + + + + + + + + + + + + +Generated from <b>Hiking Log FeatherWing.brd</b><p> +by exp-lbrs.ulp + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +<b>https://componentsearchengine.com</b><p> +<author>Created by SamacSys</author> + + +<b>FH19C-9S-0.5SH(10)-1</b><br> + + + + + + + + + + + + +>NAME +>VALUE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + +Generated from <b>Adafruit 3.5in 480x320 FeatherWing.sch</b><p> +by exp-lbrs.ulp + + +<b>0805 MicroPitch</b> + + + + + + + + +>NAME +>VALUE + + + + +Generated from <b>Adafruit Feather M0 Express.sch</b><p> +by exp-lbrs.ulp + + + + +>NAME +>VALUE + + + + + + + + +>NAME +>VALUE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +>Value +>Name + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + + + + + + + + + + + +>NAME +>VALUE + + + + + + + + + + + + + + + + + + + + + + + + + + + + +<b>JLCPCB Design Rules by Jaap de Dood</b> +<p> +Please make sure your boards conform to these design rules. +</p> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Since Version 6.2.2 text objects can contain more than one line, +which will not be processed correctly with this version. + + + diff --git a/PCB/Main Boards/OSO-SWAT-A1-05.sch b/PCB/Main Boards/OSO-SWAT-A1-05.sch new file mode 100644 index 00000000..582ab959 --- /dev/null +++ b/PCB/Main Boards/OSO-SWAT-A1-05.sch @@ -0,0 +1,5324 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +>VALUE + + + + + +<b>SUPPLY SYMBOL</b> + + + + + + + + + + + + + + +<h2><b>microBuilder.eu</b> Eagle Footprint Library</h2> + +<p>Footprints for common components used in our projects and products. This is the same library that we use internally, and it is regularly updated. The newest version can always be found at <b>www.microBuilder.eu</b>. If you find this library useful, please feel free to purchase something from our online store. Please also note that all holes are optimised for metric drill bits!</p> + +<h3>Obligatory Warning</h3> +<p>While it probably goes without saying, there are no guarantees that the footprints or schematic symbols in this library are flawless, and we make no promises of fitness for production, prototyping or any other purpose. These libraries are provided for information puposes only, and are used at your own discretion. While we make every effort to produce accurate footprints, and many of the items found in this library have be proven in production, we can't make any promises of suitability for a specific purpose. If you do find any errors, though, please feel free to contact us at www.microbuilder.eu to let us know about it so that we can update the library accordingly!</p> + +<h3>License</h3> +<p>This work is placed in the public domain, and may be freely used for commercial and non-commercial work with the following conditions:</p> +<p>THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +</p> + + +0603-Mini +<p>Mini footprint for dense boards</p> + + + + + + + + + + + + +>NAME +>VALUE + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + +<b> 0402</b> + + + + + + + + +>NAME +>VALUE + + + + + +<b>0402 MicroPitch<p> + + + + + +>NAME +>VALUE + + + + + +<b>0603</b> + + + + + + + + +>NAME +>VALUE + + + + + +<b>0603 MicroPitch</b> + + + + + +>NAME +>VALUE + + + + + +<b>0805</b> + + + + + + + + +>NAME +>VALUE + + + + + +<b>0805 MicroPitch</b> + + + + + +>NAME +>VALUE + + + + + + + + + +>NAME +>VALUE + + + + + + + + + + + + + +>NAME +>VALUE + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + + + + + +>NAME +>VALUE + + + + + + + + + +>NAME +>VALUE + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + +<b>RESISTOR 2512 (Metric 6432)</b> + + + + + + + + +>NAME +>VALUE + + + + + + + + + +1mm + + +<b>FIDUCIAL MARKER</b><p> +round, layers 1 + 16 + 21 + 39 + 49 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + + + + + + + +>NAME +>VALUE + + + + + +>VALUE + + + +>VALUE + + + + + + + + + + + + +<p><b>Ceramic Capacitors</b></p> +<p>For new designs, use the packages preceded by an '_' character since they are more reliable:</p> +<p>The following footprints should be used on most boards:</p> +<ul> +<li><b>_0402</b> - Standard footprint for regular board layouts</li> +<li><b>_0603</b> - Standard footprint for regular board layouts</li> +<li><b>_0805</b> - Standard footprint for regular board layouts</li> +<li><b>_1206</b> - Standard footprint for regular board layouts</li> +</ul> +<p>For extremely tight-pitch boards where space is at a premium, the following 'micro-pitch' footprints can be used (smaller pads, no silkscreen outline, etc.):</p> +<ul> +<li><b>_0402MP</b> - Micro-pitch footprint for very dense/compact boards</li> +<li><b>_0603MP</b> - Micro-pitch footprint for very dense/compact boards</li> +<li><b>_0805MP</b> - Micro-pitch footprint for very dense/compact boards</li> +<li><b>_1206MP</b> - Micro-pitch footprint for very dense/compact boards</li> +</ul> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +<p><b>Resistors</b></p> +<p>For new designs, use the packages preceded by an '_' character since they are more reliable:</p> +<p>The following footprints should be used on most boards:</p> +<ul> +<li><b>_0402</b> - Standard footprint for regular board layouts</li> +<li><b>_0603</b> - Standard footprint for regular board layouts</li> +<li><b>_0805</b> - Standard footprint for regular board layouts</li> +<li><b>_1206</b> - Standard footprint for regular board layouts</li> +</ul> +<p>For extremely tight-pitch boards where space is at a premium, the following 'micro-pitch' footprints can be used (smaller pads, no silkscreen outline, etc.):</p> +<ul> +<li><b>_0402MP</b> - Micro-pitch footprint for very dense/compact boards</li> +<li><b>_0603MP</b> - Micro-pitch footprint for very dense/compact boards</li> +<li><b>_0805MP</b> - Micro-pitch footprint for very dense/compact boards</li> +<li><b>_1206MP</b> - Micro-pitch footprint for very dense/compact boards</li> +</ul> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +<b>GND</b> + + + + + + + + + + + + +<p>VBUS Supply Symbole</p> + + + + + + + + + + + + +<b>Fiducial Alignment Points</b> +<p>Various fiducial points for machine vision alignment.</p> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Generated from <b>Hiking Log FeatherWing.brd</b><p> +by exp-lbrs.ulp + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +>DRAWING_NAME +>LAST_DATE_TIME +>SHEET +Sheet: + +oddly +specific +objects +by joey castillo +cc-by-sa 4.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +LCD Glass + + + + + + + + + + +>NAME + + + + + + + + + + +>NAME + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + +<b>FRAME</b><p> +DIN A4, landscape with location and doc. field + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +<b>https://componentsearchengine.com</b><p> +<author>Created by SamacSys</author> + + +<b>FH19C-9S-0.5SH(10)-1</b><br> + + + + + + + + + + + + +>NAME +>VALUE + + + + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + + + + + + + + + + + + +<b>CONN FFC BOTTOM 9POS 0.50MM R/A</b><p> +Source: <a href="https://componentsearchengine.com/Datasheets/1/FH19C-9S-0.5SH(10).pdf"> Datasheet </a> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + +<b>SMA Surface Mount Diode</b> + + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + + + + + + + + + + + + + +>Name +>Value + + +<b>SOT23</b> - Reflow soldering + + + + + + + + + + + + +>NAME +>VALUE + + + + + +<b>SOT23</b> - Wave soldering + + + + + + + + + + +>NAME +>VALUE + + + + + +SOD-523 (0.8x1.2mm) + +<p>Source: http://www.rohm.com/products/databook/di/pdf/rb751s-40.pdf</p> + + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + + + + + + + + +>NAME +>VALUE + + + + + + + + + + + +>NAME +>VALUE + + + + + + + + + +>NAME +>VALUE + + + + + + +Low cost SMT crystals, no capacitors included +<p>http://www.ladyada.net/library/eagle</p> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +<b>Diode</b> +<p> +<b>SMADIODE</b> - SMA Surface Mount Package +<ul> +<li>20V 1A Schottky Diode Digikey: 641-1014-6-ND</li> +</ul> +<b>DO-1N4148</b> - Through Hole Small Current Diode<br> +<b>SOD-123</b> +<ul> +<li>20V 1 A (.5mV Vf) Schottky Diode - Digikey: MBRX120TPMSCT-ND</li> +</ul> +<b>SOD-323</b> +<ul> +<li>10V 570mA (.38mV Vf, 3ns) Schottky Diode - Digikey: ZLLS410CT-ND</li> +</ul> +<b>SOD-523</b> +<ul> +<li>30V 30mA Schottky Diode (RB751S-40TE61) - Digikey: RB751S-40TE61CT-ND</li> +</ul> +<b>SOT23-R/W</b> - SOT23 Package (R = Solder Paste/Reflow Ovens, W = Hand-Soldering) +<ul> +<li>BAT54Film 40V 300mA - Digikey: 497-7162-1-ND</li> +</ul> +</p> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Generated from <b>Adafruit 3.5in 480x320 FeatherWing.sch</b><p> +by exp-lbrs.ulp + + +Inductor - 1007 (2518 Metric) +<p>L: 2.5mm x W: 1.8mm x H: 1.8mm</p> + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + + + + + + + + + + +>NAME +>VALUE + + +0603 (1608 Metric) + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + + + + + + + + + + + +>NAME +>VALUE + + +0805 (2012 Metric) + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + + + + + + +>NAME +>VALUE + + +<p>Source: http://www.sumida.com/products/pdf/CDRH5D28,5D28R,5D28RHP.pdf</p> + + + + + + + + + + + + + +>NAME +>VALUE + + + + + + + + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + + + + + +>NAME +>VALUE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + + + + + + + + + + +>NAME +>VALUE + + + + + + + + + + + + + + + + +>NAME +>VALUE + + +<b>Source: </b> http://www.tdk.co.jp/tefe02/e531_slf6045.pdf + + + + + + + + + + + + +>NAME +>VALUE + + +<b>Source: http://www.tdk.co.jp/tefe02/e531_vlc5045.pdf</b> + + + + + + + + + + + +>NAME +>VALUE + + + + + + + + + + + + + +>NAME +>VALUE + + +<b>Source: </b>http://www.tdk.co.jp/tefe02/e531_vlc6045.pdf + + + + + + + + + + + +>NAME +>VALUE + + + + + + + + + + + + + + +>NAME +>VALUE + + +<b> 0402</b> + + + + + + + + + + + +>NAME +>VALUE + + +<b>0402 MicroPitch<p> + + + + + + + + +>NAME +>VALUE + + +<b>0603</b> + + + + + + + + + + + +>NAME +>VALUE + + +<b>0603 MicroPitch</b> + + + + + + + + +>NAME +>VALUE + + +<b>0805</b> + + + + + + + + + + + +>NAME +>VALUE + + +<b>0805 MicroPitch</b> + + + + + + + + +>NAME +>VALUE + + + + + + + + +>NAME +>VALUE + + + + + + + + + + + + +>NAME +>VALUE + + + + +<b>Inductors</b> +<p>0603:</p> +<ul> +<li>10nH Ceramic Inductor - microwire antenna/RF (Digikey: 712-1434-2-ND)</li> +</ul> +<p>0805:</p> +<ul> +<li>560nH Ceramic Inductor - RF (Digikey: 553-1047-1-ND)</li> +<li>270nH Ceramic Inductor - Q = 40@250MHz, +-5%, 1 Ohm DC Resistance (Digikey: 535-10506-2-ND)</li> +</ul> +<p>1007 (2518 Metric) SMT:</p> +<ul> +<li>10µH 10% 250mOhm 820mA 1007 Inductor (Digikey: 587-2189-1-ND)</li> +<li>22µH 10% 500mOhm 580mA 1007 Inductor (Digikey: 587-2190-1-ND)</li> +<li>47µH 10% 950mOhm 420mA 1007 Inductor (Digikey: 587-2191-1-ND)</li> +<li>47µH 5% 100mOhm 1A 1008 Inductor (Digikey: 732-1816-1-ND)</li> +</ul> +<p>5.0x5.0mm (Taiyo Yuden NR5040 Series)</p> +<ul> +<li>6.8µH 20% 2.3A 64mOhm Inductor (Digikey: 587-2374-2-ND)</li> +</ul> +<p>5.0x5.0mm (TDK VLC5045 Series)</p> +<ul> +<li>4.7µH 20% 3.3A 34mOhm Inductor (Digikey: 445-6526-1-ND)</li> +<li>6.8µH 20% 2.7A 46mOhm Inductor (Digikey: 445-6527-1-ND)</li> +</ul> +<p>6.0x6.0mm (TDK VLC6045 Series)</p> +<ul> +<li>4.7µH 20% 3.8A 27mOhm Inductor (Digikey: 445-6538-2-ND)</li> +<li>6.8µH 20% 3A 41mOhm Inductor (Digikey: 445-6540-1-ND)</li> +<li>6.2µH 30% 2.2A 45mOhm Inductor (Digikey: SRR5028-6R2YCT-ND) - Not TDK VLC6045 but footprint should match</li> +</ul> +<p>6.0x6.0mm (TDK SLF6045 Series)</p> +<ul> +<li>6.8uH 30% 2A 33mOhm Inductor (Digikey: 445-4572-1-ND, Mouser: 810-SLF645T6R8N2R0PF)</li> +</ul> +<p>6.0x6.0mm (Sumida CDRH5D28 Series)</p> +<ul> +<li>6.2uH 30% 1.8A 45mOhm Inductor (Digikey: 308-1542-1-ND)</li> +</ul> + +<p>Taiyo Yuden NR3015T2R2M - 2.2uH 20% 1.5A (Digikey: 587-1648-2-ND, Mouser: 963-NR3015T2R2M) - Used with TI TPS62172</p> +<p>CoilCraft RFID Transponder Coil - MA5532-AE (For use with AS3935 Lightning Sensor)</p> + +<p>Taiyo Yuden NRH2412T2R2MNGH - 2.2uH 20% 1AA (Digikey: 587-3443-1-ND) - Used with TI LM3671</p> + +<p> +Vishay IHLP +<ul> +<li>1.0uH Molded Inductor - 24mOhm DCR, 5A, +/-20%, -55°C-125°C (Digikey: 541-1319-1-ND)</li> +</ul> +</p> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +<h3>SparkFun Power Symbols</h3> +This library contains power, ground, and voltage-supply symbols. +<br> +<br> +We've spent an enormous amount of time creating and checking these footprints and parts, but it is <b> the end user's responsibility</b> to ensure correctness and suitablity for a given componet or application. +<br> +<br>If you enjoy using this library, please buy one of our products at <a href=" www.sparkfun.com">SparkFun.com</a>. +<br> +<br> +<b>Licensing:</b> Creative Commons ShareAlike 4.0 International - https://creativecommons.org/licenses/by-sa/4.0/ +<br> +<br> +You are welcome to use this library for commercial purposes. For attribution, we ask that when you begin to sell your device using our footprint, you email us with a link to the product being sold. We want bragging rights that we helped (in a very small part) to create your 8th world wonder. We would like the opportunity to feature your device on our homepage. + + + + +<h3>VCC Voltage Supply</h3> + + + +>VALUE + + + + +<h3>VCC Voltage Supply</h3> +<p>Positive voltage supply (traditionally for a BJT device, C=collector).</p> + + + + + + + + + + + + + + +Generated from <b>Adafruit Feather M0 Express.sch</b><p> +by exp-lbrs.ulp + + +Surface Mount Test Point - Compact SMT + + + + + +>NAME +>VALUE + + + + +>NAME +>VALUE + + +1.5 x 2.0mm SMT pad (no solder paste) + + + + + +>NAME +>VALUE + + + + + + + +>NAME +>VALUE + + +Testpoint - Pad + + + + + +>NAME +>VALUE + + + +>NAME +>VALUE + + + + +>NAME +>VALUE + + + + +>NAME +>VALUE + + + + +>NAME +>VALUE + + +Testpoint - Round 2mm + + +>NAME +>VALUE + + + + + + +>NAME +>VALUE + + + + +<b>Test Point</b> +<p>Various test points for characterisation and PCB testing</p> +<p> +<ul> +<li><b>TESTPOINT_SMT</b> - Compact Surface Mount Test Point [Digikey: 5016KTR-ND]</li> +</ul> +</p> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + + + + + + + + + +Linear Voltage Regulator IC 1 Output 150mA SC-70-5 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +>Value +>Name + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +>Value +>Name + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +>Value +>Name + + + + + + + + + +>Name +>Value + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +2 of 2 +>Name +>Value + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +<b>Supply Symbols</b><p> + GND, VCC, 0V, +5V, -5V, etc.<p> + Please keep in mind, that these devices are necessary for the + automatic wiring of the supply signals.<p> + The pin name defined in the symbol is identical to the net which is to be wired automatically.<p> + In this library the device names are the same as the pin names of the symbols, therefore the correct signal names appear next to the supply symbols in the schematic.<p> + <author>Created by librarian@cadsoft.de</author> + + + + + + +>VALUE + + + + + +<b>SUPPLY SYMBOL</b> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + + + + + + + + + +>NAME +>VALUE + + + + + + + + + + + + + + +SWITCH TACTILE SPST-NO 0.02A 15V + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + + + + + + + + + + + + + + + + + + +>NAME +>VALUE + + + + + + + + + + +R + + + + + + + + + + + +>NAME +>VALUE + + + + + + + + + + +G + + + + + + +Green, Red 571nm Green, 631nm Red LED Indication - Discrete 2V Green, 2V Red 1206 (3216 Metric) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Based on: arm-watch by @gregdavill, GoodWatch by +@travisgoodspeed, and Pluto by Lukas K / carrotIndustries + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Since Version 6.2.2 text objects can contain more than one line, +which will not be processed correctly with this version. + + +Since Version 8.2, EAGLE supports online libraries. The ids +of those online libraries will not be understood (or retained) +with this version. + + +Since Version 8.3, EAGLE supports URNs for individual library +assets (packages, symbols, and devices). The URNs of those assets +will not be understood (or retained) with this version. + + + From 5a6bf6bfe24c4631a02e53b06f352b654b147dba Mon Sep 17 00:00:00 2001 From: Joey Castillo Date: Fri, 3 Dec 2021 19:06:25 -0500 Subject: [PATCH 3/6] movement: remove testing watch face from config --- movement/movement_config.h | 1 - 1 file changed, 1 deletion(-) diff --git a/movement/movement_config.h b/movement/movement_config.h index b6b3c350..2ef43ef0 100644 --- a/movement/movement_config.h +++ b/movement/movement_config.h @@ -18,7 +18,6 @@ const watch_face_t watch_faces[] = { simple_clock_face, - character_set_face, preferences_face, set_time_face, }; From bbd394a19aaa334a179c36cf2ed2a066f1bb312c Mon Sep 17 00:00:00 2001 From: Joey Castillo Date: Fri, 3 Dec 2021 19:42:16 -0500 Subject: [PATCH 4/6] use true random number generator to provide entropy --- watch-library/watch/watch_private.c | 32 +++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/watch-library/watch/watch_private.c b/watch-library/watch/watch_private.c index 270208dc..e652b271 100644 --- a/watch-library/watch/watch_private.c +++ b/watch-library/watch/watch_private.c @@ -65,6 +65,38 @@ void _watch_init() { a4_callback = NULL; } +static inline void _watch_wait_for_entropy() { + while (!hri_trng_get_INTFLAG_reg(TRNG, TRNG_INTFLAG_DATARDY)); +} + +// this function is called by arc4random to get entropy for random number generation. +// let's use the SAM L22's true random number generator to seed the PRNG! +int getentropy(void *buf, size_t buflen) { + hri_mclk_set_APBCMASK_TRNG_bit(MCLK); + hri_trng_set_CTRLA_ENABLE_bit(TRNG); + + size_t i = 0; + while(i < buflen / 4) { + _watch_wait_for_entropy(); + ((uint32_t *)buf)[i++] = hri_trng_read_DATA_reg(TRNG); + } + + // but what if they asked for an awkward number of bytes? + if (buflen % 4) { + // all good: let's fill in one, two or three bytes at the end of the buffer. + _watch_wait_for_entropy(); + uint32_t last_little_bit = hri_trng_read_DATA_reg(TRNG); + for(size_t j = 0; j <= (buflen % 4); j++) { + ((uint8_t *)buf)[i * 4 + j] = (last_little_bit >> (j * 8)) & 0xFF; + } + } + + hri_trng_clear_CTRLA_ENABLE_bit(TRNG); + hri_mclk_clear_APBCMASK_TRNG_bit(MCLK); + + return 0; +} + void _watch_enable_tcc() { // clock TCC0 with the main clock (8 MHz) and enable the peripheral clock. hri_gclk_write_PCHCTRL_reg(GCLK, TCC0_GCLK_ID, GCLK_PCHCTRL_GEN_GCLK0_Val | GCLK_PCHCTRL_CHEN); From eb66b67e8ea37f841105c31243c641a7382465d2 Mon Sep 17 00:00:00 2001 From: Joey Castillo Date: Sun, 5 Dec 2021 16:24:17 -0600 Subject: [PATCH 5/6] more accelerometer tests: track interrupts on each axis, log on the quarter hour --- .../watch_faces/demos/lis2dh_logging_face.c | 138 +++++++++++------- .../watch_faces/demos/lis2dh_logging_face.h | 11 +- 2 files changed, 96 insertions(+), 53 deletions(-) diff --git a/movement/watch_faces/demos/lis2dh_logging_face.c b/movement/watch_faces/demos/lis2dh_logging_face.c index 0e4383cd..12387a0b 100644 --- a/movement/watch_faces/demos/lis2dh_logging_face.c +++ b/movement/watch_faces/demos/lis2dh_logging_face.c @@ -12,14 +12,78 @@ // Pressing the alarm button enters the log mode, where the main display shows the number of interrupts detected in each of the last // 24 hours (the hour is shown in the top right digit and AM/PM indicator, if the clock is set to 12 hour mode) +void _lis2dh_logging_face_update_display(movement_settings_t *settings, lis2dh_logger_state_t *logger_state, lis2dh_interrupt_state interrupt_state, watch_date_time date_time) { + char buf[14]; + char time_indication_character; + int8_t pos; + + if (logger_state->log_ticks) { + pos = (logger_state->data_points - 1 - logger_state->display_index) % LIS2DH_LOGGING_NUM_DATA_POINTS; + if (pos < 0) { + watch_clear_colon(); + sprintf(buf, "NO data "); + } else { + date_time = logger_state->data[pos].timestamp; + watch_set_colon(); + if (settings->bit.clock_mode_24h) { + watch_set_indicator(WATCH_INDICATOR_24H); + } else { + if (date_time.unit.hour > 11) watch_set_indicator(WATCH_INDICATOR_PM); + date_time.unit.hour %= 12; + if (date_time.unit.hour == 0) date_time.unit.hour = 12; + } + switch (logger_state->axis_index) { + case 0: + sprintf(buf, "3A%2d%02d%4ld", date_time.unit.hour, date_time.unit.minute, logger_state->data[pos].x_interrupts + logger_state->data[pos].y_interrupts + logger_state->data[pos].z_interrupts); + break; + case 1: + sprintf(buf, "XA%2d%02d%4ld", date_time.unit.hour, date_time.unit.minute, logger_state->data[pos].x_interrupts); + break; + case 2: + sprintf(buf, "YA%2d%02d%4ld", date_time.unit.hour, date_time.unit.minute, logger_state->data[pos].y_interrupts); + break; + case 3: + sprintf(buf, "ZA%2d%02d%4ld", date_time.unit.hour, date_time.unit.minute, logger_state->data[pos].z_interrupts); + break; + } + } + } else { + date_time = watch_rtc_get_date_time(); + watch_clear_colon(); + watch_clear_indicator(WATCH_INDICATOR_PM); + watch_clear_indicator(WATCH_INDICATOR_24H); + if ((59 - date_time.unit.second) < 10) time_indication_character = '0' + (59 - date_time.unit.second); + else time_indication_character = (date_time.unit.second % 2) ? 'i' : '_'; + sprintf(buf, "%c%c%c%c%2d%2d%2d", + (interrupt_state & LIS2DH_INTERRUPT_STATE_Y_HIGH) ? 'Y' : ' ', + (interrupt_state & LIS2DH_INTERRUPT_STATE_X_HIGH) ? 'X' : ' ', + (interrupt_state & LIS2DH_INTERRUPT_STATE_Z_HIGH) ? 'Z' : ' ', + time_indication_character, + logger_state->interrupts[0], + logger_state->interrupts[1], + logger_state->interrupts[2]); + } + watch_display_string(buf, 0); +} + void _lis2dh_logging_face_log_data(lis2dh_logger_state_t *logger_state) { watch_date_time date_time = watch_rtc_get_date_time(); - date_time.unit.hour = (date_time.unit.hour + 23) % 24; // log this as the number of events in the previous hour + // we get this call 15 minutes late; i.e. at 6:15 we're logging events for 6:00. + // so: if we're at the top of the hour, roll the hour back too (7:00 task logs data for 6:45) + if (date_time.unit.minute == 0) date_time.unit.hour = (date_time.unit.hour + 23) % 24; + + // // then roll the minute back. + date_time.unit.minute = (date_time.unit.minute + 45) % 60; + size_t pos = logger_state->data_points % LIS2DH_LOGGING_NUM_DATA_POINTS; logger_state->data[pos].timestamp.reg = date_time.reg; - logger_state->data[pos].interrupts = logger_state->interrupts_this_hour; + logger_state->data[pos].x_interrupts = logger_state->x_interrupts_this_hour; + logger_state->data[pos].y_interrupts = logger_state->y_interrupts_this_hour; + logger_state->data[pos].z_interrupts = logger_state->z_interrupts_this_hour; logger_state->data_points++; - logger_state->interrupts_this_hour = 0; + logger_state->x_interrupts_this_hour = 0; + logger_state->y_interrupts_this_hour = 0; + logger_state->z_interrupts_this_hour = 0; } void lis2dh_logging_face_setup(movement_settings_t *settings, void ** context_ptr) { @@ -49,74 +113,47 @@ void lis2dh_logging_face_activate(movement_settings_t *settings, void *context) watch_enable_digital_input(A1); } -bool tick = false; - bool lis2dh_logging_face_loop(movement_event_t event, movement_settings_t *settings, void *context) { lis2dh_logger_state_t *logger_state = (lis2dh_logger_state_t *)context; lis2dh_interrupt_state interrupt_state = 0; watch_date_time date_time; - char buf[14]; - char time_indication_character; - int8_t pos; switch (event.event_type) { case EVENT_MODE_BUTTON_UP: movement_move_to_next_face(); break; case EVENT_LIGHT_LONG_PRESS: + movement_illuminate_led(); break; case EVENT_LIGHT_BUTTON_DOWN: + logger_state->axis_index = (logger_state->axis_index + 1) % 4; + logger_state->log_ticks = 255; + _lis2dh_logging_face_update_display(settings, logger_state, interrupt_state, date_time); break; case EVENT_ALARM_BUTTON_UP: - if (logger_state->log_ticks) { - logger_state->display_index = (logger_state->display_index + 1) % LIS2DH_LOGGING_NUM_DATA_POINTS; - } - logger_state->log_ticks = 60; - // fall through + if (logger_state->log_ticks) logger_state->display_index = (logger_state->display_index + 1) % LIS2DH_LOGGING_NUM_DATA_POINTS; + logger_state->log_ticks = 255; + logger_state->axis_index = 0; + _lis2dh_logging_face_update_display(settings, logger_state, interrupt_state, date_time); + break; case EVENT_ACTIVATE: case EVENT_TICK: - tick = !tick; + if (logger_state->log_ticks > 0) { + logger_state->log_ticks--; + } else { + logger_state->display_index = 0; + } if (watch_get_pin_level(A1)) { watch_set_indicator(WATCH_INDICATOR_SIGNAL); interrupt_state = lis2dh_get_int1_state(); logger_state->interrupts[0]++; - logger_state->interrupts_this_hour++; + if (interrupt_state & LIS2DH_INTERRUPT_STATE_X_HIGH) logger_state->x_interrupts_this_hour++; + if (interrupt_state & LIS2DH_INTERRUPT_STATE_Y_HIGH) logger_state->y_interrupts_this_hour++; + if (interrupt_state & LIS2DH_INTERRUPT_STATE_Z_HIGH) logger_state->z_interrupts_this_hour++; } else { watch_clear_indicator(WATCH_INDICATOR_SIGNAL); } - if (logger_state->log_ticks) { - pos = (logger_state->data_points - 1 - logger_state->display_index) % LIS2DH_LOGGING_NUM_DATA_POINTS; - if (pos < 0) { - watch_clear_colon(); - sprintf(buf, "NO data "); - } else { - date_time = logger_state->data[pos].timestamp; - watch_set_colon(); - if (settings->bit.clock_mode_24h) { - watch_set_indicator(WATCH_INDICATOR_24H); - } else { - if (date_time.unit.hour > 11) watch_set_indicator(WATCH_INDICATOR_PM); - date_time.unit.hour %= 12; - if (date_time.unit.hour == 0) date_time.unit.hour = 12; - } - sprintf(buf, "AT%2d1n%4ld", date_time.unit.hour, logger_state->data[pos].interrupts); - } - } else { - date_time = watch_rtc_get_date_time(); - watch_clear_colon(); - if ((59 - date_time.unit.second) < 10) time_indication_character = '0' + (59 - date_time.unit.second); - else time_indication_character = (date_time.unit.second % 2) ? 'i' : '_'; - sprintf(buf, "%c%c%c%c%2d%2d%2d", - (interrupt_state & LIS2DH_INTERRUPT_STATE_Y_HIGH) ? 'Y' : ' ', - (interrupt_state & LIS2DH_INTERRUPT_STATE_X_HIGH) ? 'X' : ' ', - (interrupt_state & LIS2DH_INTERRUPT_STATE_Z_HIGH) ? '2' : ' ', - time_indication_character, - logger_state->interrupts[0], - logger_state->interrupts[1], - logger_state->interrupts[2]); - } - - watch_display_string(buf, 0); + _lis2dh_logging_face_update_display(settings, logger_state, interrupt_state, date_time); break; case EVENT_BACKGROUND_TASK: _lis2dh_logging_face_log_data(logger_state); @@ -137,12 +174,13 @@ void lis2dh_logging_face_resign(movement_settings_t *settings, void *context) { bool lis2dh_logging_face_wants_background_task(movement_settings_t *settings, void *context) { (void) settings; lis2dh_logger_state_t *logger_state = (lis2dh_logger_state_t *)context; + watch_date_time date_time = watch_rtc_get_date_time(); // this is kind of an abuse of the API, but, let's use the 1 minute tick to shift all our data over. logger_state->interrupts[2] = logger_state->interrupts[1]; logger_state->interrupts[1] = logger_state->interrupts[0]; logger_state->interrupts[0] = 0; - // and do our logging task at the top of the hour - return watch_rtc_get_date_time().unit.minute == 0; + // and do our logging task every 15 minutes + return (date_time.unit.minute % 15) == 0; } diff --git a/movement/watch_faces/demos/lis2dh_logging_face.h b/movement/watch_faces/demos/lis2dh_logging_face.h index d8ab0e24..b0faeca5 100644 --- a/movement/watch_faces/demos/lis2dh_logging_face.h +++ b/movement/watch_faces/demos/lis2dh_logging_face.h @@ -4,19 +4,24 @@ #include "movement.h" #include "watch.h" -#define LIS2DH_LOGGING_NUM_DATA_POINTS (24) +#define LIS2DH_LOGGING_NUM_DATA_POINTS (96) typedef struct { watch_date_time timestamp; - uint32_t interrupts; + uint32_t x_interrupts; + uint32_t y_interrupts; + uint32_t z_interrupts; } lis2dh_logger_data_point_t; typedef struct { uint8_t display_index; // the index we are displaying on screen + uint8_t axis_index; // the index we are displaying on screen uint8_t log_ticks; // when the user taps the ALARM button, we enter log mode int32_t data_points; // the absolute number of data points logged uint8_t interrupts[3]; // the number of interrupts we have logged in each of the last 3 minutes - uint32_t interrupts_this_hour; // the number of interrupts we have logged in the last hour + uint32_t x_interrupts_this_hour; // the number of interrupts we have logged in the last hour + uint32_t y_interrupts_this_hour; // the number of interrupts we have logged in the last hour + uint32_t z_interrupts_this_hour; // the number of interrupts we have logged in the last hour lis2dh_logger_data_point_t data[LIS2DH_LOGGING_NUM_DATA_POINTS]; } lis2dh_logger_state_t; From c5400e437f919843e0235ed66f7840fd3ddf6ea0 Mon Sep 17 00:00:00 2001 From: Joey Castillo Date: Sun, 5 Dec 2021 22:56:09 -0600 Subject: [PATCH 6/6] ensure accelerometer test face always stays active --- movement/watch_faces/demos/lis2dh_logging_face.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/movement/watch_faces/demos/lis2dh_logging_face.c b/movement/watch_faces/demos/lis2dh_logging_face.c index 12387a0b..af82a004 100644 --- a/movement/watch_faces/demos/lis2dh_logging_face.c +++ b/movement/watch_faces/demos/lis2dh_logging_face.c @@ -106,8 +106,12 @@ void lis2dh_logging_face_setup(movement_settings_t *settings, void ** context_pt } void lis2dh_logging_face_activate(movement_settings_t *settings, void *context) { - (void) settings; lis2dh_logger_state_t *logger_state = (lis2dh_logger_state_t *)context; + // force two settings: never enter low energy mode, and always snap back to screen 0. + // this assumes the accelerometer face is first in the watch_faces list. + settings->bit.le_interval = 0; + settings->bit.to_always = true; + logger_state->display_index = 0; logger_state->log_ticks = 0; watch_enable_digital_input(A1);