Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: EthernetInterface mbed-rtos
Timer1ExecutionContext.cpp
00001 #define RTNO_SUBMODULE_DEFINE 00002 00003 #include <stdint.h> 00004 #include "RTno.h" 00005 #include "Packet.h" 00006 #include "Timer1ExecutionContext.h" 00007 //#include <avr/io.h> 00008 //#include <avr/interrupt.h> 00009 00010 static float m_Period; 00011 //static uint8_t m_ClockSetting; 00012 00013 Ticker *m_pTimer; 00014 00015 void Timer1EC_start(); 00016 void Timer1EC_suspend(); 00017 void Timer1EC_resume(); 00018 00019 void tick () { 00020 EC_execute(); 00021 } 00022 00023 00024 void Timer1EC_init(double rate) 00025 { 00026 EC_init(0x22); 00027 m_pTimer = new Ticker(); 00028 // Initialize Period 00029 m_Period = (1.0 / rate); 00030 EC_start = Timer1EC_start; 00031 EC_suspend = Timer1EC_suspend; 00032 EC_resume = Timer1EC_resume; 00033 } 00034 00035 void Timer1EC_start() 00036 { 00037 m_pTimer->attach(tick, m_Period); 00038 } 00039 00040 void Timer1EC_suspend() 00041 { 00042 m_pTimer->detach(); 00043 } 00044 00045 void Timer1EC_resume() 00046 { 00047 Timer1EC_start(); 00048 } 00049 00050
Generated on Fri Jul 22 2022 21:22:50 by
1.7.2