mamalala wrote:Hello all,
There are several registers that allow setting/clearing a pin that is as output, making a pin an input or output, and reading an input pin. First i added these PROVIDE's to the main linker script, eagle.app.v6.ld, to make those registers available:Code: Select all
PROVIDE(PIN_OUT = 0x60000300);
PROVIDE(PIN_OUT_SET = 0x60000304);
PROVIDE(PIN_OUT_CLEAR = 0x60000308);
PROVIDE(PIN_DIR = 0x6000030C);
PROVIDE(PIN_DIR_OUTPUT = 0x60000310);
PROVIDE(PIN_DIR_INPUT = 0x60000314);
PROVIDE(PIN_IN = 0x60000318);
PROVIDE(PIN_0 = 0x60000328);
PROVIDE(PIN_2 = 0x60000330);
I takte then that I have to download the SDK again? or just add these lines in the LD file?
mcsa wrote:I dont Inderstand how to write in registers. For example in PIN_OUT
WRITE_PERI_REG(PIN_OUT,0x05) set gpio0 and gpio2 high. Right or no?
No. The purpose of defining tzhe registers directly is to allow direct access to them, instead of going through the WRITE_PERI_REG stuff. For example:
PIN_OUT = 0x00000005;
should do what you want. Of course the pin has to be set up as an output first.