How do you toggle a register?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How do you toggle a register?

518件の閲覧回数
photonflux
Contributor I

Using the K64F-FRDM, how do I toggle a register?

Address: Base Address + 34h offset

Using SPI0 for example.

I want to toggle field 31 CONT - Continuous Peripheral Chip Select Enable

It would be helpful if I was provided two methods of toggling:

1. Via KSDK method

2. Bare register method

Thank you.

タグ(1)
1 返信

432件の閲覧回数
mjbcswitzerland
Specialist V

Hi

SPI0_PUSHR ^= SPI_PUSHR_CONT;

Or
*(volatile unsigned long *)(0x4002c000 + 0x34) ^= 0x80000000;

For best performance

ATOMIC_SET_REGISTER(BIT_BANDING_PERIPHERAL_ADDRESS(SPI0_PUSHR_ADDR, 31));
and
ATOMIC_CLEAR_REGISTER(BIT_BANDING_PERIPHERAL_ADDRESS(SPI0_PUSHR_ADDR, 31));

to use bit-banding to set or clear.

For the details behind the bit banding method see:
https://www.youtube.com/watch?v=FZnkZ1h_EAQ&list=PLWKlVb_MqDQFZAulrUywU30v869JBYi9Q&index=19

Regards

Mark