Skip to content

Instantly share code, notes, and snippets.

@jsleeio
Created July 13, 2013 11:35
Show Gist options
  • Save jsleeio/5990413 to your computer and use it in GitHub Desktop.
Save jsleeio/5990413 to your computer and use it in GitHub Desktop.
#ifndef IG_MSP430_MISC_H__
#define IG_MSP430_MISC_H__
#define pinmode_out(port,pin) P##port##DIR |= BIT##pin
#define stop_watchdog() WDTCTL = WDTPW | WDTHOLD
#define delay(x) for (volatile int _delayctr = 0; _delayctr < (x); _delayctr++);
#define port_clear(port) P##port##OUT = 0
#define pin_on(port,pin) P##port##OUT |= BIT##pin
#define pin_off(port,pin) P##port##OUT &= ~(BIT##pin)
#define pin_toggle(port,pin) P##port##OUT ^= BIT##pin
#define green_led_on() pin_on(1,0)
#define green_led_off() pin_off(1,0)
#define green_led_toggle() pin_toggle(1,0)
#define red_led_on() pin_on(1,6)
#define red_led_off() pin_off(1,6)
#define red_led_toggle() pin_toggle(1,6)
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment