Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 2 of 2

Thread: Toggle output port with register

  1. #1
    Junior Member
    Join Date
    Sep 2014
    Location
    Paris
    Posts
    19

    Toggle output port with register

    Hi all,

    I'm looking for a way to toggle output port directly with the GPIOx_PTOR register as it's specified page 1336:
    https://www.pjrc.com/teensy/K20P64M72SF1RM.pdf

    My problem is to match the teensy3.2 pin with the register. If I want toggle pin 13 (embedded led), what is the register value that I have to set ? GPIOA, B, C, D, E ?

    In advance many thanks. Bruno

  2. #2
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    12,380
    Support has recently been added for :: digitalToggleFast()

    That code is in :: hardware\teensy\avr\cores\teensy3\core_pins.h:

    for pin13 the code uses this when the pin number supplied is a CONSTANT compile time value:
    Code:
    static inline void digitalToggleFast(uint8_t pin)
    {
    	if (__builtin_constant_p(pin)) {
    ...
    		else if (pin == 13) {
    			CORE_PIN13_PORTTOGGLE = CORE_PIN13_BITMASK;
    		}

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •