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.
Revision 0:748338cb3553, committed 2010-12-17
- Comitter:
- Wijnand
- Date:
- Fri Dec 17 22:19:04 2010 +0000
- Commit message:
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/delay.c Fri Dec 17 22:19:04 2010 +0000 @@ -0,0 +1,59 @@ +/* This file has been prepared for Doxygen **************************/ + +/*! \file delay.c ***************************************************** +* +* \brief This module supports a simple (performance spoiling) +* counting delay for use between mainprogram staps. +* +* <B>Attention:</B> Optimization for this module should be -O0 +* +* Copyright (C) 2008 W.Nijs (ALF4all) +* +* This program 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 +* (at your option) any later version. +* +* This program 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 General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +* +* \author W.Nijs. +* \date 12/03/2009 +* \version 1.0 12/03/2009, initial revision. +* \version 2.0 28/05/2010, prepared for Doxygen. +* +*********************************************************************/ + +/********************************************************************* +* Define section +* Add all #defines here +*********************************************************************/ + +#define counts_per_ms 30000 // for mbed NXP LPC1768 + + +/*****************************************************************//** +* \brief delay +* +* This function supports a simple counting delay. +* +* \author W.Nijs. +* \date 28-05-2010 +* \param ms (int) Delaytime in millieseconds +*********************************************************************/ + +void delay(int ms) { + int count; + + while (ms) { + count = counts_per_ms; + while (count) + count--; + ms--; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/delay.h Fri Dec 17 22:19:04 2010 +0000 @@ -0,0 +1,54 @@ +/* This file has been prepared for Doxygen **************************/ + +/*! \file delay.h ***************************************************** +* +* \brief This module supports a simple (performance spoiling) +* counting delay for use between mainprogram staps. +* +* <B>Attention:</B> Optimization for this module should be -O0 +* +* Copyright (C) 2008 W.Nijs (ALF4all) +* +* This program 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 +* (at your option) any later version. +* +* This program 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 General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +* +* \author W.Nijs. +* \date 12/03/2009 +* \version 1.0 12/03/2009, initial revision. +* \version 2.0 28/05/2010, prepared for Doxygen. +* +*********************************************************************/ + +/********************************************************************* +* Define section +* Add all #defines here +*********************************************************************/ + +#ifndef DELAY_H_ +#define DELAY_H_ + + +/*****************************************************************//** +* \brief delay +* +* This function supports a simple counting delay. +* +* \author W.Nijs. +* \date 28-05-2010 +* \param ms (int) Delaytime in millieseconds +*********************************************************************/ + +void delay(int ms); + + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.c Fri Dec 17 22:19:04 2010 +0000 @@ -0,0 +1,71 @@ +/* This file has been prepared for Doxygen **************************/ + +/*! \file main.c ***************************************************** +* +* \brief Test program for the compiler chain and the the mbed NXP +* LPC1768 target. +* +* Uses the module: delay. +* +* Copyright (C) 2008 W.Nijs (ALF4all) +* +* This program 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 +* (at your option) any later version. +* +* This program 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 General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +* +* \author W.Nijs. +* \date 12/03/2009 +* \version 1.0 12/03/2009, initial revision. +* \version 2.0 28/05/2010, prepared for Doxygen. +* +*********************************************************************/ + +/*****************************************************************//** +* Include section +* Add all #includes here +*********************************************************************/ + +#include "mbed.h" +#include "delay.h" + + +/*****************************************************************//** +* \brief main +* +* Testprogram heartbeat-0, using LED1. +* +* \author W.Nijs. +* \date 28-05-2010 +*********************************************************************/ + +DigitalOut heartbeat(LED1); + +int main() { + int i = 0; + + while (1) { + if ((i==0)||(i==3)) { + heartbeat = 1; + } else { + heartbeat = 0; + }; + if (i>=9) { + i = 0; + } else { + i++; + }; + + delay(100); + }; + + return 0; +};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Dec 17 22:19:04 2010 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/e2ac27c8e93e