Sensor Watch 0.0.2
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. | |
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_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.