Giter Club home page Giter Club logo

igh_rtc's Introduction

Igh system RTC HAL driver

Module name: igh_time

The module has the following public APIs:

void igh_time_init(void); //initializes the rtc module
bool igh_time_is_valid( void ); // returns true if current time is after January 1st 2021
uint32_t igh_time_now( void ); // returns the current unix time
bool igh_time_set( uint32_t unix_time ); // sets the current RTC time and returns true if 
successful
DateTime igh_datetime(void);//returns a DateTime object of the current time

Flashing to device over serial

$ make flash

This will build the firmware and put the device in dfu mode ready to be flashed with the firmware binary via usb.

Expected output

daniel@dan:~/Desktop/synnefa/firmware/rtc_test$ make flash
particle compile boron . --saveTo rtc-test-boron.bin

Compiling code for boron

Including:
    src/include/igh_time.h
    src/include/RTClib.h
    src/rtc_test.cpp
    src/src/igh_time.cpp
    src/src/RTClib.cpp
    project.properties

attempting to compile firmware
downloading binary from: /v1/binaries/62207b69f4cfff43a2628b01
saving to: rtc-test-boron.bin
Memory use:
   text    data     bss     dec     hex filename
   5788     200     616    6604    19cc /workspace/target/workspace.elf

Compile succeeded.
Saved firmware to: /home/daniel/Desktop/synnefa/firmware/rtc_test/rtc-test-boron.bin
particle usb dfu
Done.
particle flash --usb rtc-test-boron.bin

Flash success!

Serial monitor

$ make serial

Expected Output

$ daniel@dan:~/Desktop/synnefa/firmware/rtc_test$ make serial 
particle serial monitor
Opening serial monitor for com port: "/dev/ttyACM0"
Serial monitor opened successfully:
Current DATETIME: 2022/3/3 (Thursday) 11:26:26
Unix epoch time: 1646306786
Is the time valid: Yes!
Current DATETIME: 2022/3/3 (Thursday) 11:26:28
Unix epoch time: 1646306788
Is the time valid: Yes!
Current DATETIME: 2022/3/3 (Thursday) 11:26:30
Unix epoch time: 1646306790
Is the time valid: Yes!

ToDo

  • Add unit tests sigh...

igh_rtc's People

Contributors

dannduati avatar

Stargazers

 avatar

Watchers

 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.