Example #1
0
void HAL_LED_Toggle(uint8_t led) {
  if(led < LED_COUNT) {
    if(PIO_GetOutputDataStatus(&pinsLeds[led]))
      PIO_Clear(&pinsLeds[led]);
    else
      PIO_Set(&pinsLeds[led]);
  }
}
Example #2
0
void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
{
    if( uxLED < partestNUM_LEDS ) {
        if( PIO_GetOutputDataStatus( &( xLEDPins[ uxLED ] ) ) ) {
            PIO_Clear( &( xLEDPins[ uxLED ] ) );
        } else {
            PIO_Set( &( xLEDPins[ uxLED ] ) );
        }
    }
}
Example #3
0
extern void digitalWrite( uint32_t ulPin, uint32_t ulVal )
{
  /* Handle */
	if ( g_APinDescription[ulPin].ulPinType == PIO_NOT_A_PIN )
  {
    return ;
  }

  if ((g_pinStatus[ulPin] & 0xF) == PIN_STATUS_PWM) {
    pinMode(ulPin, OUTPUT);
  }

  g_pinStatus[ulPin] = (g_pinStatus[ulPin] & 0x0F) | (ulVal << 4) ;

  if ( PIO_GetOutputDataStatus( g_APinDescription[ulPin].pPort, g_APinDescription[ulPin].ulPin ) == 0 )
  {
    PIO_PullUp( g_APinDescription[ulPin].pPort, g_APinDescription[ulPin].ulPin, ulVal ) ;
  }
  else
  {
    PIO_SetOutput( g_APinDescription[ulPin].pPort, g_APinDescription[ulPin].ulPin, ulVal, 0, PIO_PULLUP ) ;
  }
}
extern void digitalWrite( uint32_t ulPin, uint32_t ulVal )
{
  /* Handle */
	if ( g_APinDescription[ulPin].ulPinType == PIO_NOT_A_PIN )
  {
    return ;
  }

    /* Added by Y.Ishioka */
    if( ulPin == 13 ) {
        led_set( ulVal & 0x01 ) ;
        return ;
    }


  if ( PIO_GetOutputDataStatus( g_APinDescription[ulPin].pPort, g_APinDescription[ulPin].ulPin ) == 0 )
  {
    PIO_PullUp( g_APinDescription[ulPin].pPort, g_APinDescription[ulPin].ulPin, ulVal ) ;
  }
  else
  {
    PIO_SetOutput( g_APinDescription[ulPin].pPort, g_APinDescription[ulPin].ulPin, ulVal, 0, PIO_PULLUP ) ;
  }
}
Example #5
0
/*
    Function: LED_Toggle
        Toggles the current state of a LED.

    Parameters:
        led - Number of the LED to toggle.

    Returns:
        1 if the LED has been toggled; otherwise 0.
*/
unsigned char LED_Toggle(unsigned int led)
{
#ifdef PINS_LEDS
    // Check if LED exists
    if (led >= numLeds) {

        return 0;
    }

    // Toggle LED
    if (PIO_GetOutputDataStatus(&pinsLeds[led])) {

        PIO_Clear(&pinsLeds[led]);
    }
    else {

        PIO_Set(&pinsLeds[led]);
    }

    return 1;
#else
    return 0;
#endif
}
Example #6
0
/**
 *  Toggles the current state of a LED.
 *
 *  \param led  Number of the LED to toggle.
 *  \return 1 if the LED has been toggled; otherwise 0.
 */
uint8_t ledToggle(uint32_t led)
{
#ifdef PINS_LEDS
    /* Check if LED exists */
    if(led >= NUM_LEDS)
    {
        return 0 ;
    }

    /* Toggle LED */
    if(PIO_GetOutputDataStatus(&LEDS[led]))
    {
        PIO_Clear(&LEDS[led]);
    }
    else
    {
        PIO_Set(&LEDS[led]);
    }

    return 1 ;
#else
    return 0 ;
#endif
}
Example #7
0
/**
 *  Toggles the current state of a LED.
 *
 *  \param led  Number of the LED to toggle.
 *  \return 1 if the LED has been toggled; otherwise 0.
 */
extern uint32_t LED_Toggle( uint32_t dwLed )
{
#ifdef PINS_LEDS
    /* Check if LED exists */
    if ( dwLed >= numLeds )
    {
        return 0 ;
    }

    /* Toggle LED */
    if ( PIO_GetOutputDataStatus( &pinsLeds[dwLed] ) )
    {
        PIO_Clear( &pinsLeds[dwLed] ) ;
    }
    else
    {
        PIO_Set( &pinsLeds[dwLed] ) ;
    }

    return 1 ;
#else
    return 0 ;
#endif
}
Example #8
0
void User_InterruptHandler(void)
{
	TRACE_INFO("\t%s\n\r", PIO_GetOutputDataStatus(&pinLed) ? "On" : "Off");
}