Created
May 10, 2015 09:36
-
-
Save ksvbka/d223e9b7f1d9449880f3 to your computer and use it in GitHub Desktop.
Define marco for delay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef DELAY_H | |
#define DELAY_H | |
#include msp430g2553.h | |
#ifndef F_CPU | |
#warning F_CPU not defined for <delay.h>. Using default | |
#define F_CPU 1000000UL // 1 MHz | |
#endif | |
#if !(F_CPU) | |
#error "F_CPU must be a constant value" | |
#endif | |
#define _delay_ms(ms) __delay_cycles((F_CPU*ms)/1000UL) | |
#define _delay_us(us) __delay_cycles((F_CPU*us)/1000000UL) | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment