Sensor Watch 0.0.2
A board replacement for the classic Casio F-91W wristwatch, powered by a Microchip SAM L22 microcontroller.
Loading...
Searching...
No Matches
Macros | Functions
watch.h File Reference
#include <stdint.h>
#include <stdbool.h>
#include "driver_init.h"
#include "pins.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_spi.h"
#include "watch_uart.h"
#include "watch_storage.h"
#include "watch_deepsleep.h"
#include "watch_private.h"

Go to the source code of this file.

Macros

#define SWCLK   GPIO(GPIO_PORTA, 30)
 
#define SWDIO   GPIO(GPIO_PORTA, 31)
 

Functions

bool watch_is_buzzer_or_led_enabled (void)
 Returns true if either the buzzer or the LED driver is enabled.
 
bool watch_is_usb_enabled (void)
 Returns true if USB is enabled.
 
void watch_reset_to_bootloader (void)
 Resets in the UF2 bootloader mode.
 
void cdc_task (void)
 Call periodically from app main loop to service CDC RX/TX.
 
int read (int file, char *ptr, int len)
 Reads up to len bytes from the USB serial.
 
void watch_disable_TRNG ()
 Disables the TRNG twice in order to work around silicon erratum 1.16.1.
 

Function Documentation

◆ read()

int read ( int  file,
char *  ptr,
int  len 
)

Reads up to len bytes from the USB serial.

Parameters
fileignored, you can pass in 0
ptrpointer to a buffer of at least len bytes
lenthe number of bytes you wish to read, max 256.
Returns
The number of bytes read, or zero if no bytes were read.

◆ watch_is_buzzer_or_led_enabled()

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.