spacewrench
Active member
Does anybody know how to use the Teensy3 in raw C mode (not using the Arduino stuff)? I have my compiler set up, and I'm using the mk20dx128.{c,h,ld} from the Arduino Teensy directory, but with the following code in my main():
I think this should blink the LED, but it doesn't, so I'd guess I'm not enabling digital mode or output or GPIO clock or something. (GPIO clock is actually set in the mk20dx128.c startup code, but anyway...)
Code:
PORTC_PCR5 = (0b001 << 8) | (1 << 6);
GPIOC_PDIR = (1 << 5); // Port C5 = output
GPIOC_PDOR = 0;
for ( ; ; ) {
GPIOC_PTOR = (1 << 5);
for (unsigned i = 0; i < 5000000; ++i) asm( "nop" );
}
I think this should blink the LED, but it doesn't, so I'd guess I'm not enabling digital mode or output or GPIO clock or something. (GPIO clock is actually set in the mk20dx128.c startup code, but anyway...)