/*==============================================================================
  hal_pinInit()
 =============================================================================*/
void* hal_pinInit(en_targetExtPin_t e_pinType)
{
    s_hal_gpio_pin_t* p_gpioPin = NULL;

    switch (e_pinType){
        case E_TARGET_RADIO_RST:

            p_gpioPin = &s_hal_gpio[e_hal_gpios_rf_rst];
            /* configure pin */
            GPIO_PinModeSet( p_gpioPin->port, p_gpioPin->pin, p_gpioPin->mode, p_gpioPin->val );
            /* set pin */
            GPIO_PinOutSet( p_gpioPin->port, p_gpioPin->pin );
            break;

        case E_TARGET_RADIO_SLPTR:

            p_gpioPin = &s_hal_gpio[e_hal_gpios_rf_slp];
            /* configure pin */
            GPIO_PinModeSet( p_gpioPin->port, p_gpioPin->pin, p_gpioPin->mode, p_gpioPin->val );
            /* set pin */
            GPIO_PinOutSet( p_gpioPin->port, p_gpioPin->pin );
            break;

        default:

            p_gpioPin = NULL;
            break;
    }

    return p_gpioPin;
} /* hal_pinInit() */
Exemple #2
0
/***************************************************************************//**
 * @brief
 *   Set the mode for a GPIO pin.
 *
 * @param[in] port
 *   The GPIO port to access.
 *
 * @param[in] pin
 *   The pin number in the port.
 *
 * @param[in] mode
 *   The desired pin mode.
 *
 * @param[in] out
 *   Value to set for pin in DOUT register. The DOUT setting is important for
 *   even some input mode configurations, determining pull-up/down direction.
 ******************************************************************************/
void GPIO_PinModeSet(GPIO_Port_TypeDef port,
                     unsigned int pin,
                     GPIO_Mode_TypeDef mode,
                     unsigned int out)
{
  EFM_ASSERT(GPIO_PORT_PIN_VALID(port, pin));

  /* If disabling pin, do not modify DOUT in order to reduce chance for */
  /* glitch/spike (may not be sufficient precaution in all use cases) */
  if (mode != gpioModeDisabled)
  {
    if (out)
    {
      GPIO_PinOutSet(port, pin);
    }
    else
    {
      GPIO_PinOutClear(port, pin);
    }
  }

  /* There are two registers controlling the pins for each port. The MODEL
   * register controls pins 0-7 and MODEH controls pins 8-15. */
  if (pin < 8)
  {
    BUS_RegMaskedWrite(&GPIO->P[port].MODEL,
                       0xF << (pin * 4),
                       mode << (pin * 4));
  }
  else
  {
    BUS_RegMaskedWrite(&GPIO->P[port].MODEH,
                       0xF << ((pin - 8) * 4),
                       mode << ((pin - 8) * 4));
  }

  if (mode == gpioModeDisabled)
  {
    if (out)
    {
      GPIO_PinOutSet(port, pin);
    }
    else
    {
      GPIO_PinOutClear(port, pin);
    }
  }
}
/**************************************************************************//**
 * @brief  Main function
 * Main is called from __iar_program_start, see assembly startup file
 *****************************************************************************/
int main(void)
{  
  /* Initialize chip */
  CHIP_Init();
  
  /* Enable clock for GPIO module */
  CMU_ClockEnable(cmuClock_GPIO, true);

  /* Configure PD with alternate drive strength of 20mA */
  GPIO_DriveModeSet(gpioPortD, gpioDriveModeHigh);
  
  /* Configure PC12 as input with filter*/
  GPIO_PinModeSet(gpioPortC, 12, gpioModeInput, 0);
  
  /* Configure PD8 as push pull output */
  GPIO_PinModeSet(gpioPortD, 8, gpioModePushPullDrive, 0);
  
  while(1)
  {
    /* If PC12 is high, drive high PD8, else drive low */
    if(GPIO_PinInGet(gpioPortC, 12)) 
      GPIO_PinOutSet(gpioPortD, 8);   /* Drive high PD8 */ 
    else 
      GPIO_PinOutClear(gpioPortD, 8); /* Drive low PD8 */
  }
  
 
}
Exemple #4
0
/***************************************************************************//**
 * @brief
 *   RxTimer, Timer0 IRQHandler.
 ******************************************************************************/
void TIMER0_IRQHandler(void)
{
	uint32_t irqFlags;

  irqFlags = TIMER_IntGet(HIJACK_RX_TIMER);
  TIMER_IntClear(HIJACK_RX_TIMER, irqFlags);
	
 	if (TIMER_IF_CC0 & irqFlags)
  {
		cur_stamp = TIMER_CaptureGet(HIJACK_RX_TIMER, 0);

		/* Check what transition it was. */
    if(ACMP0->STATUS & ACMP_STATUS_ACMPOUT)
    {
    	cur_edge = rising;
			//BSP_LedSet( 0 );
      GPIO_PinOutSet(gpioPortD, 5);
			//Debug_Print( "%d ", cur_stamp ) ;
    }
    else
    {
    	cur_edge = falling;
			//BSP_LedClear( 0 );
      GPIO_PinOutClear(gpioPortD, 5);
			//Debug_Print( "%d ", cur_stamp ) ;
    }
		decode_machine();
  }
}
Exemple #5
0
void dmaStartFrameTransfer(int firstLine, int lastLine)
{
  /* Get address of first line */
  uint16_t *startAddr = FB_getActiveBuffer();
  startAddr += firstLine * 10;
  
  /* Create update command and address of first line */
  uint16_t cmd = MEMLCD_CMD_UPDATE | ((firstLine+1) << 8); 
  
  /* Enable chip select */
  GPIO_PinOutSet( pConf->scs.port, pConf->scs.pin );
  
  /* Set number of lines to copy */
  DMA->RECT0 = (DMA->RECT0 & ~_DMA_RECT0_HEIGHT_MASK) | (lastLine - firstLine);
  
  /* Indicate to the rest of the program that SPI transfer is in progress */
  spiTransferActive = true;
  
  /* Send the update command */
  USART_TxDouble(pConf->usart, cmd);
    
  /* Start the transfer */
  DMA_ActivateBasic(DMA_CHANNEL,
                    true,                               /* Use primary channel */
                    false,                              /* No burst */
                    (void *)&(pConf->usart->TXDOUBLE),  /* Write to USART */
                    startAddr,                          /* Start address */
                    FRAME_BUFFER_WIDTH/16-1);           /* Width -1 */  
  
}
// Function Name: bootloadForceActivation
// Description:   Decides whether to continue launching the bootloader or vector
//                to the application instead. This decision is usually based on
//                some sort of GPIO logic.
//                (ie. a hardware trigger).
// NOTE!!!        This function is called extremely early in the boot process
//                prior to the chip being fully configured and before memory
//                is initialized, so limited functionality is available.
//                If this function returns false any state altered should
//                be returned to its reset state.
// Parameters:    none
// Returns:       false (0) if bootloader should not be launched.
//                (This will try to execute the application if possible.)
//                true (1) if bootloader should be launched.
//
bool bootloadForceActivation( void )
{
  #if defined(USE_BUTTON_RECOVERY)
    uint32_t i;
    bool pressed;
    // this provides an example of an alternative recovery mode activation
    //  method by utilizing one of the breakout board buttons
    CMU_ClockEnable(cmuClock_HFPER, true);
    CMU_ClockEnable(cmuClock_GPIO, true);

    // Since the button may have decoupling caps, they may not be charged
    //  after a power-on and could give a false positive result.  To avoid
    //  this issue, drive the output as an output for a short time to charge
    //  them up as quickly as possible
    GPIO_PinModeSet(BUTTON0_PORT, BUTTON0, gpioModePushPull, 1);
    GPIO_PinOutSet(BUTTON0_PORT, BUTTON0);
    for(i=0; i<100; i++)
      __no_operation();

    // Reconfigure as an input with pullup to read the button state
    GPIO_PinModeSet(BUTTON0_PORT, BUTTON0, gpioModeInputPull, 1);
    // (IO was already set to enable the pullup above)
    // We have to delay again here so that if the button is depressed the
    //  cap has time to discharge again after being charged up
    //  by the above delay
    for(i=0; i<500; i++)
      __no_operation();
    pressed = GPIO_PinInGet(BUTTON0_PORT, BUTTON0) ? BUTTON_RELEASED : BUTTON_PRESSED;

    return pressed;
  #else
    return false;
  #endif
}
Exemple #7
0
void debug_led (u1_t val)
{
	if (val)
		GPIO_PinOutSet(PORT_SPK, PIN_SPK);
	else
		GPIO_PinOutClear(PORT_SPK, PIN_SPK);
}
/*==============================================================================
  hal_spiSlaveSel()
 =============================================================================*/
uint8_t hal_spiSlaveSel(void * p_spi, bool action)
{
    s_hal_spiDrv* p_spiHal;

    if (p_spi == NULL) {
        LOG_ERR("SPI was not initialized!");
        return 0;
    }

    p_spiHal = (s_hal_spiDrv*)p_spi;

    if (action) {
        //! [select_slave]
        /* clear chip select pin */
        hal_enterCritical();
        GPIO_PinOutClear( p_spiHal->csPin.port, p_spiHal->csPin.pin );
        //! [select_slave]
    }
    else {
        /* set chip select pin */
        GPIO_PinOutSet( p_spiHal->csPin.port, p_spiHal->csPin.pin );
        hal_exitCritical();
    }
    return 1;
} /* hal_spiSlaveSel() */
static uint16_t SpiBcAccess(uint8_t addr, uint8_t rw, uint16_t data)
{
  uint16_t tmp;

  /* Enable CS */
  GPIO_PinOutClear(BSP_PORT_SPI_CS, BSP_PIN_SPI_CS);

  /* Write SPI address MSB */
  USART_Tx(BSP_SPI_USART_USED, (addr & 0x3) | rw << 3);
  /* Just ignore data read back */
  USART_Rx(BSP_SPI_USART_USED);

  /* Write SPI address  LSB */
  USART_Tx(BSP_SPI_USART_USED, data & 0xFF);

  tmp = (uint16_t) USART_Rx(BSP_SPI_USART_USED);

  /* SPI data MSB */
  USART_Tx(BSP_SPI_USART_USED, data >> 8);
  tmp |= (uint16_t) USART_Rx(BSP_SPI_USART_USED) << 8;

  /* Disable CS */
  GPIO_PinOutSet(BSP_PORT_SPI_CS, BSP_PIN_SPI_CS);

  return tmp;
}
/*
 *  Access multiple registers
 */
uint8_t CC1101_Radio::multi_register_access( uint8_t address, uint8_t access_mode, uint8_t* data, uint8_t length )
{
	uint8_t reg;
	uint8_t status;
	uint8_t count;

	GPIO_PinOutClear( _CC1101_SPI_CS_PIN );
	USART_Tx( _CC1101_USART, address | access_mode );
	status = USART_Rx( _CC1101_USART );

	for ( count = 0; count < length; count++ )
	{
		if ( ( access_mode == CC1101_READ_SINGLE ) || ( access_mode == CC1101_READ_BURST ) )
		{
			USART_Tx( _CC1101_USART, CC1101_SNOP );
			reg = USART_Rx( _CC1101_USART );
			data[count] = ( uint8_t )reg;
		}
		else
		{
			USART_Tx( _CC1101_USART, data[count] );
			status = USART_Rx( _CC1101_USART );
		}
	}

	GPIO_PinOutSet( _CC1101_SPI_CS_PIN );

	return status;
}
Exemple #11
0
static inline void set_analog_switch(analog_switch_t as, bool value)
{
	if (value)
		GPIO_PinOutClear(analog_switches[as].port, analog_switches[as].pin);
	else
		GPIO_PinOutSet(analog_switches[as].port, analog_switches[as].pin);
}
Exemple #12
0
void initGPIO()
{
	  CMU_ClockEnable(cmuClock_GPIO, true);                           // enable GPIO peripheral clock

	  GPIO_PinModeSet(GPS_PORT, FIX, gpioModeInput, 0);    // set FIX pin as input (no filter)
	  GPIO_PinModeSet(GPS_PORT, ENABLE, gpioModePushPull, 0);    // set ENABLE pin as output, initialize low

	  GPIO_PinModeSet(LED_PORT, LED0_PIN, gpioModePushPull, 0);       // configure LED0 pin as push-pull output with standard drive strength
	  GPIO_PinModeSet(LED_PORT, LED1_PIN, gpioModePushPull, 0);  // configure LED1 pin as push-pull output with alternate drive strength
	  GPIO_PinModeSet(EXT_LED, RED_LED, gpioModePushPull, 0);  // configure LED1 pin as push-pull output with alternate drive strength
	  GPIO_PinModeSet(EXT_LED, YEL_LED, gpioModePushPull, 0);  // configure LED1 pin as push-pull output with alternate drive strength
	  GPIO_PinModeSet(EXT_LED, GRE_LED, gpioModePushPull, 0);  // configure LED1 pin as push-pull output with alternate drive strength
	  GPIO_DriveModeSet(LED_PORT, gpioDriveModeLowest);               // set alternate drive strength to lowest setting (0.5mA)
	  GPIO_PinOutClear(LED_PORT, LED0_PIN);                             // turn on LED0
	  GPIO_PinOutSet(LED_PORT, LED1_PIN);                             // turn on LED1
	  GPIO_PinOutClear(EXT_LED, RED_LED);
	  GPIO_PinOutClear(EXT_LED, YEL_LED);                           // turn on LED1
	  GPIO_PinOutClear(EXT_LED, GRE_LED);

	  GPIO_PinModeSet(BUT_PORT, LEFT_BUT, gpioModeInputPull, 1);		//configure left button as input with pull-up enabled
	  GPIO_PinModeSet(BUT_PORT, RIGHT_BUT, gpioModeInputPull, 1);		//'' but with right button

	  NVIC_EnableIRQ(GPIO_ODD_IRQn);	//enable gpio_even interrupt vector in nvic
	  GPIO_IntConfig(GPS_PORT, FIX, true, false, true);		//configure FIX pin interrupt on rising
}
__LINK_C error_t hw_gpio_set(pin_id_t pin_id)
{
    if(!(gpio_pins_configured[pin_id.port] & (1<<pin_id.pin)))
	return EOFF;
    GPIO_PinOutSet(pin_id.port, pin_id.pin);
    return SUCCESS;
}
Exemple #14
0
/***************************************************************************//**
 * @brief
 *   Set a single pin in GPIO data out register to 1.
 *
 * @note
 *   In order for the setting to take effect on the output pad, the pin must
 *   have been configured properly. If not, it will take effect whenever the
 *   pin has been properly configured.
 *
 * @param[in] port
 *   The GPIO port to access.
 *
 * @param[in] pin
 *   The pin to set.
 ******************************************************************************/
EMSTATUS PAL_GpioPinOutSet(unsigned int port, unsigned int pin)
{
  EMSTATUS status = PAL_EMSTATUS_OK;

  GPIO_PinOutSet((GPIO_Port_TypeDef) port, pin);

  return status;
}
/**********************************************************
 * Performs a pin reset on the target
 **********************************************************/
void hardResetTarget(void)
{
  GPIO_PinOutClear((GPIO_Port_TypeDef)RESET_PORT, RESET_PIN);
  
  delayMs(50);
  
  GPIO_PinOutSet((GPIO_Port_TypeDef)RESET_PORT, RESET_PIN);
}
Exemple #16
0
int BSP_LedSet(int ledNo)
{
    if ((ledNo >= 0) && (ledNo < BSP_NO_OF_LEDS)) {
        GPIO_PinOutSet(ledArray[ledNo].port, ledArray[ledNo].pin);
        return BSP_STATUS_OK;
    }
    return BSP_STATUS_ILLEGAL_PARAM;
}
Exemple #17
0
void gpio_write(gpio_t pin, int value)
{
    if (value) {
        GPIO_PinOutSet(_port_num(pin), _pin_num(pin));
    }
    else {
        GPIO_PinOutClear(_port_num(pin), _pin_num(pin));
    }
}
void main(void) {
    fd_hal_processor_initialize();

    fd_binary_unit_tests();
    fd_detour_unit_tests();
    fd_storage_unit_tests();
    fd_storage_buffer_unit_tests();
    storage_erase();
    fd_sync_unit_tests();

    if (fd_log_did_log) {
        GPIO_PinOutClear(LED5_PORT_PIN);
        GPIO_PinOutSet(LED6_PORT_PIN);
    } else {
        GPIO_PinOutSet(LED5_PORT_PIN);
        GPIO_PinOutClear(LED6_PORT_PIN);
    }
}
/*==============================================================================
  hal_pinSet()
 =============================================================================*/
void hal_pinSet(void * p_pin)
{
    s_hal_gpio_pin_t* p_gpioPin;

    if( p_pin != NULL ) {
        p_gpioPin = ( s_hal_gpio_pin_t* )p_pin;
        p_gpioPin->val = 1;
        GPIO_PinOutSet( p_gpioPin->port, p_gpioPin->pin );
    }
} /* hal_pinSet() */
void TIMER3_IRQHandler(void) {
    uint32_t timer_if = TIMER_IntGet(TIMER3) & (TIMER_IF_CC1 | TIMER_IF_OF);
    TIMER_IntClear(TIMER3, TIMER_IF_CC1 | TIMER_IF_OF);

    if (timer_if & TIMER_IF_OF) {
        GPIO_PinOutSet(LED5_PORT_PIN);
    } else {
        GPIO_PinOutClear(LED5_PORT_PIN);
    }
}
Exemple #21
0
/**********************************************************
 * Performs AAP Window Expansion. This function will reset
 * target, send the AAP expansion sequence, initialize the
 * debug interface and verify that AAP can be accessed. 
 * It will try several delays between reset is released
 * and reading the AAP in case the reset line has a slow
 * ramp-up. 
 * 
 * After this function completes the AAP registers are
 * available. If it fails to access the AAP, it will 
 * throw an exception. 
 * 
 **********************************************************/
void performAapExpansion(void)
{  
  uint32_t dpId, apId;
  int i,j;
  bool success = false;
  
  for ( i=0; i<AAP_EXPANSION_RETRY_COUNT; i++ ) {
    
    /* Pull reset pin low */
    GPIO_PinOutClear((GPIO_Port_TypeDef)RESET_PORT, RESET_PIN);
    
    SWCLK_CLR();
    
    delayMs(50);
    
    /* Send the AAP Window expansion sequence */
    aapExtensionSequence();
    
    /* Release reset */
    delayUs(10);
    GPIO_PinOutSet((GPIO_Port_TypeDef)RESET_PORT, RESET_PIN);
    
    /* Try different delays in case of slow reset ramp */
    for ( j=0; j<i; j++ ) {
      delayUs(10);
    }
    
    /* Connect to SW-DP */
    TRY
      dpId = initDp();        
      apId = readApId();
      
      if ( verifyDpId(dpId) && apId == EFM32_AAP_ID ) 
      {
        
        /* Success! AAP registers can now be accessed.
         * We cannot return in the middle of a TRY block.
         * Set flag here and return after ENDTRY */
        success = true;
      }
    CATCH
      /* Do nothing in case of error. We retry. */
    ENDTRY
      
    /* Return if we found the AAP registers*/
    if ( success )
    {
      printf("AAP registers found\n");
      return;
    }
  }
  
  /* Failed to get access to AAP registers. Raise an error. */
  RAISE(SWD_ERROR_AAP_EXTENSION_FAILED);
}
Exemple #22
0
void Spi_SetNsel(eSpi_Nsel qiSelect)
{
	switch (qiSelect)
	{
		case eSpi_Nsel_RF:
			GPIO_PinOutSet(SPI_CS_PORT, SPI_CS_PIN);
			break;
		default:
			break;
	}
}
/*
 *  Send a strobe command
 */
uint8_t CC1101_Radio::strobe( uint8_t l_strobe )
{
	uint8_t reg = 0;

	GPIO_PinOutClear( _CC1101_SPI_CS_PIN );
	USART_Tx( _CC1101_USART, l_strobe );    // Write strobe command
	reg = USART_Rx( _CC1101_USART );        // Read reply
	GPIO_PinOutSet( _CC1101_SPI_CS_PIN );

	return reg;
}
Exemple #24
0
/**********************************************************
 * COG power-up sequence. 
 **********************************************************/
void cogPowerUp(void)
{
  measureTemperature();
  
  GPIO_PinOutSet(EPD_PIN_PANEL_VDD);
  
  delayMs(5);
  
  pwmEnable();
  
  delayMs(5);
  
  GPIO_PinOutSet(EPD_PIN_PANEL_ON);
  
  delayMs(10);
  
  GPIO_PinOutSet(EPD_PIN_CS);
  
  GPIO_PinOutSet(EPD_PIN_BORDER);
  
  GPIO_PinOutSet(EPD_PIN_RESET);
  
  delayMs(5);
  
  GPIO_PinOutClear(EPD_PIN_RESET);
  
  delayMs(5);
  
  GPIO_PinOutSet(EPD_PIN_RESET);
  
  delayMs(5);
}
void fd_led_sleep(void) {
    active_leds = 0;
    memset(&led_state, 0, sizeof(led_state));

    fd_timer_stop(&override_timer);

    fd_lp55231_sleep();
    fd_lp55231_power_off();

    TIMER0->ROUTE = 0;

    CMU_ClockEnable(cmuClock_TIMER0, false);

    TIMER3->ROUTE = 0;

    CMU_ClockEnable(cmuClock_TIMER3, false);

    GPIO_PinOutSet(LED0_PORT_PIN);
    GPIO_PinOutSet(LED4_PORT_PIN);
    GPIO_PinOutSet(LED5_PORT_PIN);
    GPIO_PinOutSet(LED6_PORT_PIN);
}
void qk_gpio_set_pin(qk_gpio_pin pin, bool state)
{
	if(state)
	{
		GPIO_PinOutSet((GPIO_Port_TypeDef) _QK_GPIO_PORT(pin),
				       (unsigned int) _QK_GPIO_BIT(pin));
	}
	else
	{
		GPIO_PinOutClear((GPIO_Port_TypeDef) _QK_GPIO_PORT(pin),
				         (unsigned int) _QK_GPIO_BIT(pin));
	}
}
Exemple #27
0
int BSP_LedsSet(uint32_t leds)
{
    int i;
    uint32_t mask;

    for ( i=0, mask=0x1; i<BSP_NO_OF_LEDS; i++, mask <<= 1 ) {
        if ( leds & mask )
            GPIO_PinOutSet(ledArray[i].port, ledArray[i].pin);
        else
            GPIO_PinOutClear(ledArray[i].port, ledArray[i].pin);
    }
    return BSP_STATUS_OK;
}
/*
 *  SPI register access
 */
uint8_t CC1101_Radio::register_access_SPI( uint8_t address, uint8_t access_mode, uint8_t data )
{
	uint8_t reg = 0;

	GPIO_PinOutClear( _CC1101_SPI_CS_PIN );
	USART_Tx( _CC1101_USART, address | access_mode ); // write the address byte
	USART_Rx( _CC1101_USART );                      // read reply
	USART_Tx( _CC1101_USART, data );                // write the data byte(s)
	reg = USART_Rx( _CC1101_USART );                // read and save the reply
	GPIO_PinOutSet( _CC1101_SPI_CS_PIN );

	return reg;
}
Exemple #29
0
/***************************************************************************//**
 * @brief
 *   Set/Clear chip select
 *
 * @details
 *
 * @note
 *
 * @param[in] enable
 *  Chip select pin setting
 ******************************************************************************/
static void efm32_spiLcd_cs(rt_uint8_t enable)
{
    if (!lcdAutoCs)
    {
        if (enable)
        {
            GPIO_PinOutClear(LCD_CS_PORT, LCD_CS_PIN);
        }
        else
        {
            GPIO_PinOutSet(LCD_CS_PORT, LCD_CS_PIN);
        }
    }
}
Exemple #30
0
/***************************************************************************//**
 * @brief
 *   Parser AT extension function for user.
 *
 * @param[in] token
 *   The token to parse.
 *
 * @return
 *   The parse result.
 ******************************************************************************/
static int8_t user_parse(uint8_t token)
{
	int8_t result = AT_OK;
	int value;

	switch (token) {

	case AT_USER_LED:
		if (AT_argc == 1) {
			value = AT_atoll(AT_argv[0]);
			if (value == 1) {

				// Turn on the LED
				GPIO_PinOutSet(LED_PORT, LED_BIT);
			} else if (value == 0) {

				// Turn off the LED
				GPIO_PinOutClear(LED_PORT, LED_BIT);
			} else {
				result = AT_ERROR;
			}
		} else {
			result = AT_ERROR;
		}
		break;

	case AT_USER_TEMPERATURE:
		if (AT_argc == 0) {
		   value = TD_MEASURE_TemperatureExtended();
		   AT_printf("%d.%d\r\n", value / 10, value % 10);
		} else {
			result = AT_ERROR;
		}
		break;

	case AT_USER_VOLTAGE:
		if (AT_argc == 0) {
		   value = TD_MEASURE_VoltageExtended();
		   AT_printf("%d.%03d\r\n", value / 1000, value % 1000);
		} else {
			result = AT_ERROR;
		}
		break;

	default:
		result = AT_NOTHING;
		break;
	}
	return result;
}