Beispiel #1
0
/* ===================================================================*/
bool ExtIntLdd5_GetVal(LDD_TDeviceData *DeviceDataPtr)
{
  (void)DeviceDataPtr;                 /* Parameter is not used, suppress unused argument warning */
  if ((GPIO_PDD_GetPortDataInput(PTE_BASE_PTR) & ExtIntLdd5_PIN_MASK) != 0U) {
    return TRUE;
  } else {
    return FALSE;
  }
}
Beispiel #2
0
/*
** ===================================================================
**     Method      :  BitIoLdd1_GetVal (component BitIO_LDD)
**
**     Description :
**         Returns the input/output value. If the direction is [input]
**         then the input value of the pin is read and returned. If the
**         direction is [output] then the last written value is read
**         and returned (see <Safe mode> property for limitations).
**         This method cannot be disabled if direction is [input].
**     Parameters  :
**         NAME            - DESCRIPTION
**       * DeviceDataPtr   - Device data structure
**                           pointer returned by <Init> method.
**     Returns     :
**         ---             - Input or output value. Possible values:
**                           <false> - logical "0" (Low level)
**                           <true> - logical "1" (High level)
** ===================================================================
*/
bool BitIoLdd1_GetVal(LDD_TDeviceData *DeviceDataPtr)
{
  uint32_t portData;                   /* Port data masked according to the bit used */

  (void)DeviceDataPtr;                 /* Parameter is not used, suppress unused argument warning */

  portData = GPIO_PDD_GetPortDataInput(BitIoLdd1_MODULE_BASE_ADDRESS) & BitIoLdd1_PORT_MASK;

  return (portData != 0U) ? (bool)TRUE : (bool)FALSE;
}
/* ===================================================================*/
uint32_t BitsIoLdd2_GetVal(LDD_TDeviceData *DeviceDataPtr)
{
  uint32_t portData;

  (void)DeviceDataPtr;                 /* Parameter is not used, suppress unused argument warning */

  portData = GPIO_PDD_GetPortDataInput(BitsIoLdd2_MODULE_BASE_ADDRESS) & BitsIoLdd2_PORT_MASK;


  return portData >> BitsIoLdd2_PIN_ALLOC_0_INDEX; /* Return port data shifted with the offset of the first allocated pin*/
}
Beispiel #4
0
void testa4() {
	if (PORT_PDD_GetPinInterruptFlag(PORTD_BASE_PTR, 3) ) {
		COLUNA_PutVal(0b110);
		if (GPIO_PDD_GetPortDataInput(LINHA_DEVICE) & GPIO_PIN(3)) {
			COLUNA_PutVal(0b101);
			if (GPIO_PDD_GetPortDataInput (LINHA_DEVICE) & GPIO_PIN(3)) {
				COLUNA_PutVal(0b011);
				if (GPIO_PDD_GetPortDataInput(LINHA_DEVICE) & GPIO_PIN(3)) {
					keypad_valor = '!';
				} else {
					keypad_valor = '*';
				}
			} else {
				keypad_valor = '0';
			}
		} else {
			keypad_valor = '#';
		}
		COLUNA_PutVal(0b000);
		PORT_PDD_ClearPinInterruptFlag(PORTD_BASE_PTR, 3);
	}
}
Beispiel #5
0
/* ===================================================================*/
bool BitIoLdd4_GetVal(LDD_TDeviceData *DeviceDataPtr)
{
  uint32_t PortData;                   /* Port data masked according to the bit used */

  (void)DeviceDataPtr;                 /* Parameter is not used, suppress unused argument warning */
  if ((GPIO_PDD_GetPortDirection(BitIoLdd4_MODULE_BASE_ADDRESS) & BitIoLdd4_PORT_MASK) == 0U) {
    /* Port is configured as input */
    PortData = GPIO_PDD_GetPortDataInput(BitIoLdd4_MODULE_BASE_ADDRESS) & BitIoLdd4_PORT_MASK;
  } else {
    /* Port is configured as output */
    PortData = GPIO_PDD_GetPortDataOutput(BitIoLdd4_MODULE_BASE_ADDRESS) & BitIoLdd4_PORT_MASK;
  }
  return (PortData != 0U) ? (bool)TRUE : (bool)FALSE;
}
Beispiel #6
0
/*
** ===================================================================
**     Method      :  BitsIoLdd4_GetVal (component BitsIO_LDD)
**
**     Description :
**         Returns the value of the Input/Output component. If the
**         direction is [input] then reads the input value of the pins
**         and returns it. If the direction is [output] then returns
**         the last written value (see <Safe mode> property for
**         limitations).
**     Parameters  :
**         NAME            - DESCRIPTION
**       * DeviceDataPtr   - Device data structure
**                           pointer returned by <Init> method.
**     Returns     :
**         ---             - Input value
** ===================================================================
*/
dword BitsIoLdd4_GetVal(LDD_TDeviceData *DeviceDataPtr)
{
  dword portData;

  (void)DeviceDataPtr;                 /* Parameter is not used, suppress unused argument warning */

  if ((GPIO_PDD_GetPortDirection(BitsIoLdd4_MODULE_BASE_ADDRESS) & BitsIoLdd4_PORT_MASK) != 0U) {
    /* port is configured as output */
    portData = GPIO_PDD_GetPortDataOutput(BitsIoLdd4_MODULE_BASE_ADDRESS) & BitsIoLdd4_PORT_MASK;
  } else {
    /* port is configured as input */
    portData = GPIO_PDD_GetPortDataInput(BitsIoLdd4_MODULE_BASE_ADDRESS) & BitsIoLdd4_PORT_MASK;
  }

  return portData >> BitsIoLdd4_PIN_ALLOC_0_INDEX; /* Return port data shifted with the offset of the first allocated pin*/
}
Beispiel #7
0
/* ===================================================================*/
LEDRed_TFieldValue LEDRed_GetFieldValue(LDD_TDeviceData *DeviceDataPtr, LDD_GPIO_TBitField Field)
{
  (void)DeviceDataPtr;                 /* Parameter is not used, suppress unused argument warning */
  switch (Field) {                     /* no break */
    case LED_RED: {                    /* bit field #0 */
      return
        (LEDRed_TFieldValue)(
          (
            GPIO_PDD_GetPortDataInput(LEDRed_MODULE_BASE_ADDRESS)
            & (LEDRed_TPortValue)LEDRed_LED_RED_MASK
          )
          >> LEDRed_LED_RED_START_BIT
        );
    }
    default:
      break;                           /* Invalid BitField is not treated, result is undefined */
  } /* switch (Field) */
  return (LEDRed_TFieldValue)0U;
}
Beispiel #8
0
/*
** ===================================================================
**     Method      :  BitsIoLdd4_GetBit (component BitsIO_LDD)
**
**     Description :
**         Returns the value of the specified bit/pin of the
**         Input/Output component. If the direction is [input] then it
**         reads the input value of the pin and returns it. If the
**         direction is [output] then it returns the last written value
**         (see <Safe mode> property for limitations).
**     Parameters  :
**         NAME            - DESCRIPTION
**       * DeviceDataPtr   - Device data structure
**                           pointer returned by <Init> method.
**         Bit             - Bit/pin number to read
**       * BitVal          - The returned value: 
**                           <false> - logical "0" (Low level)
**                           <true> - logical "1" (High level)
**     Returns     :
**         ---             - Error code, possible values:
**                           ERR_OK - OK
**                           ERR_PARAM_MASK - Invalid pin index
**                           ERR_VALUE - Invalid output parameter
** ===================================================================
*/
LDD_TError BitsIoLdd4_GetBit(LDD_TDeviceData *DeviceDataPtr, byte Bit, bool *BitVal)
{
  uint32_t mask = 0;
  uint32_t portVal;

  (void)DeviceDataPtr;                 /* Parameter is not used, suppress unused argument warning */

  /* Bit number value - this test can be disabled by setting the "Ignore range checking"
     property to the "yes" value in the "Configuration inspector" */
  if (Bit > 3U) {
    return ERR_PARAM_MASK;
  }

  /* Bit value returned - this test can be disabled by setting the "Ignore range checking"
     property to the "yes" value in the "Configuration inspector" */
  if (NULL == BitVal) {
    return ERR_VALUE;
  }

  mask = BitsIoLdd4_PIN_MASK_MAP[Bit];

  if ((GPIO_PDD_GetPortDirection(BitsIoLdd4_MODULE_BASE_ADDRESS) & mask) != 0U) {
    /* Port is configured as output */
    portVal = GPIO_PDD_GetPortDataOutput(BitsIoLdd4_MODULE_BASE_ADDRESS);
  } else {
    /* Port is configured as input */
    portVal = GPIO_PDD_GetPortDataInput(BitsIoLdd4_MODULE_BASE_ADDRESS);
  }

  if ((portVal & mask) != 0U) {
    *BitVal = (bool)TRUE;
  }
  else {
    *BitVal = (bool)FALSE;
  }

  return ERR_OK;
}
Beispiel #9
0
/* ===================================================================*/
LDD_TError BitsIoLdd1_GetBit(LDD_TDeviceData *DeviceDataPtr, uint8_t Bit, bool *BitVal)
{
  uint32_t Mask = 0;

  (void)DeviceDataPtr;                 /* Parameter is not used, suppress unused argument warning */
  /* Bit number value - this test can be disabled by setting the "Ignore range checking"
     property to the "yes" value in the "Configuration inspector" */
  if (Bit > 7U) {
    return ERR_PARAM_INDEX;
  }
  /* Bit value returned - this test can be disabled by setting the "Ignore range checking"
     property to the "yes" value in the "Configuration inspector" */
  if (BitVal == NULL) {
    return ERR_PARAM_VALUE;
  }
  Mask = BitsIoLdd1_PIN_MASK_MAP[Bit];
  if ((GPIO_PDD_GetPortDataInput(BitsIoLdd1_MODULE_BASE_ADDRESS) & Mask) != 0U) {
    *BitVal = (bool)TRUE;
  } else {
    *BitVal = (bool)FALSE;
  }
  return ERR_OK;
}