lib/Seeed_Arduino_AS5600/AS5600.cpp
/*******************************************************
  Method: getMagnetStrength
  In: none
  Out: 0 if no magnet is detected
       1 if magnet is to weak
       2 if magnet is just right
       3 if magnet is to strong
  Description: reads status register andexamins the MH,ML,MD bits
*******************************************************/
getMagnetStrength
In: none
Out: 0 if no magnet is detected
1 if magnet is to weak
2 if magnet is just right
3 if magnet is to strong
Description: reads status register andexamins the MH,ML,MD bits
getMagnetStrength In : none Out : 0 if no magnet is detected 1 if magnet is to weak 2 if magnet is just right 3 if magnet is to strong Description : reads status register andexamins the MH ML MD bits
int AMS_5600::getMagnetStrength()
{
  int magStatus;
  int retVal = 0;
  magStatus = readOneByte(_stat);
  if (detectMagnet() == 1)
  {
    retVal = 2; 
    if (magStatus & 0x10)
      retVal = 1; 
    else if (magStatus & 0x08)
      retVal = 3; 
  }
  return retVal;
}
int AMS_5600 :: getMagnetStrength ( ) { int magStatus ; int retVal = 0 ; magStatus = readOneByte ( _stat ) ; if ( detectMagnet ( ) == 1 ) { retVal = 2 ; if ( magStatus & 0x10 ) retVal = 1 ; else if ( magStatus & 0x08 ) retVal = 3 ; } return retVal ; }
Method: getMagnetStrength
In: none
Out: 0 if no magnet is detected
1 if magnet is to weak
2 if magnet is just right
3 if magnet is to strong
Description: reads status register andexamins the MH,ML,MD bits
Method : getMagnetStrength In : none Out : 0 if no magnet is detected 1 if magnet is to weak 2 if magnet is just right 3 if magnet is to strong Description : reads status register andexamins the MH ML MD bits
/*0 0 MD ML MH 0 0 0*/ /* MD high = magnet detected */ /* ML high = AGC Maximum overflow, magnet to weak*/ /* MH high = AGC minimum overflow, Magnet to strong*/ /*just right */ /*to weak */ /*to strong */