B4R Question How to control the registers of Arduino

howard bassen

Member
Licensed User
Longtime User
How do I insert the following command to set the analog to digital converter to a higher speed

REG_ADC_MR = (REG_ADC_MR & 0xFFF0FFFF) | 0x00020000
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
You can use RunNative to call native code:
B4X:
Private Sub AppStart
   Serial1.Initialize(115200)
   Log("AppStart")
   RunNative("SetA2DSpeed", Null)
End Sub

#if C
void SetA2DSpeed (B4R::Object* u) {
   REG_ADC_MR = (REG_ADC_MR & 0xFFF0FFFF) | 0x00020000;
}
#End If
I'm not sure where does this code come from however I'm getting the following error:

'REG_ADC_MR' was not declared in this scope
 
Upvote 0
Top