Coder Social home page Coder Social logo

mongoose-ds3231's Introduction

mongoose-ds3231

Mongoose OS I2C driver for the DS3231 real-time clock.

Overview

This driver enables control of the DS3231 real-time clock over I2C on Mongoose OS. This only supports time functions and alarms are not currently implemented.

Setup

  1. Copy the ds3231 directory into the firmware's src directory and add it to the sources section of mos.yml
  2. Enable the Mongoose OS I2C connection by adding ["i2c.enable", true], in conf_schema.yaml
  3. Include the header "ds3231/ds3231.h" in the appropriate places

Usage

Setting the current date and time

// Sunday, June 11, 2017 1:30:00 PM
const struct datetime dt = {
	.second = 0,
	.minute = 30,
	.hour = 13,
	.weekday = 7,
	.day = 11,
	.month = 6,
	.year = 2017
};

ds3231_set_datetime(&dt);

Getting the current date and time

struct datetime dt;

ds3231_get_datetime(&dt);

Checking for power loss

if (ds3231_lost_power()) {
	// Power lost...
}

mongoose-ds3231's People

Contributors

ollieday avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.