[Solved] Need Help with portInputRegister()
Posted: Fri Nov 20, 2015 5:01 am
Hi,
First of all Thank you very much to add the ESP8266 board to the arduino IDE, it's soo good !
I'm trying to add the compatibility of the ESP8266 to a sketch design for arduino Mega board.
Thanks to your work on the IDE, almost all is working out of the box.
But unfortunately a small part of the code use register and port (with digitalpintoport() ) and i guess the esp8266 doesn't have port like the Mega board.
here is the part of the code :
If i print the value of Fport, it display 0 . Is it the cause of the issue ?
How to make the portInputRegister() working ?
ps: the program compile fine
First of all Thank you very much to add the ESP8266 board to the arduino IDE, it's soo good !
I'm trying to add the compatibility of the ESP8266 to a sketch design for arduino Mega board.
Thanks to your work on the IDE, almost all is working out of the box.
But unfortunately a small part of the code use register and port (with digitalpintoport() ) and i guess the esp8266 doesn't have port like the Mega board.
here is the part of the code :
Code: Select all
uint8_t Fbit=0;
uint8_t Fport=0;
uint8_t FstateMask=0;
boolean FetchSignal(byte DataPin, boolean StateSignal) {
uint8_t Fbit = digitalPinToBitMask(DataPin);
uint8_t Fport = digitalPinToPort(DataPin);
uint8_t FstateMask = (StateSignal ? Fbit : 0);
if ((*portInputRegister(Fport) & Fbit) == FstateMask) {
// do some stuff, but for the moment the program never go here :(
}
}
// the function above is call like that :
// FetchSignal(PIN_RF_RX_DATA,HIGH)
// the PIN_RF_RX_DATA is define at 19 for the Mega board
// the PIN_RF_RX_DATA is define at D6 for the esp8266 board
If i print the value of Fport, it display 0 . Is it the cause of the issue ?
How to make the portInputRegister() working ?
ps: the program compile fine