new ticker

Dependents:   newTicker_demo

NewTicker.h

Committer:
lisper
Date:
2014-10-31
Revision:
1:c8bc7e989caf
Parent:
0:c143e6906ab5

File content as of revision 1:c8bc7e989caf:

/*******************************************************************************
 * This file is part of the NewTicker library.                                 *
 *                                                                             *
 * NewTicker is free software: you can redistribute it and/or                  *
 * modify it under the terms of the GNU General Public License as              *
 * published by the Free Software Foundation, either version 3 of              *
 * the License, or any later version.                                          *
 *                                                                             *
 * NewTicker is distributed in the hope that it will be useful,                *
 * but WITHOUT ANY WARRANTY; without even the implied warranty of              *
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               *
 * GNU Lesser General Public License for more details.                         *
 *                                                                             *
 * NewTicker is distributed in the hope that it will be useful,                *
 * but WITHOUT ANY WARRANTY; without even the implied warranty of              *
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               *
 * GNU Lesser General Public License for more details.                         *
 *                                                                             *
 * You should have received a copy of the GNU Lesser General Public            *
 * License along with NewTicker. If not, see                                   *
 * <http://www.gnu.org/licenses/>.                                             *
 ******************************************************************************/

/*
 *  Copyright:  DFRobot
 *  name:       NewTicker
 *  version:    1.0
 *  Author:     lisper (lisper.li@dfrobot.com)
 *  Date:       2014-10-30
 *  Description:    new ticker library for mbed
 */

#include "mbed.h"
#include "millis.h"

class NewTicker
{
public:
    NewTicker ();
    void attach (void (*theTickerHandler) (), uint32_t theDelayTime);
    void detach ();
    void update ();
private:
    uint32_t nowTime;
    uint32_t delayTime;
    void (*tickerHandler) (void);
};