This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

请教能否把寄存器的“位”作为参数传递给函数



问题的起因是这样的,比如一个函数,其功能是通用的,但是要在函数中对芯片某引脚进行处理,而具体处理哪一个引脚需由调用者决定,问题就在这里:”引脚“在寄存器中是”位“,如果用取地址的语句,如 &GpioDataRegs.GPASET.bit.GPIO19 ,编译无法通过。有没简单的方法可以解决这个问题呢?

我能想到的一个方法就是,传递整个寄存器地址,同时传递一个32位的整数来做逻辑运算,但这样感觉不够简洁。使用的是F28035芯片,CCS5.5.