sparkfun / Arduino_Apollo3

Arduino core to support the Apollo3 microcontroller from Ambiq Micro
83 stars 37 forks source link

incomplete definition of GPIO's for EDGE #464

Open paulvha opened 2 years ago

paulvha commented 2 years ago

If people want to use the pinName or pinNumber for pinMode(), digitalWrite(), digitalRead() based on the schematics, the setting will fail. Also using a standard blink sketch will fail with NO Blink happening :

void setup() {

  Serial.begin(115200);
  pinMode(46, OUTPUT);

}

void loop() {

  digitalWrite(46, HIGH);   // turn the LED on (HIGH is the voltage level)
  Serial.println("low");

  delay(1000);                       // wait for a second

  digitalWrite(46, LOW);    // turn the LED off by making the voltage LOW
  Serial.println("high");

  delay(1000);                       // wait for a second
} 

Root cause Only the 4 external available GPIO's are defined.

Solution The solution is to extend the 'variantPinStates' structure in the ../../variant/edge/config/pins.cpp. This will allow that ALL the connected GPIO's on the edge can be addressed. I have created a pull request for that.(https://github.com/sparkfun/Arduino_Apollo3/pull/465)

Next to that the ../../cores/mbed-os/targets/TARGET_Ambiq_Micro/TARGET_Apollo3/TARGET_SFE_EDGE/PinNames.h needs to be adjusted. Attached in the updated file. PinNames.zip

regards, Paul