Disable Rx/Tx LED-use PD5 on Leonardo

I wasnt sure which section to put this in since theres no specific "Leonardo/ATMega32u4" section...moderators, feel free to move it if you think its better suited somewhere else...

Quick question regarding pin assignments on the Leonardo/ATMega32u4.

Im designing a custom board using the ATMega32u4 running the Arduino Leonardo bootloader.

I need an extra pin, and on my board, pin-22 (PD5/TXLED) is right next to the peripheral I need to control.

I really dont care about having the TX/RX LED's on the board; its going to be a finished production product so the TX/RX LED's are useless. I would be happy eliminating both completely, or maybe shifting both RX and TX activity indications to the one RX LED...whatever is easier.

I want to be able to still use USB for uploading new code revisions (rather than just using ISP every time I want to revise code), so I need to permanently disable those pins' assignment to RX/TX in the bootloader/code rather than just "setting them low" manually in the program loop.

I found some stuff relating to this, but the thread is really old and seems to be dealing with much older versions of Arduino, and were confusing to follow with the IDE version Im running (1.6.7, I know its not the latest, but some of my programs refuse to compile correctly on the latest, so Im running 1.6.7, it works just fine for me).

Does anyone have any "quick and simple" way to disable them? I assume Ill be dealing with the caterina.c and caterina.h files located in C\program files(x86)\arduino\hardware\arduino\avr\bootloaders\caterina folder.

Or maybe someone knows what I can just "$FF" out in the .hex bootloader file? When you use "burn bootloader" in the Arduino IDE, which .hex file does it point to? (caterina-leonardo.hex, leonardo-prod-firmware-12-10.hex, etc).

Thanks
Ben

Depending one what you plan to do with the pin, you may not need to do anything other than use the pin. If you are using it as input, and don't mind the pin "flashing" harmlessly during uploading or when you are using Serial statements, just use the pin. A resistor would keep it from contending with an input. Perhaps you could re-arrange your pin usage so the RXLED or TXLED pin is used for something that would not conflict with the flashing, such as input from a button.

If you want it completely free of influence from the bootloader or from Serial usage, then you will need to custom compile a Caterina bootloader that does not use that pin, or that uses a different pin, and you will need to build a custom core that does not use that pin when Serial is used. If you sketch does not use Serial at all, then you don't need to worry about customizing the core.

How many pins are you actually using? Are you already using all of D0-D13 and A0-A5? D0 and D1 are available and would only conflict if you are using Serial1. D14, D15, and D16 are ICSP or SPI pins, so those may be available, too. I was not sure from reading your post if you have already considered those extra pins.