Library for Modtronix NZ32 STM32 boards, like the NZ32-SC151, NZ32-SB072, NZ32-SE411 and others

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers mx_tick.cpp Source File

mx_tick.cpp

00001 /**
00002  * File:      mx_timer.cpp
00003  *
00004  * Author:    Modtronix Engineering - www.modtronix.com
00005  *
00006  * Description:
00007  *
00008  * Software License Agreement:
00009  * This software has been written or modified by Modtronix Engineering. The code
00010  * may be modified and can be used free of charge for commercial and non commercial
00011  * applications. If this is modified software, any license conditions from original
00012  * software also apply. Any redistribution must include reference to 'Modtronix
00013  * Engineering' and web link(www.modtronix.com) in the file header.
00014  *
00015  * THIS SOFTWARE IS PROVIDED IN AN 'AS IS' CONDITION. NO WARRANTIES, WHETHER EXPRESS,
00016  * IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
00017  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE
00018  * COMPANY SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
00019  * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
00020  */
00021 
00022 #include "mbed.h"
00023 #include "mx_tick.h"
00024 
00025 uint16_t    MxTick::countMs     = 1000;
00026 int32_t     MxTick::tickSec     = 0;
00027 int32_t     MxTick::tickMs      = 0;
00028 bool        MxTick::running     = 0;
00029 
00030 MxTick::MxTick(bool autoInc) {
00031     if(running==false) {
00032         running = true;
00033         if(autoInc == true) {
00034             static Ticker tcr;
00035             tcr.attach_us(&MxTick::increment, 1000);
00036         }
00037     }
00038 }
00039