Browse Source

Added README

master
Adam PIppin 3 years ago
parent
commit
ae9c19b0dd
  1. 115
      README.md

115
README.md

@ -0,0 +1,115 @@
# watchos
A simple framework for developing on the [Sqfmi Watchy](https://watchy.sqfmi.com/).
The goal is to allow more succinct, modular code such that:
* components developed separately can be more easily composed in a single program
* programs can be developed more easily without as much deep technical knowledge of the hardware
It is a work in progress.
# Features
* Power management system to extend battery life
* Event system for decoupled tasks/modules
* Basic memory management of core objects
* Task coordination and persistent storage
# Components
## Kernel
The kernel is the core of watchos. It handles memory management and coordinating modules, tasks, events, and other
key components.
### Event System
Tasks can subscribe to specific classes of events published by modules to receive events from the rest of the
system through a well-defined interface.
### Memory Management
Objects can be registered with the kernel to provide reference counting and collection.
## Input
The input system abstracts away the hardware inputs and integrates them into the event system while providing basic
functionality like debouncing.
## Power
The power system monitors for input events and, when the system is idle, automatically puts the system into light and
deep sleep, coordinating with all tasks to preserve state.
## RTC
The RTC system configures the Watchy's real time clock and provides an interface for fetching data from it, as well
as generating events when the time changes.
## Storage
The storage system provides a unified interface to different classes of storage, providing persistence for data
during sleeps and reboots.
---
NOTE: This is not fully implemented yet. The storage module currently only provides an interface to RTC RAM. The
plan is to allow specifying and automatically managing other storage classes such as flash storage.
---
## UI
The UI system provides an interface to register windows which are then automatically laid out according to a few
simple layout modes. The UI system provides a abstract interface to the underlying GFX library.
# Arduino IDE
Development is primarily done with Visual Studio and the [Visual Micro](https://www.visualmicro.com/) extension. I do
try and make sure not to use any Visual Studio-specific features and occassionally attempt to compile it with the
Arduino IDE.
However, watchos does make use of the run time type information which is disabled by default in the ESP32 package
installed through the board manager in the Arduino IDE.
---
*You cannot compile this project with the Arduino IDE unless you enable RTTI per the instructions below.*
---
## Enabling RTTI
Locate the hardware folder for your installation, generally on Windows somewhere like:
%LOCALAPPDATA%\arduino15\packages\esp32\hardware\esp32\
Go into the versioned folder under that path. You should see, among other things, a file called `platform.txt`.
Create a new file called `platform.local.txt` with the contents:
```
compiler.cpp.flags=-std=gnu++11 -Os -g3 -Wpointer-arith -fexceptions -fstack-protector -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -mlongcalls -nostdlib {compiler.warning_flags} -Wno-error=maybe-uninitialized -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-unused-but-set-parameter -Wno-missing-field-initializers -Wno-sign-compare -MMD -c
```
(Note: This is simply the existing cpp.flags setting from `platform.txt` with the `-fno-rtti` flag removed. It may be worthwhile to copy the flags from `platform.txt` and remove that rather than using the above in case you're using a different version of the board package.)
## Caveat
Arduino IDE provides no way to adjust these settings on a per-project basis, so this will enable RTTI for _all_ programs you compile for the ESP32 platform.
This should generally have a very negligable impact, but will _slightly_ increase memory usage at runtime.
One day when I actually C++ I'll look at getting rid of the need for RTTI.
# License
[GPLv3](https://www.gnu.org/licenses/gpl-3.0.txt)
watchos: platform for Sqfmi's Watchy
Copyright (C) 2021 Adam Pippin
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License version 3 as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
Loading…
Cancel
Save