documentation!
This commit is contained in:
parent
fb249f9b48
commit
4e0f249bd2
384
Doxyfile
Normal file
384
Doxyfile
Normal file
@ -0,0 +1,384 @@
|
||||
# Doxyfile 1.9.1
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Project related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
DOXYFILE_ENCODING = UTF-8
|
||||
PROJECT_NAME = "Sensor Watch"
|
||||
PROJECT_NUMBER = "0.0.0"
|
||||
PROJECT_BRIEF = "A board replacement for the classic Casio F-91W wristwatch, powered by a Microchip SAM L22 microcontroller."
|
||||
PROJECT_LOGO =
|
||||
OUTPUT_DIRECTORY = "../Sensor-Watch-Documentation"
|
||||
CREATE_SUBDIRS = NO
|
||||
ALLOW_UNICODE_NAMES = NO
|
||||
OUTPUT_LANGUAGE = English
|
||||
OUTPUT_TEXT_DIRECTION = None
|
||||
BRIEF_MEMBER_DESC = YES
|
||||
REPEAT_BRIEF = YES
|
||||
ABBREVIATE_BRIEF = "The $name class" \
|
||||
"The $name widget" \
|
||||
"The $name file" \
|
||||
is \
|
||||
provides \
|
||||
specifies \
|
||||
contains \
|
||||
represents \
|
||||
a \
|
||||
an \
|
||||
the
|
||||
ALWAYS_DETAILED_SEC = NO
|
||||
INLINE_INHERITED_MEMB = NO
|
||||
FULL_PATH_NAMES = YES
|
||||
STRIP_FROM_PATH =
|
||||
STRIP_FROM_INC_PATH =
|
||||
SHORT_NAMES = NO
|
||||
JAVADOC_AUTOBRIEF = NO
|
||||
JAVADOC_BANNER = NO
|
||||
QT_AUTOBRIEF = NO
|
||||
MULTILINE_CPP_IS_BRIEF = NO
|
||||
PYTHON_DOCSTRING = YES
|
||||
INHERIT_DOCS = YES
|
||||
SEPARATE_MEMBER_PAGES = NO
|
||||
TAB_SIZE = 4
|
||||
ALIASES =
|
||||
OPTIMIZE_OUTPUT_FOR_C = YES
|
||||
OPTIMIZE_OUTPUT_JAVA = NO
|
||||
OPTIMIZE_FOR_FORTRAN = NO
|
||||
OPTIMIZE_OUTPUT_VHDL = NO
|
||||
OPTIMIZE_OUTPUT_SLICE = NO
|
||||
EXTENSION_MAPPING =
|
||||
MARKDOWN_SUPPORT = YES
|
||||
TOC_INCLUDE_HEADINGS = 5
|
||||
AUTOLINK_SUPPORT = YES
|
||||
BUILTIN_STL_SUPPORT = NO
|
||||
CPP_CLI_SUPPORT = NO
|
||||
SIP_SUPPORT = NO
|
||||
IDL_PROPERTY_SUPPORT = YES
|
||||
DISTRIBUTE_GROUP_DOC = YES
|
||||
GROUP_NESTED_COMPOUNDS = NO
|
||||
SUBGROUPING = YES
|
||||
INLINE_GROUPED_CLASSES = NO
|
||||
INLINE_SIMPLE_STRUCTS = NO
|
||||
TYPEDEF_HIDES_STRUCT = NO
|
||||
LOOKUP_CACHE_SIZE = 0
|
||||
NUM_PROC_THREADS = 1
|
||||
#---------------------------------------------------------------------------
|
||||
# Build related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
EXTRACT_ALL = NO
|
||||
EXTRACT_PRIVATE = NO
|
||||
EXTRACT_PRIV_VIRTUAL = NO
|
||||
EXTRACT_PACKAGE = NO
|
||||
EXTRACT_STATIC = NO
|
||||
EXTRACT_LOCAL_CLASSES = YES
|
||||
EXTRACT_LOCAL_METHODS = NO
|
||||
EXTRACT_ANON_NSPACES = NO
|
||||
RESOLVE_UNNAMED_PARAMS = YES
|
||||
HIDE_UNDOC_MEMBERS = NO
|
||||
HIDE_UNDOC_CLASSES = NO
|
||||
HIDE_FRIEND_COMPOUNDS = NO
|
||||
HIDE_IN_BODY_DOCS = NO
|
||||
INTERNAL_DOCS = NO
|
||||
CASE_SENSE_NAMES = NO
|
||||
HIDE_SCOPE_NAMES = NO
|
||||
HIDE_COMPOUND_REFERENCE= NO
|
||||
SHOW_INCLUDE_FILES = YES
|
||||
SHOW_GROUPED_MEMB_INC = NO
|
||||
FORCE_LOCAL_INCLUDES = NO
|
||||
INLINE_INFO = YES
|
||||
SORT_MEMBER_DOCS = YES
|
||||
SORT_BRIEF_DOCS = NO
|
||||
SORT_MEMBERS_CTORS_1ST = NO
|
||||
SORT_GROUP_NAMES = NO
|
||||
SORT_BY_SCOPE_NAME = NO
|
||||
STRICT_PROTO_MATCHING = NO
|
||||
GENERATE_TODOLIST = YES
|
||||
GENERATE_TESTLIST = YES
|
||||
GENERATE_BUGLIST = YES
|
||||
GENERATE_DEPRECATEDLIST= YES
|
||||
ENABLED_SECTIONS =
|
||||
MAX_INITIALIZER_LINES = 30
|
||||
SHOW_USED_FILES = YES
|
||||
SHOW_FILES = YES
|
||||
SHOW_NAMESPACES = YES
|
||||
FILE_VERSION_FILTER =
|
||||
LAYOUT_FILE =
|
||||
CITE_BIB_FILES =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to warning and progress messages
|
||||
#---------------------------------------------------------------------------
|
||||
QUIET = NO
|
||||
WARNINGS = YES
|
||||
WARN_IF_UNDOCUMENTED = YES
|
||||
WARN_IF_DOC_ERROR = YES
|
||||
WARN_NO_PARAMDOC = NO
|
||||
WARN_AS_ERROR = NO
|
||||
WARN_FORMAT = "$file:$line: $text"
|
||||
WARN_LOGFILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the input files
|
||||
#---------------------------------------------------------------------------
|
||||
INPUT = ./watch-library/watch
|
||||
INPUT_ENCODING = UTF-8
|
||||
FILE_PATTERNS = *.c \
|
||||
*.cc \
|
||||
*.cxx \
|
||||
*.cpp \
|
||||
*.c++ \
|
||||
*.java \
|
||||
*.ii \
|
||||
*.ixx \
|
||||
*.ipp \
|
||||
*.i++ \
|
||||
*.inl \
|
||||
*.idl \
|
||||
*.ddl \
|
||||
*.odl \
|
||||
*.h \
|
||||
*.hh \
|
||||
*.hxx \
|
||||
*.hpp \
|
||||
*.h++ \
|
||||
*.cs \
|
||||
*.d \
|
||||
*.php \
|
||||
*.php4 \
|
||||
*.php5 \
|
||||
*.phtml \
|
||||
*.inc \
|
||||
*.m \
|
||||
*.markdown \
|
||||
*.md \
|
||||
*.mm \
|
||||
*.dox \
|
||||
*.py \
|
||||
*.pyw \
|
||||
*.f90 \
|
||||
*.f95 \
|
||||
*.f03 \
|
||||
*.f08 \
|
||||
*.f18 \
|
||||
*.f \
|
||||
*.for \
|
||||
*.vhd \
|
||||
*.vhdl \
|
||||
*.ucf \
|
||||
*.qsf \
|
||||
*.ice
|
||||
RECURSIVE = YES
|
||||
EXCLUDE =
|
||||
EXCLUDE_SYMLINKS = NO
|
||||
EXCLUDE_PATTERNS =
|
||||
EXCLUDE_SYMBOLS =
|
||||
EXAMPLE_PATH =
|
||||
EXAMPLE_PATTERNS = *
|
||||
EXAMPLE_RECURSIVE = NO
|
||||
IMAGE_PATH =
|
||||
INPUT_FILTER =
|
||||
FILTER_PATTERNS =
|
||||
FILTER_SOURCE_FILES = NO
|
||||
FILTER_SOURCE_PATTERNS =
|
||||
USE_MDFILE_AS_MAINPAGE =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to source browsing
|
||||
#---------------------------------------------------------------------------
|
||||
SOURCE_BROWSER = NO
|
||||
INLINE_SOURCES = NO
|
||||
STRIP_CODE_COMMENTS = YES
|
||||
REFERENCED_BY_RELATION = NO
|
||||
REFERENCES_RELATION = NO
|
||||
REFERENCES_LINK_SOURCE = YES
|
||||
SOURCE_TOOLTIPS = YES
|
||||
USE_HTAGS = NO
|
||||
VERBATIM_HEADERS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the alphabetical class index
|
||||
#---------------------------------------------------------------------------
|
||||
ALPHABETICAL_INDEX = YES
|
||||
IGNORE_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the HTML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_HTML = YES
|
||||
HTML_OUTPUT = docs
|
||||
HTML_FILE_EXTENSION = .html
|
||||
HTML_HEADER =
|
||||
HTML_FOOTER =
|
||||
HTML_STYLESHEET =
|
||||
HTML_EXTRA_STYLESHEET =
|
||||
HTML_EXTRA_FILES =
|
||||
HTML_COLORSTYLE_HUE = 220
|
||||
HTML_COLORSTYLE_SAT = 100
|
||||
HTML_COLORSTYLE_GAMMA = 80
|
||||
HTML_TIMESTAMP = NO
|
||||
HTML_DYNAMIC_MENUS = YES
|
||||
HTML_DYNAMIC_SECTIONS = NO
|
||||
HTML_INDEX_NUM_ENTRIES = 100
|
||||
GENERATE_DOCSET = NO
|
||||
DOCSET_FEEDNAME = "Doxygen generated docs"
|
||||
DOCSET_BUNDLE_ID = org.doxygen.Project
|
||||
DOCSET_PUBLISHER_ID = org.doxygen.Publisher
|
||||
DOCSET_PUBLISHER_NAME = Publisher
|
||||
GENERATE_HTMLHELP = NO
|
||||
CHM_FILE =
|
||||
HHC_LOCATION =
|
||||
GENERATE_CHI = NO
|
||||
CHM_INDEX_ENCODING =
|
||||
BINARY_TOC = NO
|
||||
TOC_EXPAND = NO
|
||||
GENERATE_QHP = NO
|
||||
QCH_FILE =
|
||||
QHP_NAMESPACE = org.doxygen.Project
|
||||
QHP_VIRTUAL_FOLDER = doc
|
||||
QHP_CUST_FILTER_NAME =
|
||||
QHP_CUST_FILTER_ATTRS =
|
||||
QHP_SECT_FILTER_ATTRS =
|
||||
QHG_LOCATION =
|
||||
GENERATE_ECLIPSEHELP = NO
|
||||
ECLIPSE_DOC_ID = org.doxygen.Project
|
||||
DISABLE_INDEX = NO
|
||||
GENERATE_TREEVIEW = NO
|
||||
ENUM_VALUES_PER_LINE = 4
|
||||
TREEVIEW_WIDTH = 250
|
||||
EXT_LINKS_IN_WINDOW = NO
|
||||
HTML_FORMULA_FORMAT = png
|
||||
FORMULA_FONTSIZE = 10
|
||||
FORMULA_TRANSPARENT = YES
|
||||
FORMULA_MACROFILE =
|
||||
USE_MATHJAX = NO
|
||||
MATHJAX_FORMAT = HTML-CSS
|
||||
MATHJAX_RELPATH = https://cdn.jsdelivr.net/npm/mathjax@2
|
||||
MATHJAX_EXTENSIONS =
|
||||
MATHJAX_CODEFILE =
|
||||
SEARCHENGINE = YES
|
||||
SERVER_BASED_SEARCH = NO
|
||||
EXTERNAL_SEARCH = NO
|
||||
SEARCHENGINE_URL =
|
||||
SEARCHDATA_FILE = searchdata.xml
|
||||
EXTERNAL_SEARCH_ID =
|
||||
EXTRA_SEARCH_MAPPINGS =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the LaTeX output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_LATEX = FALSE
|
||||
LATEX_OUTPUT = latex
|
||||
LATEX_CMD_NAME =
|
||||
MAKEINDEX_CMD_NAME = makeindex
|
||||
LATEX_MAKEINDEX_CMD = makeindex
|
||||
COMPACT_LATEX = NO
|
||||
PAPER_TYPE = a4
|
||||
EXTRA_PACKAGES =
|
||||
LATEX_HEADER =
|
||||
LATEX_FOOTER =
|
||||
LATEX_EXTRA_STYLESHEET =
|
||||
LATEX_EXTRA_FILES =
|
||||
PDF_HYPERLINKS = YES
|
||||
USE_PDFLATEX = YES
|
||||
LATEX_BATCHMODE = NO
|
||||
LATEX_HIDE_INDICES = NO
|
||||
LATEX_SOURCE_CODE = NO
|
||||
LATEX_BIB_STYLE = plain
|
||||
LATEX_TIMESTAMP = NO
|
||||
LATEX_EMOJI_DIRECTORY =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the RTF output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_RTF = NO
|
||||
RTF_OUTPUT = rtf
|
||||
COMPACT_RTF = NO
|
||||
RTF_HYPERLINKS = NO
|
||||
RTF_STYLESHEET_FILE =
|
||||
RTF_EXTENSIONS_FILE =
|
||||
RTF_SOURCE_CODE = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the man page output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_MAN = NO
|
||||
MAN_OUTPUT = man
|
||||
MAN_EXTENSION = .3
|
||||
MAN_SUBDIR =
|
||||
MAN_LINKS = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the XML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_XML = NO
|
||||
XML_OUTPUT = xml
|
||||
XML_PROGRAMLISTING = YES
|
||||
XML_NS_MEMB_FILE_SCOPE = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the DOCBOOK output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_DOCBOOK = NO
|
||||
DOCBOOK_OUTPUT = docbook
|
||||
DOCBOOK_PROGRAMLISTING = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options for the AutoGen Definitions output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_AUTOGEN_DEF = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the Perl module output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_PERLMOD = NO
|
||||
PERLMOD_LATEX = NO
|
||||
PERLMOD_PRETTY = YES
|
||||
PERLMOD_MAKEVAR_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the preprocessor
|
||||
#---------------------------------------------------------------------------
|
||||
ENABLE_PREPROCESSING = YES
|
||||
MACRO_EXPANSION = NO
|
||||
EXPAND_ONLY_PREDEF = NO
|
||||
SEARCH_INCLUDES = YES
|
||||
INCLUDE_PATH =
|
||||
INCLUDE_FILE_PATTERNS =
|
||||
PREDEFINED =
|
||||
EXPAND_AS_DEFINED =
|
||||
SKIP_FUNCTION_MACROS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to external references
|
||||
#---------------------------------------------------------------------------
|
||||
TAGFILES =
|
||||
GENERATE_TAGFILE =
|
||||
ALLEXTERNALS = NO
|
||||
EXTERNAL_GROUPS = YES
|
||||
EXTERNAL_PAGES = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the dot tool
|
||||
#---------------------------------------------------------------------------
|
||||
CLASS_DIAGRAMS = YES
|
||||
DIA_PATH =
|
||||
HIDE_UNDOC_RELATIONS = YES
|
||||
HAVE_DOT = NO
|
||||
DOT_NUM_THREADS = 0
|
||||
DOT_FONTNAME = Helvetica
|
||||
DOT_FONTSIZE = 10
|
||||
DOT_FONTPATH =
|
||||
CLASS_GRAPH = YES
|
||||
COLLABORATION_GRAPH = YES
|
||||
GROUP_GRAPHS = YES
|
||||
UML_LOOK = NO
|
||||
UML_LIMIT_NUM_FIELDS = 10
|
||||
DOT_UML_DETAILS = NO
|
||||
DOT_WRAP_THRESHOLD = 17
|
||||
TEMPLATE_RELATIONS = NO
|
||||
INCLUDE_GRAPH = YES
|
||||
INCLUDED_BY_GRAPH = YES
|
||||
CALL_GRAPH = NO
|
||||
CALLER_GRAPH = NO
|
||||
GRAPHICAL_HIERARCHY = YES
|
||||
DIRECTORY_GRAPH = YES
|
||||
DOT_IMAGE_FORMAT = png
|
||||
INTERACTIVE_SVG = NO
|
||||
DOT_PATH =
|
||||
DOTFILE_DIRS =
|
||||
MSCFILE_DIRS =
|
||||
DIAFILE_DIRS =
|
||||
PLANTUML_JAR_PATH =
|
||||
PLANTUML_CFG_FILE =
|
||||
PLANTUML_INCLUDE_PATH =
|
||||
DOT_GRAPH_MAX_NODES = 50
|
||||
MAX_DOT_GRAPH_DEPTH = 0
|
||||
DOT_TRANSPARENT = NO
|
||||
DOT_MULTI_TARGETS = NO
|
||||
GENERATE_LEGEND = YES
|
||||
DOT_CLEANUP = YES
|
@ -1,7 +1,6 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "watch.h"
|
||||
#include "app.h"
|
||||
#include "bme280.h"
|
||||
|
||||
typedef enum ApplicationMode {
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "watch.h"
|
||||
#include "app.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// This section sets up types and storage for our application state.
|
||||
|
@ -1,33 +0,0 @@
|
||||
/**
|
||||
* Header file for Sensor Watch application
|
||||
*
|
||||
* You should be able to write a watch app by simply implementing these functions
|
||||
* and declaring callbacks for various GPIO and peripheral interrupts. The main.c
|
||||
* file takes care of calling these functions for you. The general flow:
|
||||
*
|
||||
* 1. Your app_init() function is called.
|
||||
* - This method should only be used to set your initial application state.
|
||||
* 2. If your app is waking from BACKUP, app_wake_from_deep_sleep() is called.
|
||||
* - If you saved state in the RTC's backup registers, you can restore it here.
|
||||
* 3. Your app_setup() method is called.
|
||||
* - You may wish to enable some functionality and peripherals here.
|
||||
* - You should definitely set up some interrupts here.
|
||||
* 4. The main run loop begins: your app_loop() function is called.
|
||||
* - Run code and update your UI here.
|
||||
* - Return true if your app is prepared to enter STANDBY mode.
|
||||
* 5. This step differs depending on the value returned by app_loop:
|
||||
* - If you returned false, execution resumes at (4).
|
||||
* - If you returned true, app_prepare_for_sleep() is called; execution moves on to (6).
|
||||
* 6. The microcontroller enters the STANDBY sleep mode.
|
||||
* - No user code will run, and the watch will enter a low power mode.
|
||||
* - The watch will remain in this state until an interrupt wakes it.
|
||||
* 7. Once woken from STANDBY, your app_wake_from_sleep() function is called.
|
||||
* - After this, execution resumes at (4).
|
||||
*/
|
||||
|
||||
void app_init();
|
||||
void app_wake_from_deep_sleep();
|
||||
void app_setup();
|
||||
bool app_loop();
|
||||
void app_prepare_for_sleep();
|
||||
void app_wake_from_sleep();
|
@ -39,7 +39,6 @@
|
||||
#include "hal_gpio.h"
|
||||
#include "atmel_start_pins.h"
|
||||
#include "watch.h"
|
||||
#include "app.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
HAL_GPIO_PIN(UART_TX, B, 0)
|
||||
@ -101,7 +100,7 @@ int main(void) {
|
||||
}
|
||||
|
||||
// Watch library code. Set initial parameters for the device and enable the RTC.
|
||||
watch_init();
|
||||
_watch_init();
|
||||
|
||||
// User code. Give the app a chance to enable and set up peripherals.
|
||||
app_setup();
|
||||
|
@ -4,7 +4,7 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Initialization
|
||||
|
||||
void watch_init() {
|
||||
void _watch_init() {
|
||||
// Use switching regulator for lower power consumption.
|
||||
SUPC->VREG.bit.SEL = 1;
|
||||
while(!SUPC->STATUS.bit.VREGRDY);
|
||||
|
@ -1,3 +1,5 @@
|
||||
/// @file watch.h
|
||||
|
||||
#ifndef WATCH_H_
|
||||
#define WATCH_H_
|
||||
#include <stdint.h>
|
||||
@ -5,54 +7,378 @@
|
||||
#include "hpl_calendar.h"
|
||||
#include "hal_ext_irq.h"
|
||||
|
||||
void watch_init();
|
||||
/** @mainpage Sensor Watch Documentation
|
||||
* @brief This documentation covers most of the functions you will use to interact with the Sensor Watch
|
||||
hardware. It is divided into the following sections:
|
||||
- @ref app - This section covers the functions that you will implement in your app.c file when designing a
|
||||
Sensor Watch app.
|
||||
- @ref slcd - This section covers functions related to the Segment LCD display driver, which is responsible
|
||||
for displaying strings of characters and indicators on the main watch display.
|
||||
- @ref led - This section covers functions related to the bi-color red/green LED mounted behind the LCD.
|
||||
- @ref rtc - This section covers functions related to the SAM L22's real-time clock peripheral, including
|
||||
date, time and alarm functions.
|
||||
- @ref adc - This section covers functions related to the SAM L22's analog-to-digital converter, as well as
|
||||
configuring and reading values from the three analog-capable pins on the 9-pin connector.
|
||||
- @ref buttons - This section covers functions related to the three buttons: Light, Mode and Alarm.
|
||||
- @ref gpio - This section covers functions related to general-purpose input and output signals.
|
||||
- @ref i2c - This section covers functions related to the SAM L22's built-I2C driver, including configuring
|
||||
the I2C bus, putting values directly on the bus and reading data from registers on I2C devices.
|
||||
- @ref deepsleep - This section covers functions related to preparing for and entering BACKUP mode, the
|
||||
deepest sleep mode available on the SAM L22.
|
||||
*/
|
||||
|
||||
/** @addtogroup app Application Framework
|
||||
* @brief This section covers the functions that you will implement in your app.c file when designing a Sensor Watch app.
|
||||
* @details You should be able to write a watch app by simply implementing these functions and declaring callbacks for
|
||||
* various GPIO and peripheral interrupts. The main.c file takes care of calling these functions for you. The
|
||||
* general flow:
|
||||
*
|
||||
* 1. Your app_init() function is called.
|
||||
* - This method should only be used to set your initial application state.
|
||||
* 2. If your app is waking from BACKUP, app_wake_from_deep_sleep() is called.
|
||||
* - If you saved state in the RTC's backup registers, you can restore it here.
|
||||
* 3. Your app_setup() method is called.
|
||||
* - You may wish to enable some functionality and peripherals here.
|
||||
* - You should definitely set up some interrupts here.
|
||||
* 4. The main run loop begins: your app_loop() function is called.
|
||||
* - Run code and update your UI here.
|
||||
* - Return true if your app is prepared to enter STANDBY mode.
|
||||
* 5. This step differs depending on the value returned by app_loop:
|
||||
* - If you returned false, execution resumes at (4).
|
||||
* - If you returned true, app_prepare_for_sleep() is called; execution moves on to (6).
|
||||
* 6. The microcontroller enters the STANDBY sleep mode.
|
||||
* - No user code will run, and the watch will enter a low power mode.
|
||||
* - The watch will remain in this state until an interrupt wakes it.
|
||||
* 7. Once woken from STANDBY, your app_wake_from_sleep() function is called.
|
||||
* - After this, execution resumes at (4).
|
||||
*/
|
||||
/// @{
|
||||
/** @brief A function you will implement to initialize your application state. The app_init function is called before
|
||||
* anything else. Use it to set up any internal data structures or application state required by your app,
|
||||
* but don't configure any peripherals just yet.
|
||||
*/
|
||||
void app_init();
|
||||
|
||||
/** @brief A function you will implement to wake from deep sleep mode. The app_wake_from_deep_sleep function is only
|
||||
* called if your app is waking from the ultra-low power BACKUP sleep mode. You may have chosen to store some
|
||||
* state in the RTC's backup registers prior to entering this mode. You may restore that state here.
|
||||
*/
|
||||
void app_wake_from_deep_sleep();
|
||||
|
||||
/** @brief A function you will implement to set up your application. The app_setup function is like setup() in Arduino.
|
||||
* It is called once when the program begins. You should set pin modes and enable any peripherals you want to
|
||||
* set up (real-time clock, I2C, etc.) Depending on your application, you may or may not want to configure
|
||||
* sensors on your sensor board here. For example, a low-power accelerometer that will run at all times should
|
||||
* be configured here, whereas you may want to enable a more power-hungry sensor only when you need it.
|
||||
* @note If your app enters the ultra-low power BACKUP sleep mode, this function will be called again when it wakes
|
||||
* from that deep sleep state. In this state, the RTC will still be configured with the correct date and time.
|
||||
*/
|
||||
void app_setup();
|
||||
|
||||
/** @brief A function you will implement to serve as the app's main run loop. This method will be called repeatedly,
|
||||
or if you enter STANDBY sleep mode, as soon as the device wakes from sleep.
|
||||
* @return You should return true if your app is prepared to enter STANDBY sleep mode. If you return false, your
|
||||
* app's app_loop method will be called again immediately.
|
||||
* @note Only the RTC, the segment LCD controller and the external interrupt controller run in STANDBY mode. If you
|
||||
* are using, e.g. the PWM function to set a custom LED color, you should return false here until you are
|
||||
* finished with that operation. Note however that the peripherals will continue running after waking up,
|
||||
* so e.g. the I2C controller, if configured, will sleep in STANDBY. But you can use it again as soon as your
|
||||
* app wakes up.
|
||||
*/
|
||||
bool app_loop();
|
||||
|
||||
/** @brief A function you will implement to prepare to enter STANDBY sleep mode. The app_prepare_for_sleep function is
|
||||
* called before the watch goes into the STANDBY sleep mode. In STANDBY mode, most peripherals are shut down,
|
||||
* and no code will run until the watch receives an interrupt (generally either the 1Hz tick or a press on one
|
||||
* of the buttons).
|
||||
*/
|
||||
void app_prepare_for_sleep();
|
||||
|
||||
/** @brief A method you will implement to configure the app after waking from STANDBY sleep mode.
|
||||
*/
|
||||
void app_wake_from_sleep();
|
||||
|
||||
/// Called by main.c while setting up the app. You should not call this from your app.
|
||||
void _watch_init();
|
||||
/// @}
|
||||
|
||||
|
||||
/** @addtogroup slcd Segment LCD Display
|
||||
* @brief This section covers functions related to the Segment LCD display driver, which is responsible
|
||||
* for displaying strings of characters and indicators on the main watch display.
|
||||
*/
|
||||
/// @{
|
||||
/** @brief Enables the Segment LCD display.
|
||||
* Call this before attempting to set pixels or display strings.
|
||||
*/
|
||||
void watch_enable_display();
|
||||
|
||||
/** @brief Sets a pixel. Use this to manually set a pixel with a given common and segment number.
|
||||
* @param com the common pin, numbered from 0-2
|
||||
* @param seg the segment pin, numbered from 0-23
|
||||
*/
|
||||
void watch_set_pixel(uint8_t com, uint8_t seg);
|
||||
|
||||
/** @brief Clears a pixel. Use this to manually clear a pixel with a given common and segment number.
|
||||
* @param com the common pin, numbered from 0-2
|
||||
* @param seg the segment pin, numbered from 0-23
|
||||
* Use this to manually set a pixel with a common and a segment number.
|
||||
*/
|
||||
|
||||
void watch_clear_pixel(uint8_t com, uint8_t seg);
|
||||
|
||||
/** @brief Displays a string at the given position, starting from the top left. There are ten digits.
|
||||
A space in any position will clear that digit.
|
||||
* @param string A null-terminated string.
|
||||
* @param position The position to start. The day of week digits are positions 0 and 1, the day of
|
||||
month digits are positions 2 and 3, and the main clock line is positions 4-9.
|
||||
* @note This method does not clear the display; if for example you display a two-character string at
|
||||
position 0, positions 2-9 will retain whatever state they were previously displaying.
|
||||
*/
|
||||
void watch_display_string(char *string, uint8_t position);
|
||||
/// @}
|
||||
|
||||
|
||||
/** @addtogroup led LED Control
|
||||
* @brief This section covers functions related to the bi-color red/green LED mounted behind the LCD.
|
||||
*/
|
||||
/// @{
|
||||
/** @brief Enables the LED.
|
||||
* @param pwm if true, enables PWM output for brightness control (required to use @ref watch_set_led_color).
|
||||
If false, configures the LED pins as digital outputs.
|
||||
* @note The TC driver required for PWM mode does not run in STANDBY mode. You should keep your app awake
|
||||
while PWM'ing the LED's, and disable them before going to sleep.
|
||||
*/
|
||||
void watch_enable_led(bool pwm);
|
||||
void watch_disable_led(bool pwm);
|
||||
void watch_set_led_color(uint16_t red, uint16_t green);
|
||||
void watch_set_led_red();
|
||||
void watch_set_led_green();
|
||||
void watch_set_led_yellow();
|
||||
void watch_set_led_off();
|
||||
|
||||
bool watch_rtc_is_enabled();
|
||||
/** @brief Disables the LED.
|
||||
* @param pwm if true, disables the PWM output. If false, disables the digital outputs.
|
||||
*/
|
||||
void watch_disable_led(bool pwm);
|
||||
|
||||
/** @brief Sets the LED to a custom color by modulating each output's duty cycle.
|
||||
* @param red The red value.
|
||||
* @param green The green value.
|
||||
* @note still working on this, 0-65535 works now but these values may change.
|
||||
*/
|
||||
void watch_set_led_color(uint16_t red, uint16_t green);
|
||||
/** @brief Sets the red LED to full brightness, and turns the green LED off.
|
||||
*/
|
||||
void watch_set_led_red();
|
||||
|
||||
/** @brief Sets the green LED to full brightness, and turns the red LED off. */
|
||||
void watch_set_led_green();
|
||||
|
||||
/** @brief Sets both red and green LEDs to full brightness. */
|
||||
void watch_set_led_yellow();
|
||||
|
||||
/** @brief Sets both red and green LEDs to full brightness. */
|
||||
void watch_set_led_off();
|
||||
/// @}
|
||||
|
||||
|
||||
/** @addtogroup rtc Real-Time Clock
|
||||
* @brief This section covers functions related to the SAM L22's real-time clock peripheral, including
|
||||
* date, time and alarm functions.
|
||||
*/
|
||||
/// @{
|
||||
/// Called by main.c to check if the RTC is enabled.
|
||||
bool _watch_rtc_is_enabled();
|
||||
|
||||
/** @brief Sets the system date and time.
|
||||
* @param date_time A struct representing the date and time you wish to set.
|
||||
*/
|
||||
void watch_set_date_time(struct calendar_date_time date_time);
|
||||
|
||||
/** @brief Returns the system date and time in the provided struct.
|
||||
* @param date_time A pointer to a calendar_date_time struct.
|
||||
It will be populated with the correct date and time on return.
|
||||
*/
|
||||
void watch_get_date_time(struct calendar_date_time *date_time);
|
||||
|
||||
/** @brief Registers a "tick" callback that will be called once per second.
|
||||
* @param callback The function you wish to have called when the clock ticks.
|
||||
*/
|
||||
void watch_register_tick_callback(ext_irq_cb_t callback);
|
||||
/// @}
|
||||
|
||||
|
||||
/** @addtogroup adc Analog Input
|
||||
* @brief This section covers functions related to the SAM L22's analog-to-digital converter, as well as
|
||||
* configuring and reading values from the three analog-capable pins on the 9-pin connector.
|
||||
*/
|
||||
/// @{
|
||||
/** @brief Enables the ADC peripheral, and configures the selected pin for analog input.
|
||||
* @param pin One of pins A0, A1 or A2.
|
||||
*/
|
||||
void watch_enable_analog(const uint8_t pin);
|
||||
/// @}
|
||||
|
||||
|
||||
/** @addtogroup buttons Buttons
|
||||
* @brief This section covers functions related to the three buttons: Light, Mode and Alarm.
|
||||
*/
|
||||
/// @{
|
||||
/** @brief Enables the external interrupt controller.
|
||||
*/
|
||||
void watch_enable_buttons();
|
||||
void watch_register_button_callback(const uint32_t pin, ext_irq_cb_t callback);
|
||||
|
||||
/** @brief Configures an external interrupt
|
||||
* @param pin One of pins BTN_LIGHT, BTN_MODE or BTN_ALARM.
|
||||
* @param callback The function you wish to have called when the button is pressed.
|
||||
* @todo Make the alarm interrupt use the RTC tamper interrupt instead of the EIC.
|
||||
*/
|
||||
void watch_register_button_callback(const uint32_t pin, ext_irq_cb_t callback);
|
||||
/// @}
|
||||
|
||||
|
||||
/** @addtogroup gpio Digital Input and Output
|
||||
* @brief This section covers functions related to general-purpose input and output signals.
|
||||
*/
|
||||
/// @{
|
||||
/** @brief Configures the selected pin for digital input.
|
||||
* @param pin The pin that you wish to act as an input.
|
||||
*/
|
||||
void watch_enable_digital_input(const uint8_t pin);
|
||||
|
||||
/** @brief Enables a pull-up resistor on the selected pin.
|
||||
* @param pin The pin that you wish to configure.
|
||||
*/
|
||||
void watch_enable_pull_up(const uint8_t pin);
|
||||
|
||||
/** @brief Enables a pull-down resistor on the selected pin.
|
||||
* @param pin The pin that you wish to configure.
|
||||
*/
|
||||
void watch_enable_pull_down(const uint8_t pin);
|
||||
|
||||
/** @brief Gets the level of the selected pin.
|
||||
* @param pin The pin whose value you wish to read.
|
||||
* @return true if the pin was logic high; otherwise, false.
|
||||
*/
|
||||
bool watch_get_pin_level(const uint8_t pin);
|
||||
|
||||
/** @brief Configures the selected pin for digital output.
|
||||
* @param pin The pin that you wish to act as an output.
|
||||
*/
|
||||
void watch_enable_digital_output(const uint8_t pin);
|
||||
|
||||
/** @brief Disables digital output on the selected pin.
|
||||
* @param pin The pin that you wish disable.
|
||||
*/
|
||||
void watch_disable_digital_output(const uint8_t pin);
|
||||
|
||||
/** @brief Sets the level of the selected pin.
|
||||
* @param pin The pin whose value you wish to set.
|
||||
* @param level The level you wish to set: true for high, false for low.
|
||||
*/
|
||||
void watch_set_pin_level(const uint8_t pin, const bool level);
|
||||
/// @}
|
||||
|
||||
struct io_descriptor *I2C_0_io;
|
||||
|
||||
/** @addtogroup i2c I2C Controller Driver
|
||||
* @brief This section covers functions related to the SAM L22's built-I2C driver, including
|
||||
* configuring the I2C bus, putting values directly on the bus and reading data from
|
||||
* registers on I2C devices.
|
||||
*/
|
||||
/// @{
|
||||
/** @brief Enables the I2C peripheral. Call this before attempting to interface with I2C devices.
|
||||
*/
|
||||
void watch_enable_i2c();
|
||||
void watch_i2c_send(int16_t addr, uint8_t *buf, uint16_t length);
|
||||
void watch_i2c_receive(int16_t addr, uint8_t *buf, uint16_t length);
|
||||
void watch_i2c_write8(int16_t addr, uint8_t reg, uint8_t data);
|
||||
uint8_t watch_i2c_read8(int16_t addr, uint8_t reg);
|
||||
uint16_t watch_i2c_read16(int16_t addr, uint8_t reg);
|
||||
uint32_t watch_i2c_read24(int16_t addr, uint8_t reg);
|
||||
uint32_t watch_i2c_read32(int16_t addr, uint8_t reg);
|
||||
|
||||
/** @brief Sends a series of values to a device on the I2C bus.
|
||||
* @param addr The address of the device you wish to talk to.
|
||||
* @param buf A series of unsigned bytes; the data you wish to transmit.
|
||||
* @param length The number of bytes in buf that you wish to send.
|
||||
*/
|
||||
void watch_i2c_send(int16_t addr, uint8_t *buf, uint16_t length);
|
||||
|
||||
/** @brief Receives a series of values from a device on the I2C bus.
|
||||
* @param addr The address of the device you wish to hear from.
|
||||
* @param buf Storage for the incoming bytes; on return, it will contain the received data.
|
||||
* @param length The number of bytes that you wish to receive.
|
||||
*/
|
||||
void watch_i2c_receive(int16_t addr, uint8_t *buf, uint16_t length);
|
||||
|
||||
/** @brief Writes a byte to a register in an I2C device.
|
||||
* @param addr The address of the device you wish to address.
|
||||
* @param reg The register on the device that you wish to set.
|
||||
* @param data The value that you wish to set the register to.
|
||||
*/
|
||||
void watch_i2c_write8(int16_t addr, uint8_t reg, uint8_t data);
|
||||
|
||||
/** @brief Reads a byte from a register in an I2C device.
|
||||
* @param addr The address of the device you wish to address.
|
||||
* @param reg The register on the device that you wish to read.
|
||||
* @return An unsigned byte representing the value of the register that was read.
|
||||
*/
|
||||
uint8_t watch_i2c_read8(int16_t addr, uint8_t reg);
|
||||
|
||||
/** @brief Reads an unsigned little-endian word from a register in an I2C device.
|
||||
* @param addr The address of the device you wish to address.
|
||||
* @param reg The register on the device that you wish to read.
|
||||
* @return An unsigned word representing the value of the register that was read.
|
||||
* @note This reads two bytes into the word in bus order. If the device returns
|
||||
the LSB first and then the MSB, you can use this value as returned.
|
||||
If the device returns the data in big-endian order or uses some other
|
||||
kind of fancy bit packing, you may need to shuffle some bits around.
|
||||
*/
|
||||
uint16_t watch_i2c_read16(int16_t addr, uint8_t reg);
|
||||
|
||||
/** @brief Reads three bytes as an unsigned little-endian int from a register in an I2C device.
|
||||
* @param addr The address of the device you wish to address.
|
||||
* @param reg The register on the device that you wish to read.
|
||||
* @return An unsigned word representing the value of the register that was read.
|
||||
* @note This reads three bytes into the word in bus order. If the device returns
|
||||
these bytes LSB first, you can use this value as returned. If there is a
|
||||
sign bit, the device returns the data in big-endian order, or it uses some
|
||||
other kind of fancy bit packing, you may need to shuffle some bits around.
|
||||
*/
|
||||
uint32_t watch_i2c_read24(int16_t addr, uint8_t reg);
|
||||
|
||||
|
||||
/** @brief Reads an unsigned little-endian int from a register in an I2C device.
|
||||
* @param addr The address of the device you wish to address.
|
||||
* @param reg The register on the device that you wish to read.
|
||||
* @return An unsigned word representing the value of the register that was read.
|
||||
* @note This reads three bytes into the word in bus order. If the device returns
|
||||
these bytes LSB first, you can use this value as returned. If the device
|
||||
returns the data in big-endian order, or it uses some other kind of fancy
|
||||
bit packing, you may need to shuffle some bits around.
|
||||
*/
|
||||
uint32_t watch_i2c_read32(int16_t addr, uint8_t reg);
|
||||
/// @}
|
||||
|
||||
|
||||
/** @addtogroup deepsleep Deep Sleep Control
|
||||
* @brief This section covers functions related to preparing for and entering BACKUP mode, the
|
||||
* deepest sleep mode available on the SAM L22
|
||||
*/
|
||||
/// @{
|
||||
/** @brief Stores 32 bits of data in the RTC's backup register, which retains its data in deep sleep.
|
||||
* @param data An unsigned 32 bit integer with the data you wish to store.
|
||||
* @param reg A register from 0-7.
|
||||
*/
|
||||
void watch_store_backup_data(uint32_t data, uint8_t reg);
|
||||
|
||||
/** @brief Gets 32 bits of data from the RTC's backup register, which retains its data in deep sleep.
|
||||
* @param reg A register from 0-7.
|
||||
* @return An unsigned 32 bit integer with the from the backup register.
|
||||
*/
|
||||
uint32_t watch_get_backup_data(uint8_t reg);
|
||||
|
||||
/** @brief Enters the SAM L22's lowest-power mode, BACKUP.
|
||||
* @details This function does some housekeeping before entering BACKUP mode. It first disables all
|
||||
* peripherals except for the RTC, and disables the tick interrupt (since that would wake)
|
||||
* us up from deep sleep. It also sets an external wake source on the ALARM button, if one
|
||||
* was not already set. If you wish to wake from another source, such as one of the external
|
||||
* wake interrupt pins on the 9-pin connector, set that up prior to calling this function.
|
||||
* @note If you have a callback set for an external wake interrupt, it will be called if triggered while
|
||||
* in ACTIVE, IDLE or STANDBY modes, but it *will not be called* when waking from BACKUP.
|
||||
* Waking from backup is effectively like waking from reset, except that your @ref
|
||||
* app_wake_from_deep_sleep function will be called.
|
||||
* @warning still kind of glitchy!
|
||||
*/
|
||||
void watch_enter_deep_sleep();
|
||||
/// @}
|
||||
|
||||
#endif /* WATCH_H_ */
|
Loading…
x
Reference in New Issue
Block a user