diff --git a/annotated.html b/annotated.html deleted file mode 100644 index db844a91..00000000 --- a/annotated.html +++ /dev/null @@ -1,81 +0,0 @@ - - -
- - - - -
- Sensor Watch
- 0.0.0
-
- A board replacement for the classic Casio F-91W wristwatch, powered by a Microchip SAM L22 microcontroller.
- |
-
Cwatch_date_time |
- Sensor Watch
- 0.0.0
-
- A board replacement for the classic Casio F-91W wristwatch, powered by a Microchip SAM L22 microcontroller.
- |
-
- Sensor Watch
- 0.0.0
-
- A board replacement for the classic Casio F-91W wristwatch, powered by a Microchip SAM L22 microcontroller.
- |
-
- Sensor Watch
- 0.0.0
-
- A board replacement for the classic Casio F-91W wristwatch, powered by a Microchip SAM L22 microcontroller.
- |
-
- Sensor Watch
- 0.0.0
-
- A board replacement for the classic Casio F-91W wristwatch, powered by a Microchip SAM L22 microcontroller.
- |
-
▼ watch-library | |
▼ watch | |
tusb_config.h | |
watch.h | |
watch_adc.h | |
watch_app.h | |
watch_buzzer.h | |
watch_deepsleep.h | |
watch_extint.h | |
watch_gpio.h | |
watch_i2c.h | |
watch_led.h | |
watch_private.h | |
watch_rtc.h | |
watch_slcd.h | |
watch_uart.h | |
watch_utility.h |
- Sensor Watch
- 0.0.0
-
- A board replacement for the classic Casio F-91W wristwatch, powered by a Microchip SAM L22 microcontroller.
- |
-
- Sensor Watch
- 0.0.0
-
- A board replacement for the classic Casio F-91W wristwatch, powered by a Microchip SAM L22 microcontroller.
- |
-
- Sensor Watch
- 0.0.0
-
- A board replacement for the classic Casio F-91W wristwatch, powered by a Microchip SAM L22 microcontroller.
- |
-
This section covers functions related to the SAM L22's analog-to-digital converter, as well as configuring and reading values from the five analog-capable pins on the 9-pin connector. -More...
--Functions | |
-void | watch_enable_adc (void) |
Enables the ADC peripheral. You must call this before attempting to read a value from an analog pin. | |
void | watch_enable_analog_input (const uint8_t pin) |
Configures the selected pin for analog input. More... | |
uint16_t | watch_get_analog_pin_level (const uint8_t pin) |
Reads an analog value from one of the pins. More... | |
void | watch_set_analog_num_samples (uint16_t samples) |
Sets the number of samples to accumulate when measuring a pin level. Default is 16. More... | |
void | watch_set_analog_sampling_length (uint8_t cycles) |
Sets the length of time spent sampling, which allows measurement of higher impedance inputs. Default is 1. More... | |
void | watch_set_analog_reference_voltage (watch_adc_reference_voltage reference) |
Selects the reference voltage to use for analog readings. Default is ADC_REFERENCE_VCC. More... | |
uint16_t | watch_get_vcc_voltage (void) |
Returns the voltage of the VCC supply in millivolts (i.e. 3000 mV == 3.0 V). If running on a coin cell, this will be the battery voltage. More... | |
void | watch_disable_analog_input (const uint8_t pin) |
Disables the analog circuitry on the selected pin. More... | |
void | watch_disable_adc (void) |
Disables the ADC peripheral. More... | |
This section covers functions related to the SAM L22's analog-to-digital converter, as well as configuring and reading values from the five analog-capable pins on the 9-pin connector.
-
-
|
- -inline | -
Disables the ADC peripheral.
-
-
|
- -inline | -
Disables the analog circuitry on the selected pin.
-pin | One of pins A0-A4. |
void watch_enable_analog_input | -( | -const uint8_t | -pin | ) | -- |
Configures the selected pin for analog input.
-pin | One of pins A0-A4. |
uint16_t watch_get_analog_pin_level | -( | -const uint8_t | -pin | ) | -- |
Reads an analog value from one of the pins.
-pin | One of pins A0-A4. |
uint16_t watch_get_vcc_voltage | -( | -void | -) | -- |
Returns the voltage of the VCC supply in millivolts (i.e. 3000 mV == 3.0 V). If running on a coin cell, this will be the battery voltage.
-Unlike other ADC functions, this function does not return a raw value from the ADC, but rather scales it to an actual number of millivolts. This is because the ADC doesn't let us measure VCC per se; it instead lets us measure VCC / 4, and we choose to measure it against the internal reference voltage of 1.024 V. In short, the ADC gives us a number that's complicated to deal with, so we just turn it into a useful number for you :)
void watch_set_analog_num_samples | -( | -uint16_t | -samples | ) | -- |
Sets the number of samples to accumulate when measuring a pin level. Default is 16.
-samples | A power of 2 <= 1024. Specifically: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 or 1024. Any other value will be ignored. |
The SAM L22's ADC has a resolution of 12 bits. By default, the watch configures the ADC to take 16 samples of the analog input and accumulate them in the result register; this effectively gives us a 16-bit resolution, at the cost of taking 16 ADC cycles to complete a measurement. If you are measuring a slowly changing signal like a thermistor output or an ambient light sensor this is probably fine, even desirable. If you are measuring something a bit more fast-paced, like an analog accelerometer, you may wish to exchange precision for speed. In this case you may call this function to configure the ADC to accumulate fewer samples. HOWEVER! Note that this may change the range of values returned from watch_get_analog_pin_level:
void watch_set_analog_reference_voltage | -( | -watch_adc_reference_voltage | -reference | ) | -- |
Selects the reference voltage to use for analog readings. Default is ADC_REFERENCE_VCC.
-reference | One of ADC_REFERENCE_VCC, ADC_REFERENCE_VCC_DIV1POINT6, ADC_REFERENCE_VCC_DIV2 or ADC_REFERENCE_INTREF. |
In order to turn an analog voltage into a 16-bit integer, the ADC needs to compare the measured voltage to a reference point. For example, if you were powering the watch with VCC == 3.0V and you had two 10K resistors connected in series from 3V to GND, you could expect to get 3 volts when you measure the top of the voltage divider, 0 volts at the bottom, and 1.5 volts in the middle. If you read these values uising a reference voltage of ADC_REFERENCE_VCC, the top value would be about 65535, the bottom about 0, and the middle about 32768. However! If we used ADC_REFERENCE_VCC_DIV2 as our reference, we would expect to get 65535 both at the top and the middle, because the largest value the ADC can measure in this configutation is 1.5V (VCC / 2).
-By changing the reference voltage from ADC_REFERENCE_VCC to ADC_REFERENCE_VCC_DIV1POINT6 or ADC_REFERENCE_VCC_DIV2, you can get more resolution when measuring small voltages (i.e. a phototransistor circuit in low light).
-There is also a special reference voltage called ADC_REFERENCE_INTREF. The SAM L22's Supply Controller provides a selectable voltage reference (by default, 1.024 V) that you can select as a reference voltage for ADC conversions. Unlike the three references we talked about in the last paragraph, this reference voltage does not depend on VCC, which makes it very useful for measuring the battery voltage (since you can't really compare VCC to itself). You can change the INTREF voltage to 2.048 or 4.096 V by poking at the supply controller's VREF register, but the watch library does not support this use case.
- -void watch_set_analog_sampling_length | -( | -uint8_t | -cycles | ) | -- |
Sets the length of time spent sampling, which allows measurement of higher impedance inputs. Default is 1.
-cycles | The number of ADC cycles to sample, between 1 and 64. |
To measure an analog value, the SAM L22 must charge a capacitor to the analog voltage presented at the input. This takes time. Importantly, the higher the input impedance, the more time this takes. As a basic example: if you are using a thermistor tied to VCC to measure temperature, the capacitor has to charge through the thermistor. The higher the resistor value, the higher the input impedance, and the more time we need to allow for the measurement. By default, the ADC is configured to run on a 500 kHz clock with a sample time of one cycle. This is appropriate for an input impedance up to about 28kΩ. Setting the sampling time to 4 cycles allows for an input impedance up to 123kΩ. Setting the sampling time to the maximum of 64 cycles theoretically allows for input impedance up to 2 MΩ. (I based these numbers on the calculator in the linked blog post; it also has a ton of great info on the SAM D21 ADC, which is similar to the SAM L22's).
- -
- Sensor Watch
- 0.0.0
-
- A board replacement for the classic Casio F-91W wristwatch, powered by a Microchip SAM L22 microcontroller.
- |
-
This section covers the functions that you will implement in your app.c file when designing a Sensor Watch app. -More...
--Functions | |
-void | app_init (void) |
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_wake_from_backup (void) |
A function you will implement to wake from BACKUP mode, which wipes the system's RAM, and with it, your application's state. You may have chosen to store some important application state in the RTC's backup registers prior to entering this mode. You may restore that state here. | |
void | app_setup (void) |
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. More... | |
bool | app_loop (void) |
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 mode, as soon as the device wakes from sleep. More... | |
void | app_prepare_for_standby (void) |
A function you will implement to prepare to enter STANDBY mode. The app_prepare_for_standby function is called after your app_loop function returns true, and just before the watch enters STANDBY mode. In this 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). More... | |
-void | app_wake_from_standby (void) |
A method you will implement to configure the app after waking from STANDBY mode. | |
This section covers the functions that you will implement in your app.c file when designing a Sensor Watch app.
-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:
-bool app_loop | -( | -void | -) | -- |
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 mode, as soon as the device wakes from sleep.
-void app_prepare_for_standby | -( | -void | -) | -- |
A function you will implement to prepare to enter STANDBY mode. The app_prepare_for_standby function is called after your app_loop function returns true, and just before the watch enters STANDBY mode. In this 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_setup | -( | -void | -) | -- |
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.
-
- Sensor Watch
- 0.0.0
-
- A board replacement for the classic Casio F-91W wristwatch, powered by a Microchip SAM L22 microcontroller.
- |
-
This section covers functions related to the three buttons: Light, Mode and Alarm, as well as external interrupts from devices on the nine-pin connector. -More...
--Typedefs | |
-typedef enum watch_interrupt_trigger | watch_interrupt_trigger |
An enum defining the types of interrupt trigger you wish to scan for. | |
-Enumerations | |
enum | watch_interrupt_trigger { INTERRUPT_TRIGGER_NONE = 0 -, INTERRUPT_TRIGGER_RISING -, INTERRUPT_TRIGGER_FALLING -, INTERRUPT_TRIGGER_BOTH - } |
An enum defining the types of interrupt trigger you wish to scan for. | |
-Functions | |
-void | watch_enable_external_interrupts (void) |
Enables the external interrupt controller. | |
-void | watch_disable_external_interrupts (void) |
Disables the external interrupt controller. | |
void | watch_register_interrupt_callback (const uint8_t pin, ext_irq_cb_t callback, watch_interrupt_trigger trigger) |
Configures an external interrupt callback on one of the external interrupt pins. More... | |
- | __attribute__ ((deprecated("Use watch_register_interrupt_callback or watch_register_extwake_callback instead"))) void watch_register_button_callback(const uint8_t pin |
- | __attribute__ ((deprecated("Use watch_enable_external_interrupts instead"))) void watch_enable_buttons(void) |
-Variables | |
-ext_irq_cb_t | callback |
This section covers functions related to the three buttons: Light, Mode and Alarm, as well as external interrupts from devices on the nine-pin connector.
-The buttons are the core input UI of the watch, and the way the user will interact with your application. They are active high, pulled down by the microcontroller, and triggered when one of the "pushers" brings a tab from the metal frame into contact with the edge of the board. Note that the buttons can only wake the watch from STANDBY mode, at least as of the current SAM L22 silicon revision. The external interrupt controller runs in STANDBY mode, but it does not run in BACKUP mode; to wake from BACKUP, buttons will not cut it.
-void watch_register_interrupt_callback | -( | -const uint8_t | -pin, | -
- | - | ext_irq_cb_t | -callback, | -
- | - | watch_interrupt_trigger | -trigger | -
- | ) | -- |
Configures an external interrupt callback on one of the external interrupt pins.
-You can set one interrupt callback per pin, and you can monitor for a rising condition, a falling condition, or both. If you just want to detect a button press, register your interrupt with INTERRUPT_TRIGGER_RISING; if you want to detect an active-low interrupt signal from a device on the nine-pin connector, use INTERRUPT_TRIGGER_FALLING. If you want to detect both rising and falling conditions (i.e. button down and button up), use INTERRUPT_TRIGGER_BOTH and use watch_get_pin_level to check the pin level in your callback to determine which condition caused the interrupt.
pin | One of BTN_LIGHT, BTN_MODE, BTN_ALARM, A0, A1, A3 or A4. If the pin parameter matches one of the three button pins, this function will also enable an internal pull-down resistor. If the pin parameter is A0-A4, you are responsible for setting any required pull configuration using watch_enable_pull_up or watch_enable_pull_down. |
callback | The function you wish to have called when the button is pressed. |
trigger | The condition on which you wish to trigger: rising, falling or both. |
- Sensor Watch
- 0.0.0
-
- A board replacement for the classic Casio F-91W wristwatch, powered by a Microchip SAM L22 microcontroller.
- |
-
This section covers functions related to the piezo buzzer embedded in the F-91W's back plate. -More...
--Typedefs | |
-typedef enum BuzzerNote | BuzzerNote |
87 notes for use with watch_buzzer_play_note | |
-Functions | |
-void | watch_enable_buzzer (void) |
Enables the TCC peripheral, which drives the buzzer. | |
void | watch_set_buzzer_period (uint32_t period) |
Sets the period of the buzzer. More... | |
void | watch_disable_buzzer (void) |
Disables the TCC peripheral that drives the buzzer. More... | |
void | watch_set_buzzer_on (void) |
Turns the buzzer output on. It will emit a continuous sound at the given frequency. More... | |
-void | watch_set_buzzer_off (void) |
Turns the buzzer output off. | |
void | watch_buzzer_play_note (BuzzerNote note, uint16_t duration_ms) |
Plays the given note for a set duration. More... | |
-Variables | |
-const uint16_t | NotePeriods [108] |
An array of periods for all the notes on a piano, corresponding to the names in BuzzerNote. | |
This section covers functions related to the piezo buzzer embedded in the F-91W's back plate.
-enum BuzzerNote | -
87 notes for use with watch_buzzer_play_note
-void watch_buzzer_play_note | -( | -BuzzerNote | -note, | -
- | - | uint16_t | -duration_ms | -
- | ) | -- |
Plays the given note for a set duration.
-note | The note you wish to play, or BUZZER_NOTE_REST to disable output for the given duration. |
duration_ms | The duration of the note. |
void watch_disable_buzzer | -( | -void | -) | -- |
Disables the TCC peripheral that drives the buzzer.
-
-
|
- -inline | -
Turns the buzzer output on. It will emit a continuous sound at the given frequency.
-
-
|
- -inline | -
Sets the period of the buzzer.
-period | The period of a single cycle for the TCC peripheral. You can determine the period for a desired frequency with the following formula: period = 1000000 / freq |
- Sensor Watch
- 0.0.0
-
- A board replacement for the classic Casio F-91W wristwatch, powered by a Microchip SAM L22 microcontroller.
- |
-
This section covers functions related to the debug UART, available on pin D1 of the 9-pin connector. -More...
--Functions | |
__attribute__ ((deprecated("Use printf to log debug messages over USB."))) void watch_enable_debug_uart(uint32_t baud) | |
Initializes the debug UART. More... | |
This section covers functions related to the debug UART, available on pin D1 of the 9-pin connector.
-__attribute__ | -( | -(deprecated("Use printf to log debug messages over USB.")) | -) | -- |
Initializes the debug UART.
-Outputs a string on the debug UART.
-Outputs a single character on the debug UART.
-baud | The baud rate |
c | The character you wish to output. |
s | A null-terminated string. |
- Sensor Watch
- 0.0.0
-
- A board replacement for the classic Casio F-91W wristwatch, powered by a Microchip SAM L22 microcontroller.
- |
-
This section covers functions related to the various sleep modes available to the watch, including Sleep, Deep Sleep, and BACKUP mode. -More...
--Functions | |
void | watch_register_extwake_callback (uint8_t pin, ext_irq_cb_t callback, bool level) |
Registers a callback on one of the RTC's external wake pins, which can wake the device from Sleep, Deep Sleep and BACKUP modes (but see warning re: BACKUP mode). More... | |
void | watch_disable_extwake_interrupt (uint8_t pin) |
Unregisters the RTC interrupt on one of the EXTWAKE pins. This will prevent a value change on one of these pins from waking the device. More... | |
void | watch_store_backup_data (uint32_t data, uint8_t reg) |
Stores data in one of the RTC's backup registers, which retain their data in BACKUP mode. More... | |
uint32_t | watch_get_backup_data (uint8_t reg) |
Gets 32 bits of data from the RTC's BACKUP register. More... | |
void | watch_enter_sleep_mode (void) |
enters Sleep Mode by disabling all pins and peripherals except the RTC and the LCD. More... | |
void | watch_enter_deep_sleep_mode (void) |
enters Deep Sleep Mode by disabling all pins and peripherals except the RTC. More... | |
void | watch_enter_backup_mode (void) |
Enters the SAM L22's lowest-power mode, BACKUP. More... | |
- | __attribute__ ((deprecated("Use watch_enter_sleep_mode or watch_enter_deep_sleep_mode instead"))) void watch_enter_shallow_sleep(bool display_on) |
- | __attribute__ ((deprecated("Use watch_enter_backup_mode instead"))) void watch_enter_deep_sleep(void) |
This section covers functions related to the various sleep modes available to the watch, including Sleep, Deep Sleep, and BACKUP mode.
-These terms changed meaning a bit over the course of development; if you are coming to this documentation after having worked with an earlier version of the library, these definitions should clarify the terminology. Terms in all caps are modes of the SAM L22; terms in Title Case are specific implementations in this library.
app_loop
function returns false, the device will remain in ACTIVE mode and call your app_loop
function again.app_loop
function returns true, the watch enters STANDBY mode until the next tick or other interrupt. This mode uses much less power than ACTIVE mode.watch_enter_sleep_mode
. It consumes an order of magnitude less power than STANDBY mode.watch_enter_deep_sleep_mode
.watch_enter_backup_mode
. void watch_disable_extwake_interrupt | -( | -uint8_t | -pin | ) | -- |
Unregisters the RTC interrupt on one of the EXTWAKE pins. This will prevent a value change on one of these pins from waking the device.
-pin | Either pin BTN_ALARM, A2, or A4. If the pin is BTN_ALARM, this function DOES NOT disable the internal pull down on that pin. |
void watch_enter_backup_mode | -( | -void | -) | -- |
Enters the SAM L22's lowest-power mode, BACKUP.
-This function does some housekeeping before entering BACKUP mode. It first disables all pins and peripherals except for the RTC, and disables the tick interrupt (since that would wake us up from BACKUP mode). Once again, if you wish to wake from the A2 or the A4 interrupt, you must first configure this by calling watch_register_extwake_callback.
void watch_enter_deep_sleep_mode | -( | -void | -) | -- |
enters Deep Sleep Mode by disabling all pins and peripherals except the RTC.
-Short of BACKUP mode, this is the lowest power mode you can enter while retaining your application state (and the ability to wake with the alarm button). Just note that the display will be completely off, so you should document to the user of your application that they will need to press the alarm button to wake the device, or use a sensor board with support for an external wake pin.
-All notes from watch_enter_sleep_mode apply here, except for power consumption. You can estimate the power consumption of this mode to be on the order of 12 microwatts (about 4µA at 3 V).
- -void watch_enter_sleep_mode | -( | -void | -) | -- |
enters Sleep Mode by disabling all pins and peripherals except the RTC and the LCD.
-This sleep mode is not the lowest power mode available, but it has the benefit of allowing you to display a message to the user while asleep. You can also set an alarm interrupt to wake at a configfurable interval (every minute, hour or day) to update the display. You can wake from this mode by pressing the ALARM button, if you registered an extwake callback on the ALARM button. Also note that when your app wakes from this sleep mode, your app_setup method will be called again, since this function will have disabled things you set up there.
-Note that to wake from either the ALARM button, the A2 interrupt or the A4 interrupt, you must first configure this by calling watch_register_extwake_callback.
-You can estimate the power consumption of this mode to be on the order of 30 microwatts (about 10 µA at 3 V).
- -uint32_t watch_get_backup_data | -( | -uint8_t | -reg | ) | -- |
Gets 32 bits of data from the RTC's BACKUP register.
-reg | A register from 0-7. |
void watch_register_extwake_callback | -( | -uint8_t | -pin, | -
- | - | ext_irq_cb_t | -callback, | -
- | - | bool | -level | -
- | ) | -- |
Registers a callback on one of the RTC's external wake pins, which can wake the device from Sleep, Deep Sleep and BACKUP modes (but see warning re: BACKUP mode).
-pin | Either pin BTN_ALARM, A2, or A4. These are the three external wake pins. If the pin is BTN_ALARM, this function also enables an internal pull down on that pin. |
callback | The callback to be called if this pin triggers outside of BACKUP mode. If this is NULL, no callback will be called even in normal modes, but the interrupt will still be enabled so that it can wake the device. |
level | The level you wish to scan for: true for rising, false for falling. Note that you cannot scan for both rising and falling edges like you can with the external interrupt pins; with the external wake interrupt, you can only get one or the other. |
void watch_store_backup_data | -( | -uint32_t | -data, | -
- | - | uint8_t | -reg | -
- | ) | -- |
Stores data in one of the RTC's backup registers, which retain their data in BACKUP mode.
-data | An unsigned 32 bit integer with the data you wish to store. |
reg | A register from 0-7. |
- Sensor Watch
- 0.0.0
-
- A board replacement for the classic Casio F-91W wristwatch, powered by a Microchip SAM L22 microcontroller.
- |
-
This section covers functions related to general-purpose input and output signals. -More...
--Functions | |
void | watch_enable_digital_input (const uint8_t pin) |
Configures the selected pin for digital input. More... | |
void | watch_disable_digital_input (const uint8_t pin) |
Disables any digital input, along with any pull-up or pull-down configuration. More... | |
void | watch_enable_pull_up (const uint8_t pin) |
Enables a pull-up resistor on the selected pin. More... | |
void | watch_enable_pull_down (const uint8_t pin) |
Enables a pull-down resistor on the selected pin. More... | |
bool | watch_get_pin_level (const uint8_t pin) |
Gets the level of the selected pin. More... | |
void | watch_enable_digital_output (const uint8_t pin) |
Configures the selected pin for digital output. More... | |
void | watch_disable_digital_output (const uint8_t pin) |
Disables digital output on the selected pin. More... | |
void | watch_set_pin_level (const uint8_t pin, const bool level) |
Sets the level of the selected pin. More... | |
This section covers functions related to general-purpose input and output signals.
-void watch_disable_digital_input | -( | -const uint8_t | -pin | ) | -- |
Disables any digital input, along with any pull-up or pull-down configuration.
-pin | The pin that you wish to disable. |
void watch_disable_digital_output | -( | -const uint8_t | -pin | ) | -- |
Disables digital output on the selected pin.
-pin | The pin that you wish disable. |
void watch_enable_digital_input | -( | -const uint8_t | -pin | ) | -- |
Configures the selected pin for digital input.
-pin | The pin that you wish to act as an input. |
void watch_enable_digital_output | -( | -const uint8_t | -pin | ) | -- |
Configures the selected pin for digital output.
-pin | The pin that you wish to act as an output. |
void watch_enable_pull_down | -( | -const uint8_t | -pin | ) | -- |
Enables a pull-down resistor on the selected pin.
-pin | The pin that you wish to configure. |
void watch_enable_pull_up | -( | -const uint8_t | -pin | ) | -- |
Enables a pull-up resistor on the selected pin.
-pin | The pin that you wish to configure. |
bool watch_get_pin_level | -( | -const uint8_t | -pin | ) | -- |
Gets the level of the selected pin.
-pin | The pin whose value you wish to read. |
void watch_set_pin_level | -( | -const uint8_t | -pin, | -
- | - | const bool | -level | -
- | ) | -- |
Sets the level of the selected pin.
-pin | The pin whose value you wish to set. |
level | The level you wish to set: true for high, false for low. |
- Sensor Watch
- 0.0.0
-
- A board replacement for the classic Casio F-91W wristwatch, powered by a Microchip SAM L22 microcontroller.
- |
-
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. -More...
--Functions | |
-void | watch_enable_i2c (void) |
Enables the I2C peripheral. Call this before attempting to interface with I2C devices. | |
-void | watch_disable_i2c (void) |
Disables the I2C peripheral. | |
void | watch_i2c_send (int16_t addr, uint8_t *buf, uint16_t length) |
Sends a series of values to a device on the I2C bus. More... | |
void | watch_i2c_receive (int16_t addr, uint8_t *buf, uint16_t length) |
Receives a series of values from a device on the I2C bus. More... | |
void | watch_i2c_write8 (int16_t addr, uint8_t reg, uint8_t data) |
Writes a byte to a register in an I2C device. More... | |
uint8_t | watch_i2c_read8 (int16_t addr, uint8_t reg) |
Reads a byte from a register in an I2C device. More... | |
uint16_t | watch_i2c_read16 (int16_t addr, uint8_t reg) |
Reads an unsigned little-endian word from a register in an I2C device. More... | |
uint32_t | watch_i2c_read24 (int16_t addr, uint8_t reg) |
Reads three bytes as an unsigned little-endian int from a register in an I2C device. More... | |
uint32_t | watch_i2c_read32 (int16_t addr, uint8_t reg) |
Reads an unsigned little-endian int from a register in an I2C device. More... | |
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.
-uint16_t watch_i2c_read16 | -( | -int16_t | -addr, | -
- | - | uint8_t | -reg | -
- | ) | -- |
Reads an unsigned little-endian word from a register in an I2C device.
-addr | The address of the device you wish to address. |
reg | The register on the device that you wish to read. |
uint32_t watch_i2c_read24 | -( | -int16_t | -addr, | -
- | - | uint8_t | -reg | -
- | ) | -- |
Reads three bytes as an unsigned little-endian int from a register in an I2C device.
-addr | The address of the device you wish to address. |
reg | The register on the device that you wish to read. |
uint32_t watch_i2c_read32 | -( | -int16_t | -addr, | -
- | - | uint8_t | -reg | -
- | ) | -- |
Reads an unsigned little-endian int from a register in an I2C device.
-addr | The address of the device you wish to address. |
reg | The register on the device that you wish to read. |
uint8_t watch_i2c_read8 | -( | -int16_t | -addr, | -
- | - | uint8_t | -reg | -
- | ) | -- |
Reads a byte from a register in an I2C device.
-addr | The address of the device you wish to address. |
reg | The register on the device that you wish to read. |
void watch_i2c_receive | -( | -int16_t | -addr, | -
- | - | uint8_t * | -buf, | -
- | - | uint16_t | -length | -
- | ) | -- |
Receives a series of values from a device on the I2C bus.
-addr | The address of the device you wish to hear from. |
buf | Storage for the incoming bytes; on return, it will contain the received data. |
length | The number of bytes that you wish to receive. |
void watch_i2c_send | -( | -int16_t | -addr, | -
- | - | uint8_t * | -buf, | -
- | - | uint16_t | -length | -
- | ) | -- |
Sends a series of values to a device on the I2C bus.
-addr | The address of the device you wish to talk to. |
buf | A series of unsigned bytes; the data you wish to transmit. |
length | The number of bytes in buf that you wish to send. |
void watch_i2c_write8 | -( | -int16_t | -addr, | -
- | - | uint8_t | -reg, | -
- | - | uint8_t | -data | -
- | ) | -- |
Writes a byte to a register in an I2C device.
-addr | The address of the device you wish to address. |
reg | The register on the device that you wish to set. |
data | The value that you wish to set the register to. |
- Sensor Watch
- 0.0.0
-
- A board replacement for the classic Casio F-91W wristwatch, powered by a Microchip SAM L22 microcontroller.
- |
-
This section covers functions related to the bi-color red/green LED mounted behind the LCD. -More...
--Functions | |
void | watch_enable_leds (void) |
Enables the bi-color LED. More... | |
void | watch_disable_leds (void) |
Disables the LEDs. More... | |
void | watch_set_led_color (uint8_t red, uint8_t green) |
Sets the LED to a custom color by modulating each output's duty cycle. More... | |
void | watch_set_led_red (void) |
Sets the red LED to full brightness, and turns the green LED off. More... | |
void | watch_set_led_green (void) |
Sets the green LED to full brightness, and turns the red LED off. More... | |
void | watch_set_led_yellow (void) |
Sets both red and green LEDs to full brightness. More... | |
-void | watch_set_led_off (void) |
Turns both the red and the green LEDs off. | |
- | __attribute__ ((deprecated("Use watch_enable_leds instead"))) void watch_enable_led(bool unused) |
- | __attribute__ ((deprecated("Use watch_disable_leds instead"))) void watch_disable_led(bool unused) |
This section covers functions related to the bi-color red/green LED mounted behind the LCD.
-The SAM L22 is an exceedingly power efficient chip, whereas the LED's are relatively power- hungry. The green LED, at full power, consumes more power than the whole chip in active mode, and the red LED consumes about twelve times as much power! The LED's should thus be used only sparingly in order to preserve battery life.
make LED=BLUE
, and the watch library will automatically swap the pins so that watch_set_led_red sets the red LED, and watch_set_led_green sets the blue one. void watch_disable_leds | -( | -void | -) | -- |
Disables the LEDs.
-void watch_enable_leds | -( | -void | -) | -- |
Enables the bi-color LED.
-void watch_set_led_color | -( | -uint8_t | -red, | -
- | - | uint8_t | -green | -
- | ) | -- |
Sets the LED to a custom color by modulating each output's duty cycle.
-red | The red value from 0-255. |
green | The green value from 0-255. If your watch has a red/blue LED, this will be the blue value. |
void watch_set_led_green | -( | -void | -) | -- |
Sets the green LED to full brightness, and turns the red LED off.
-Of the two LED's in the RG bi-color LED, the green LED is the more power-efficient one (~0.44 mA).
void watch_set_led_red | -( | -void | -) | -- |
Sets the red LED to full brightness, and turns the green LED off.
-Of the two LED's in the RG bi-color LED, the red LED is the less power-efficient one (~4.5 mA).
- -void watch_set_led_yellow | -( | -void | -) | -- |
Sets both red and green LEDs to full brightness.
-The total current draw between the two LED's in this mode will be ~5 mA, which is more than the watch draws in any other mode. Take care not to drain the battery.
- Sensor Watch
- 0.0.0
-
- A board replacement for the classic Casio F-91W wristwatch, powered by a Microchip SAM L22 microcontroller.
- |
-
This section covers functions related to the SAM L22's real-time clock peripheral, including date, time and alarm functions. -More...
--Data Structures | |
union | watch_date_time |
-Macros | |
-#define | WATCH_RTC_REFERENCE_YEAR (2020) |
-Typedefs | |
-typedef enum watch_rtc_alarm_match | watch_rtc_alarm_match |
-Enumerations | |
enum | watch_rtc_alarm_match { ALARM_MATCH_DISABLED = 0 -, ALARM_MATCH_SS -, ALARM_MATCH_MMSS -, ALARM_MATCH_HHMMSS - } |
-Functions | |
-bool | _watch_rtc_is_enabled (void) |
Called by main.c to check if the RTC is enabled. You may call this function, but outside of app_init, it should always return true. | |
void | watch_rtc_set_date_time (watch_date_time date_time) |
Sets the date and time. More... | |
watch_date_time | watch_rtc_get_date_time (void) |
Returns the date and time. More... | |
void | watch_rtc_register_alarm_callback (ext_irq_cb_t callback, watch_date_time alarm_time, watch_rtc_alarm_match mask) |
Registers an alarm callback that will be called when the RTC time matches the target time, as masked by the provided mask. More... | |
-void | watch_rtc_disable_alarm_callback (void) |
Disables the alarm callback. | |
void | watch_rtc_register_tick_callback (ext_irq_cb_t callback) |
Registers a "tick" callback that will be called once per second. More... | |
-void | watch_rtc_disable_tick_callback (void) |
Disables the tick callback for the given period. | |
void | watch_rtc_register_periodic_callback (ext_irq_cb_t callback, uint8_t frequency) |
Registers a callback that will be called at a configurable period. More... | |
void | watch_rtc_disable_periodic_callback (uint8_t frequency) |
Disables the tick callback for the given period. More... | |
-void | watch_rtc_disable_all_periodic_callbacks (void) |
Disables all periodic callbacks, including the once-per-second tick callback. | |
__attribute__ ((deprecated("Use watch_rtc_set_date_time function instead"))) void watch_set_date_time(struct calendar_date_time date_time) | |
Sets the system date and time. More... | |
__attribute__ ((deprecated("Use the watch_rtc_get_date_time function instead"))) void watch_get_date_time(struct calendar_date_time *date_time) | |
Returns the system date and time in the provided struct. More... | |
__attribute__ ((deprecated("Use the watch_rtc_register_tick_callback function instead"))) void watch_register_tick_callback(ext_irq_cb_t callback) | |
Registers a "tick" callback that will be called once per second. More... | |
This section covers functions related to the SAM L22's real-time clock peripheral, including date, time and alarm functions.
-The real-time clock is the only peripheral that main.c enables for you. It is the cornerstone of low power operation on the watch, and it is required for several key functions that we assume will be available, namely the wake from BACKUP mode and the callback on the ALARM button. It is also required for the operation of the 1 Hz tick interrupt, which you will most likely use to wake from STANDBY mode.
-__attribute__ | -( | -(deprecated("Use the watch_rtc_get_date_time function instead")) | -) | -- |
Returns the system date and time in the provided struct.
-date_time | A pointer to a calendar_date_time struct. It will have with the correct date and time on return. |
__attribute__ | -( | -(deprecated("Use the watch_rtc_register_tick_callback function instead")) | -) | -- |
Registers a "tick" callback that will be called once per second.
-callback | The function you wish to have called when the clock ticks. If you pass in NULL, the tick interrupt will still be enabled, but no callback function will be called. |
__attribute__ | -( | -(deprecated("Use watch_rtc_set_date_time function instead")) | -) | -- |
Sets the system date and time.
-date_time | A struct representing the date and time you wish to set. |
void watch_rtc_disable_periodic_callback | -( | -uint8_t | -frequency | ) | -- |
Disables the tick callback for the given period.
-frequency | The frequency of the tick you wish to disable, in Hz. Must be a power of 2, from 1 to 128. |
watch_date_time watch_rtc_get_date_time | -( | -void | -) | -- |
Returns the date and time.
-void watch_rtc_register_alarm_callback | -( | -ext_irq_cb_t | -callback, | -
- | - | watch_date_time | -alarm_time, | -
- | - | watch_rtc_alarm_match | -mask | -
- | ) | -- |
Registers an alarm callback that will be called when the RTC time matches the target time, as masked by the provided mask.
-callback | The function you wish to have called when the alarm fires. If this value is NULL, the alarm interrupt will still be enabled, but no callback function will be called. |
alarm_time | The time that you wish to match. The date is currently ignored. |
mask | One of the values in watch_rtc_alarm_match indicating which values to check. |
The alarm interrupt is a versatile tool for scheduling events in the future, especially since it can wake the device from all sleep modes. The key to its versatility is the mask parameter. Suppose we set an alarm for midnight, 00:00:00.
void watch_rtc_register_periodic_callback | -( | -ext_irq_cb_t | -callback, | -
- | - | uint8_t | -frequency | -
- | ) | -- |
Registers a callback that will be called at a configurable period.
-callback | The function you wish to have called at the specified period. If you pass in NULL, the periodic interrupt will still be enabled, but no callback function will be called. |
frequency | The frequency of the tick in Hz. Must be a power of 2, from 1 to 128 inclusive. |
Also note that the RTC peripheral does not have sub-second resolution, so even if you set a 2 or 4 Hz interval, the system will not have any way of telling you where you are within a given second; watch_rtc_get_date_time will return the exact same timestamp until the second ticks over.
- -void watch_rtc_register_tick_callback | -( | -ext_irq_cb_t | -callback | ) | -- |
Registers a "tick" callback that will be called once per second.
-callback | The function you wish to have called when the clock ticks. If you pass in NULL, the tick interrupt will still be enabled, but no callback function will be called. |
void watch_rtc_set_date_time | -( | -watch_date_time | -date_time | ) | -- |
Sets the date and time.
-date_time | The date and time you wish to set, with a year value from 0-63 representing 2020-2083. |
- Sensor Watch
- 0.0.0
-
- A board replacement for the classic Casio F-91W wristwatch, powered by a Microchip SAM L22 microcontroller.
- |
-
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. -More...
--Typedefs | |
-typedef enum WatchIndicatorSegment | WatchIndicatorSegment |
An enum listing the icons and indicators available on the watch. | |
-Enumerations | |
enum | WatchIndicatorSegment { - WATCH_INDICATOR_SIGNAL = 0 -, WATCH_INDICATOR_BELL -, WATCH_INDICATOR_PM -, WATCH_INDICATOR_24H -, - WATCH_INDICATOR_LAP - - } |
An enum listing the icons and indicators available on the watch. More... | |
-Functions | |
-void | watch_enable_display (void) |
Enables the Segment LCD display. Call this before attempting to set pixels or display strings. | |
void | watch_set_pixel (uint8_t com, uint8_t seg) |
Sets a pixel. Use this to manually set a pixel with a given common and segment number. See segmap.html. More... | |
void | watch_clear_pixel (uint8_t com, uint8_t seg) |
Clears a pixel. Use this to manually clear a pixel with a given common and segment number. See segmap.html. More... | |
-void | watch_clear_display (void) |
Clears all segments of the display, including incicators and the colon. | |
void | watch_display_string (char *string, uint8_t position) |
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. More... | |
-void | watch_set_colon (void) |
Turns the colon segment on. | |
-void | watch_clear_colon (void) |
Turns the colon segment off. | |
void | watch_set_indicator (WatchIndicatorSegment indicator) |
Sets an indicator on the LCD. Use this to turn on one of the indicator segments. More... | |
void | watch_clear_indicator (WatchIndicatorSegment indicator) |
Clears an indicator on the LCD. Use this to turn off one of the indicator segments. More... | |
void | watch_clear_all_indicators (void) |
Clears all indicator segments. More... | |
void | watch_start_character_blink (char character, uint32_t duration) |
Blinks a single character in position 7. Does not affect other positions. More... | |
void | watch_stop_blink (void) |
Stops and clears all blinking segments. More... | |
void | watch_start_tick_animation (uint32_t duration) |
Begins a two-segment "tick-tock" animation in position 8. More... | |
bool | watch_tick_animation_is_running (void) |
Checks if the tick animation is currently running. More... | |
void | watch_stop_tick_animation (void) |
Stops the tick/tock animation and clears all animating segments. More... | |
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.
-The segment LCD controller consumes about 3 microamperes of power with no segments on, and about 4 microamperes with all segments on. There is also a slight power impact associated with updating the screen (about 1 microampere to update at 1 Hz). For the absolute lowest power operation, update the display only when its contents have changed, and disable the SLCD peripheral when the screen is not in use. For a map of all common and segment pins, see segmap.html. You can hover over any segment in that diagram to view the common and segment pins associated with each segment of the display.
-enum WatchIndicatorSegment | -
An enum listing the icons and indicators available on the watch.
-void watch_clear_all_indicators | -( | -void | -) | -- |
Clears all indicator segments.
-
-
|
- -inline | -
Clears an indicator on the LCD. Use this to turn off one of the indicator segments.
-indicator | One of the indicator segments from the enum. |
-
|
- -inline | -
Clears a pixel. Use this to manually clear a pixel with a given common and segment number. See segmap.html.
-com | the common pin, numbered from 0-2. |
seg | the segment pin, numbered from 0-23. |
void watch_display_string | -( | -char * | -string, | -
- | - | uint8_t | -position | -
- | ) | -- |
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.
-string | A null-terminated string. |
position | The position where you wish to start displaying the string. 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 occupies positions 4-9. |
-
|
- -inline | -
Sets an indicator on the LCD. Use this to turn on one of the indicator segments.
-indicator | One of the indicator segments from the enum. |
-
|
- -inline | -
Sets a pixel. Use this to manually set a pixel with a given common and segment number. See segmap.html.
-com | the common pin, numbered from 0-2. |
seg | the segment pin, numbered from 0-23. |
void watch_start_character_blink | -( | -char | -character, | -
- | - | uint32_t | -duration | -
- | ) | -- |
Blinks a single character in position 7. Does not affect other positions.
-Six of the seven segments in position 7 (and only position 7) are capable of autonomous blinking. This blinking does not require any CPU resources, and will continue even in STANDBY and Sleep mode (but not Deep Sleep mode, since that mode turns off the LCD).
character | The character you wish to blink. |
duration | The duration of the on/off cycle in milliseconds, from 50 to ~4250 ms. |
void watch_start_tick_animation | -( | -uint32_t | -duration | ) | -- |
Begins a two-segment "tick-tock" animation in position 8.
-Six of the seven segments in position 8 (and only position 8) are capable of autonomous animation. This animation is very basic, and consists of moving a bit pattern forward or backward in a shift register whose positions map to fixed segments on the LCD. Given this constraint, an animation across all six segments does not make sense; so the watch library offers only a simple "tick/tock" in segments D and E. This animation does not require any CPU resources, and will continue even in STANDBY and Sleep mode (but not Deep Sleep mode, since that mode turns off the LCD).
duration | The duration of each frame in ms. 500 milliseconds produces a classic tick/tock. |
void watch_stop_blink | -( | -void | -) | -- |
Stops and clears all blinking segments.
-This will stop all blinking in position 7, and clear all segments in that digit.
- -void watch_stop_tick_animation | -( | -void | -) | -- |
Stops the tick/tock animation and clears all animating segments.
-This will stop the animation and clear all segments in position 8.
- -bool watch_tick_animation_is_running | -( | -void | -) | -- |
Checks if the tick animation is currently running.
-
- Sensor Watch
- 0.0.0
-
- A board replacement for the classic Casio F-91W wristwatch, powered by a Microchip SAM L22 microcontroller.
- |
-
This section covers various useful functions that don't fit anywhere else. -More...
--Functions | |
const char * | watch_utility_get_weekday (watch_date_time date_time) |
Returns a two-letter weekday for the given timestamp, suitable for display in positions 0-1 of the watch face. More... | |
uint32_t | watch_utility_convert_to_unix_time (uint16_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, uint8_t second, uint32_t utc_offset) |
Returns the UNIX time (seconds since 1970) for a given date/time in UTC. More... | |
uint32_t | watch_utility_date_time_to_unix_time (watch_date_time date_time, uint32_t utc_offset) |
Returns the UNIX time (seconds since 1970) for a given watch_date_time struct. More... | |
watch_date_time | watch_utility_date_time_from_unix_time (uint32_t timestamp, uint32_t utc_offset) |
Returns the UNIX time (seconds since 1970) for a given watch_date_time struct. More... | |
watch_date_time | watch_utility_date_time_convert_zone (watch_date_time date_time, uint32_t origin_utc_offset, uint32_t destination_utc_offset) |
Converts a time from a given time zone to another time zone. More... | |
float | watch_utility_thermistor_temperature (uint16_t value, bool highside, float b_coefficient, float nominal_temperature, float nominal_resistance, float series_resistance) |
Returns a temperature in degrees Celsius for a given thermistor voltage divider circuit. More... | |
This section covers various useful functions that don't fit anywhere else.
-uint32_t watch_utility_convert_to_unix_time | -( | -uint16_t | -year, | -
- | - | uint8_t | -month, | -
- | - | uint8_t | -day, | -
- | - | uint8_t | -hour, | -
- | - | uint8_t | -minute, | -
- | - | uint8_t | -second, | -
- | - | uint32_t | -utc_offset | -
- | ) | -- |
Returns the UNIX time (seconds since 1970) for a given date/time in UTC.
-date_time | The watch_date_time that you wish to convert. |
year | The year of the date you wish to convert. |
month | The month of the date you wish to convert. |
day | The day of the date you wish to convert. |
hour | The hour of the date you wish to convert. |
minute | The minute of the date you wish to convert. |
second | The second of the date you wish to convert. |
utc_offset | The number of seconds that date_time is offset from UTC, or 0 if the time is UTC. |
watch_date_time watch_utility_date_time_convert_zone | -( | -watch_date_time | -date_time, | -
- | - | uint32_t | -origin_utc_offset, | -
- | - | uint32_t | -destination_utc_offset | -
- | ) | -- |
Converts a time from a given time zone to another time zone.
-date_time | The watch_date_time that you wish to convert |
origin_utc_offset | The number of seconds from UTC in the origin time zone |
destination_utc_offset | The number of seconds from UTC in the destination time zone |
watch_date_time watch_utility_date_time_from_unix_time | -( | -uint32_t | -timestamp, | -
- | - | uint32_t | -utc_offset | -
- | ) | -- |
Returns the UNIX time (seconds since 1970) for a given watch_date_time struct.
-timestamp | The UNIX timestamp that you wish to convert. |
utc_offset | The number of seconds that you wish date_time to be offset from UTC. |
uint32_t watch_utility_date_time_to_unix_time | -( | -watch_date_time | -date_time, | -
- | - | uint32_t | -utc_offset | -
- | ) | -- |
Returns the UNIX time (seconds since 1970) for a given watch_date_time struct.
-date_time | The watch_date_time that you wish to convert. |
utc_offset | The number of seconds that date_time is offset from UTC, or 0 if the time is UTC. |
const char* watch_utility_get_weekday | -( | -watch_date_time | -date_time | ) | -- |
Returns a two-letter weekday for the given timestamp, suitable for display in positions 0-1 of the watch face.
-date_time | The watch_date_time whose weekday you want. |
float watch_utility_thermistor_temperature | -( | -uint16_t | -value, | -
- | - | bool | -highside, | -
- | - | float | -b_coefficient, | -
- | - | float | -nominal_temperature, | -
- | - | float | -nominal_resistance, | -
- | - | float | -series_resistance | -
- | ) | -- |
Returns a temperature in degrees Celsius for a given thermistor voltage divider circuit.
-value | The raw analog reading from the thermistor pin (0-65535) |
highside | True if the thermistor is connected to VCC and the series resistor is connected to GND; false if the thermistor is connected to GND and the series resistor is connected to VCC. |
b_coefficient | From your thermistor's data sheet, the B25/85 coefficient. A typical value will be between 2000 and 5000. |
nominal_temperature | From your thermistor's data sheet, the temperature (in Celsius) at which the thermistor's resistance is at its nominal value. |
nominal_resistance | The thermistor's resistance at the nominal temperature. |
series_resistance | The value of the other resistor in the voltage divider. |
This documentation covers most of the functions you will use to interact with the Sensor Watch hardware. It is divided into the following sections:
- Sensor Watch
- 0.0.0
-
- A board replacement for the classic Casio F-91W wristwatch, powered by a Microchip SAM L22 microcontroller.
- |
-
Analog Input | This section covers functions related to the SAM L22's analog-to-digital converter, as well as configuring and reading values from the five analog-capable pins on the 9-pin connector |
Application Framework | This section covers the functions that you will implement in your app.c file when designing a Sensor Watch app |
Buzzer | This section covers functions related to the piezo buzzer embedded in the F-91W's back plate |
Sleep Control | This section covers functions related to the various sleep modes available to the watch, including Sleep, Deep Sleep, and BACKUP mode |
Buttons & External Interrupts | This section covers functions related to the three buttons: Light, Mode and Alarm, as well as external interrupts from devices on the nine-pin connector |
Digital Input and Output | This section covers functions related to general-purpose input and output signals |
I2C Controller Driver | 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 |
LED Control | This section covers functions related to the bi-color red/green LED mounted behind the LCD |
Real-Time Clock | This section covers functions related to the SAM L22's real-time clock peripheral, including date, time and alarm functions |
Segment LCD Display | 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 |
Debug UART | This section covers functions related to the debug UART, available on pin D1 of the 9-pin connector |
Utility Functions | This section covers various useful functions that don't fit anywhere else |
- Sensor Watch
- 0.0.0
-
- A board replacement for the classic Casio F-91W wristwatch, powered by a Microchip SAM L22 microcontroller.
- |
-
- Sensor Watch
- 0.0.0
-
- A board replacement for the classic Casio F-91W wristwatch, powered by a Microchip SAM L22 microcontroller.
- |
-
-Data Fields | |
-struct { | |
- uint32_t second: 6 | |
- uint32_t minute: 6 | |
- uint32_t hour: 5 | |
- uint32_t day: 5 | |
- uint32_t month: 4 | |
- uint32_t year: 6 | |
} | unit |
-uint32_t | reg |
- Sensor Watch
- 0.0.0
-
- A board replacement for the classic Casio F-91W wristwatch, powered by a Microchip SAM L22 microcontroller.
- |
-
#include <stdint.h>
#include <stdbool.h>
#include "driver_init.h"
#include "watch_app.h"
#include "watch_rtc.h"
#include "watch_slcd.h"
#include "watch_extint.h"
#include "watch_led.h"
#include "watch_buzzer.h"
#include "watch_adc.h"
#include "watch_gpio.h"
#include "watch_i2c.h"
#include "watch_uart.h"
#include "watch_deepsleep.h"
#include "watch_private.h"
Go to the source code of this file.
--Functions | |
bool | watch_is_battery_low (void) |
Returns true when the battery voltage dips below 2.5V. More... | |
bool | watch_is_buzzer_or_led_enabled (void) |
Returns true if either the buzzer or the LED driver is enabled. More... | |
bool watch_is_battery_low | -( | -void | -) | -- |
Returns true when the battery voltage dips below 2.5V.
-A CR2016 battery will have a nominal voltage between 2.9 and 3 volts for most of its lifespan. Once the battery discharges to about 60%, the voltage will drift slightly lower; this may manifest as a dimmer LED. By the time the battery voltage has fallen to 2.5 volts, it will have probably less than 10% of its capacity remaining, and you can expect the voltage to drop relatively quickly as the battery dies.
- -bool watch_is_buzzer_or_led_enabled | -( | -void | -) | -- |
Returns true if either the buzzer or the LED driver is enabled.
-Both the buzzer and the LED use the TCC peripheral to drive their behavior. This function returns true if that peripheral is enabled. You can use this function to determine whether you need to call the watch_disable_leds or or watch_enable_buzzer functions before using these peripherals.
- -
- Sensor Watch
- 0.0.0
-
- A board replacement for the classic Casio F-91W wristwatch, powered by a Microchip SAM L22 microcontroller.
- |
-
- Sensor Watch
- 0.0.0
-
- A board replacement for the classic Casio F-91W wristwatch, powered by a Microchip SAM L22 microcontroller.
- |
-
- Sensor Watch
- 0.0.0
-
- A board replacement for the classic Casio F-91W wristwatch, powered by a Microchip SAM L22 microcontroller.
- |
-
- Sensor Watch
- 0.0.0
-
- A board replacement for the classic Casio F-91W wristwatch, powered by a Microchip SAM L22 microcontroller.
- |
-
- Sensor Watch
- 0.0.0
-
- A board replacement for the classic Casio F-91W wristwatch, powered by a Microchip SAM L22 microcontroller.
- |
-
- Sensor Watch
- 0.0.0
-
- A board replacement for the classic Casio F-91W wristwatch, powered by a Microchip SAM L22 microcontroller.
- |
-
- Sensor Watch
- 0.0.0
-
- A board replacement for the classic Casio F-91W wristwatch, powered by a Microchip SAM L22 microcontroller.
- |
-
- Sensor Watch
- 0.0.0
-
- A board replacement for the classic Casio F-91W wristwatch, powered by a Microchip SAM L22 microcontroller.
- |
-
- Sensor Watch
- 0.0.0
-
- A board replacement for the classic Casio F-91W wristwatch, powered by a Microchip SAM L22 microcontroller.
- |
-
- Sensor Watch
- 0.0.0
-
- A board replacement for the classic Casio F-91W wristwatch, powered by a Microchip SAM L22 microcontroller.
- |
-
- Sensor Watch
- 0.0.0
-
- A board replacement for the classic Casio F-91W wristwatch, powered by a Microchip SAM L22 microcontroller.
- |
-
- Sensor Watch
- 0.0.0
-
- A board replacement for the classic Casio F-91W wristwatch, powered by a Microchip SAM L22 microcontroller.
- |
-
- Sensor Watch
- 0.0.0
-
- A board replacement for the classic Casio F-91W wristwatch, powered by a Microchip SAM L22 microcontroller.
- |
-
- Sensor Watch
- 0.0.0
-
- A board replacement for the classic Casio F-91W wristwatch, powered by a Microchip SAM L22 microcontroller.
- |
-