Skip to content

Instantly share code, notes, and snippets.

View AmmarShaqeel's full-sized avatar
💭

Ammar AmmarShaqeel

💭
View GitHub Profile
@sedm0784
sedm0784 / CapsLockCtrlEscape.ahk
Last active June 16, 2024 04:27
AutoHotkey script to map Caps Lock to Escape when it's pressed on its own and Ctrl when used in combination with another key, à la Steve Losh. Adapted from one that does something similar with the Ctrl Key on the Vim Tips Wiki (http://vim.wikia.com/wiki/Map_caps_lock_to_escape_in_Windows?oldid=32281). (Plus contribs from @randy909 & @mmikeww.)
g_LastCtrlKeyDownTime := 0
g_AbortSendEsc := false
g_ControlRepeatDetected := false
*CapsLock::
if (g_ControlRepeatDetected)
{
return
}
anonymous
anonymous / MSP430 C Code Fluctuating PWM
Created December 21, 2010 23:39
MSP430 C Code Fluctuating PWM
//******************************************************************************
// MSP430F20xx Demo - Timer_A, PWM TA1-2, Up Mode, DCO SMCLK
//
// Description: This program generates one PWM output on P1.6 using
// Timer_A configured for up mode. The value in CCR0, 1000-1, defines the PWM
// period and the value in CCR1 the PWM duty cycles.
// Timer_A throws an interupt every time CCR1 is reached.
// CCR1 is incremented until it reaches CCR0, at which point it is decremented until it reaches one.
// This process is repeated producing a fluctuating duty cycle creating a PWM signal which can pulse an led.
// ACLK = na, SMCLK = MCLK = TACLK = default DCO
#include <msp430x20x3.h>
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
P1DIR |= BIT6; // Set P1.6 to output direction
P1SEL |= BIT6; // P1.6 to TA0.1
CCR0 = 1000-1; // PWM Period