Ejemplo n.º 1
0
void LED_Init (void)
{
	PINSEL_CFG_Type PinCfg;

	uint8_t temp;

	PinCfg.Funcnum = 0;
	PinCfg.OpenDrain = 0;
	PinCfg.Pinmode = 0;
	PinCfg.Portnum = 2;
	for (temp = 2; temp <= 6; temp++){
		PinCfg.Pinnum = temp;
		PINSEL_ConfigPin(&PinCfg);
	}

	PinCfg.Funcnum = 0;
	PinCfg.OpenDrain = 0;
	PinCfg.Pinmode = 0;
	PinCfg.Portnum = 1;
	PinCfg.Pinnum = 28;
	PINSEL_ConfigPin(&PinCfg);
	PinCfg.Pinnum = 29;
	PINSEL_ConfigPin(&PinCfg);
	PinCfg.Pinnum = 31;
	PINSEL_ConfigPin(&PinCfg);

	// Set direction to output
	GPIO_SetDir(2, LED2_MASK, 1);
	GPIO_SetDir(1, LED1_MASK, 1);

	/* Turn off all LEDs */
	GPIO_ClearValue(2, LED2_MASK);
	GPIO_ClearValue(1, LED1_MASK);
}
Ejemplo n.º 2
0
/*********************************************************************//**
 * @brief 		Drive CS output pin to low/high level to select slave device
 * 				via /CS pin state
 * @param[in]	state State of CS output pin that will be driven:
 * 				- 0: Drive CS pin to low level
 * 				- 1: Drive CS pin to high level
 * @return		None
 ***********************************************************************/
void CS_Force1 (LPC_SSP_TypeDef *SSPx, FunctionalState state)
{
	if (SSPx == LPC_SSP0)
	{
		if (state)
		{
			GPIO_SetValue(0, _BIT(16));
		}
		else
		{
			GPIO_ClearValue(0, _BIT(16));
		}
	}
	else if (SSPx == LPC_SSP1)
	{
		if (state)
		{
			GPIO_SetValue(0, _BIT(6));
		}
		else
		{
			GPIO_ClearValue(0, _BIT(6));
		}
	}
}
Ejemplo n.º 3
0
/*********************************************************************//**
 * @brief		Timer 0 interrupt handler. This sub-routine will set/clear
 * 				two Phase A-B output pin to their phase state
 * @param[in]	None
 * @return 		None
 **********************************************************************/
void TIMER0_IRQHandler(void)
{
	if (TIM_GetIntStatus(LPC_TIM0,TIM_MR0_INT)) {

		// Set/Clear phase A/B pin corresponding to their state
		switch (PhaseCnt) {
		case 0:
			GPIO_SetValue(0,PHASE_A_PIN);
			GPIO_ClearValue(0,PHASE_B_PIN);
			break;
		case 1:
			GPIO_SetValue(0, PHASE_A_PIN | PHASE_B_PIN);
			break;
		case 2:
			GPIO_SetValue(0, PHASE_B_PIN);
			GPIO_ClearValue(0, PHASE_A_PIN);
			break;
		case 3:
			GPIO_ClearValue(0, PHASE_A_PIN | PHASE_B_PIN);
			break;

		default:
			break;
		}

		// update PhaseCnt
		PhaseCnt = (PhaseCnt + 1) & 0x03;

		// Clear Timer 0 match interrupt pending
		TIM_ClearIntPending(LPC_TIM0,TIM_MR0_INT);
	}
}
Ejemplo n.º 4
0
void GSM_Switch(FunctionalState newState)
{

	if(GSM_GetStatus() == newState)
	{
		return;
	}
	else if(newState == ENABLE)
	{
		GPIO_SetValue(GPIO2, (0x01<<gsmPwrPin));
		while(!GSM_GetStatus());
		GPIO_ClearValue(GPIO2, (0x01<<gsmPwrPin));
		delay_ms(2000);
	}
	else if (newState == DISABLE)
	{
		while(GSM_GetStatus())
		{
			GPIO_SetValue(GPIO2, (0x01<<gsmPwrPin));
			delay_ms(800);
			GPIO_ClearValue(GPIO2, (0x01<<gsmPwrPin));
			delay_ms(10000);

		}

	}
}
//====================================================================================
void main()
{
	volatile uint32_t i;
	uint32_t timer_mark;
	//while(1);
	
	SystemInit();
	CGU_Init();

	scu_pinmux(0xE ,7 , MD_PDN, FUNC4); 	// P8.1 : USB0_IND1 LED

	GPIO_SetDir(LED1_PORT,(1<<LED1_BIT), 1);

	GPIO_ClearValue(LED1_PORT,(1<<LED1_BIT));

	// M3Frequency is automatically set when SetClock(BASE_M3_CLK... was called.
	SysTick_Config(CGU_GetPCLKFrequency(CGU_PERIPHERAL_M4CORE)/1000);  				// Generate interrupt @ 1000 Hz
	
	/*for(;;)
	{
		GPIO_ClearValue(LED1_PORT,(1<<LED1_BIT));
		for(i = 0; i < 200000; i++);
		GPIO_SetValue(LED1_PORT,(1<<LED1_BIT));
		for(i = 0; i < 200000; i++);
	}

	while (1)
	{                           					// Loop forever
		timer_mark = msTicks;					// Take timer snapshot 
		while(msTicks < (timer_mark + 100));	// Wait until 100ms has passed
		GPIO_ClearValue(LED1_PORT,(1<<LED1_BIT));				// Turn the LED off
	
		timer_mark = msTicks;					// Take timer snapshot 
		while(msTicks < (timer_mark + 100));	// Wait until 100ms has passed
		GPIO_SetValue(LED1_PORT,(1<<LED1_BIT));				// Turn the LED on
	}*/

	
	
	// Init on-board LED as output
	//GPIO1->FIODIR |= 1 << 18;
	
	// Init SysTick
	//SysTick_Config(SystemFrequency / 1000);		// Generate interrupt every 1 ms
	
	while (1)
	{                           					// Loop forever
		msec = 100;
		while(msec);
		GPIO_ClearValue(LED1_PORT,(1<<LED1_BIT));
		msec = 100;
		while(msec);
		GPIO_SetValue(LED1_PORT,(1<<LED1_BIT));

	}
}
Ejemplo n.º 6
0
void LEDs_SetAllLEDs(uint32_t LEDMask)
{
	if(LEDMask&LEDS_LED1)
		GPIO_ClearValue(LED1_GPIO_PORT_NUM,(1<<LED1_GPIO_BIT_NUM));
	else
		GPIO_SetValue(LED1_GPIO_PORT_NUM,(1<<LED1_GPIO_BIT_NUM));
	if(LEDMask&LEDS_LED2)
		GPIO_ClearValue(LED2_GPIO_PORT_NUM,(1<<LED2_GPIO_BIT_NUM));
	else
		GPIO_SetValue(LED2_GPIO_PORT_NUM,(1<<LED2_GPIO_BIT_NUM));
}
Ejemplo n.º 7
0
void vtInitLED()
{
    /* LEDs on ports 1 and 2 to output (1). */
    // Note that all LED access is through the proper LPC library calls
    GPIO_SetDir(1,partstFIO1_BITS,1);
    GPIO_SetDir(2,partstFIO2_BITS,1);

    /* Start will all LEDs off. */
    GPIO_ClearValue(1,partstFIO1_BITS);
    GPIO_ClearValue(2,partstFIO2_BITS);

}
Ejemplo n.º 8
0
/*********************************************************************//**
 * @brief		Initialize LED
 * @param[in]	None
 * @return 		None
 **********************************************************************/
void LED_Init(void)
{
	//setting two LEDs as output and turn off all
	GPIO_SetDir(PRIVILEGE_LEDPORT,(1<<PRIVILEGE_LED),1);
	GPIO_SetDir(UNPRIVILEGE_LEDPORT,(1<<UNPRIVILEGE_LED),1);
#ifdef MCB_LPC_1768
	GPIO_ClearValue(1,(1<<PRIVILEGE_LED)|(1<<UNPRIVILEGE_LED));
	GPIO_ClearValue(2,(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6));
#elif defined(IAR_LPC_1768)
	GPIO_SetValue(PRIVILEGE_LEDPORT,(1<<PRIVILEGE_LED));
	GPIO_SetValue(UNPRIVILEGE_LEDPORT,(1<<UNPRIVILEGE_LED));
#endif
}
Ejemplo n.º 9
0
void jtag_init(void)
{
    uint32_t i=0;

    PinCfg.Funcnum      = 0;    // GPIO
    PinCfg.OpenDrain    = 0;
    PinCfg.Pinmode      = 0;

    puts("");
    printf("Init JTAG port pins: TDO, ");

    PinCfg.Portnum      = JTAG_TDOPORT;
    PinCfg.Pinnum       = JTAG_TDOPIN;
    PINSEL_ConfigPin(&PinCfg);

    printf("TDI, ");
    PinCfg.Portnum      = JTAG_TDIPORT;
    PinCfg.Pinnum       = JTAG_TDIPIN;
    PINSEL_ConfigPin(&PinCfg);

    printf("TMS, ");
    PinCfg.Portnum      = JTAG_TMSPORT;
    PinCfg.Pinnum       = JTAG_TMSPIN;
    PINSEL_ConfigPin(&PinCfg);

    printf("TRST, ");
    PinCfg.Portnum      = JTAG_TRSTPORT;
    PinCfg.Pinnum       = JTAG_TRSTPIN;
    PINSEL_ConfigPin(&PinCfg);

    printf("TCK - done\n");
    PinCfg.Portnum      = JTAG_TCKPORT;
    PinCfg.Pinnum       = JTAG_TCKPIN;
    PINSEL_ConfigPin(&PinCfg);

    GPIO_SetDir(JTAG_TDIPORT, JTAG_TDI, 1);
    GPIO_SetDir(JTAG_TDOPORT, JTAG_TDO, 0);
    GPIO_SetDir(JTAG_TMSPORT, JTAG_TMS, 1);
    GPIO_SetDir(JTAG_TCKPORT, JTAG_TCK, 1);
    GPIO_SetDir(JTAG_TRSTPORT, JTAG_TRST, 1);

    GPIO_ClearValue(JTAG_TDIPORT, JTAG_TDI);

    GPIO_ClearValue(JTAG_TMSPORT, JTAG_TMS);
    GPIO_ClearValue(JTAG_TCKPORT, JTAG_TCK);

    GPIO_ClearValue(JTAG_TRSTPORT, JTAG_TRST);
    GPIO_SetValue(  JTAG_TRSTPORT, JTAG_TRST);

    return;
}
Ejemplo n.º 10
0
int main() {
	//Initialize system and clocks
	SystemInit();
	SystemCoreClockUpdate();

	//Turn on peripheral clocks for GPIO and I2S
	CLKPWR_ConfigPPWR(CLKPWR_PCONP_PCGPIO, ENABLE);
	CLKPWR_ConfigPPWR(CLKPWR_PCONP_PCI2S, ENABLE);

	//Set direction for LED pin
	GPIO_SetDir(0, (1 << 22), 1);
	//Set direction for ADC control pins
	GPIO_SetDir(1, (1 << 18) | (1 << 21), 1);

	//Initialize buffer pointers to default value
	processActive = buffer3;
	rxActive = buffer1;
	txActive = buffer2;

	//Init the I2S hardware
	initTX(44100, (uint32_t) txActive, (uint32_t) rxActive);

	//Set and Clear control pins for ADC
	GPIO_SetValue(1, (1 << 18));
	GPIO_ClearValue(1, (1 << 21));

	//infinite loop
	while (1) {
		//If the interrupt has set the flag
		if (needsProcessing) {
			//Turn led on to indicate CPU usage
			GPIO_SetValue(0, (1 << 22));

			//Run filter on current buffers
			firFixed(processActive, TRANSFER_SIZE);

			//Rotate buffers
			uint32_t *tmp = processActive;
			processActive = rxActive;
			rxActive = txActive;
			txActive = tmp;

			//Clear flag
			needsProcessing = 0;

			//Turn led off, if the processing takes longer the LED becomes brighter
			GPIO_ClearValue(0, (1 << 22));
		}
	}
}
Ejemplo n.º 11
0
void vtLEDOff(uint8_t mask)
{
    if (mask & 0x80) {
        // LED P1.28
        GPIO_ClearValue(1,0x10000000);
    }
    if (mask & 0x40) {
        // LED P1.29
        GPIO_ClearValue(1,0x20000000);
    }
    if (mask & 0x20) {
        // LED P1.31
        GPIO_ClearValue(1,0x80000000);
    }
    if (mask & 0x10) {
        // LED P2.2
        GPIO_ClearValue(2,0x00000004);
    }
    if (mask & 0x08) {
        // LED P2.3
        GPIO_ClearValue(2,0x00000008);
    }
    if (mask & 0x04) {
        // LED P2.4
        GPIO_ClearValue(2,0x00000010);
    }
    if (mask & 0x02) {
        // LED P2.5
        GPIO_ClearValue(2,0x00000020);
    }
    if (mask & 0x01) {
        // LED P2.6
        GPIO_ClearValue(2,0x00000040);
    }
}
Ejemplo n.º 12
0
int main(void)
{
    SystemInit();
    CGU_Init();


    // Configure GPIO pins connected to LEDs as outputs
    scu_pinmux(D3_SCU_PORT, D3_SCU_PIN, MD_BUK, FUNC4);
    GPIO_SetDir(D3_GPIO_PORT, D3_GPIO_MASK, 1);
    scu_pinmux(D4_SCU_PORT, D4_SCU_PIN, MD_BUK, FUNC4);
    GPIO_SetDir(D4_GPIO_PORT, D4_GPIO_MASK, 1);
    scu_pinmux(D5_SCU_PORT, D5_SCU_PIN, MD_BUK, FUNC4);
    GPIO_SetDir(D5_GPIO_PORT, D5_GPIO_MASK, 1);
    scu_pinmux(D6_SCU_PORT, D6_SCU_PIN, MD_BUK, FUNC4);
    GPIO_SetDir(D6_GPIO_PORT, D6_GPIO_MASK, 1);

    // Configure GPIO pins connected to push buttons as inputs
    scu_pinmux(S1_SCU_PORT, S1_SCU_PIN, MD_BUK | MD_EZI, FUNC4);
    GPIO_SetDir(S1_GPIO_PORT, S1_GPIO_MASK, 0);
    scu_pinmux(S2_SCU_PORT, S2_SCU_PIN, MD_BUK | MD_EZI, FUNC4);
    GPIO_SetDir(S2_GPIO_PORT, S2_GPIO_MASK, 0);
    scu_pinmux(S3_SCU_PORT, S3_SCU_PIN, MD_BUK | MD_EZI, FUNC4);
    GPIO_SetDir(S3_GPIO_PORT, S3_GPIO_MASK, 0);
    scu_pinmux(S4_SCU_PORT, S4_SCU_PIN, MD_BUK | MD_EZI, FUNC4);
    GPIO_SetDir(S4_GPIO_PORT, S4_GPIO_MASK, 0);

    while(1)
    {
        if (GPIO_ReadValue(S1_GPIO_PORT) & S1_GPIO_MASK)
            GPIO_ClearValue(D3_GPIO_PORT, D3_GPIO_MASK);
        else
            GPIO_SetValue(D3_GPIO_PORT, D3_GPIO_MASK);

        if (GPIO_ReadValue(S2_GPIO_PORT) & S2_GPIO_MASK)
            GPIO_ClearValue(D4_GPIO_PORT, D4_GPIO_MASK);
        else
            GPIO_SetValue(D4_GPIO_PORT, D4_GPIO_MASK);

        if (GPIO_ReadValue(S3_GPIO_PORT) & S3_GPIO_MASK)
            GPIO_ClearValue(D5_GPIO_PORT, D5_GPIO_MASK);
        else
            GPIO_SetValue(D5_GPIO_PORT, D5_GPIO_MASK);

        if (GPIO_ReadValue(S4_GPIO_PORT) & S4_GPIO_MASK)
            GPIO_ClearValue(D6_GPIO_PORT, D6_GPIO_MASK);
        else
            GPIO_SetValue(D6_GPIO_PORT, D6_GPIO_MASK);
    }
}
Ejemplo n.º 13
0
void LCD_RST(int enable)
{
    if (enable)
        GPIO_SetValue(LCD_RESET_PORT, (1 << LCD_RESET_PIN));
    else
        GPIO_ClearValue(LCD_RESET_PORT, (1 << LCD_RESET_PIN));
}
Ejemplo n.º 14
0
/*
 *  メインタスク
 */
void main_task(intptr_t exinf)
{

	syslog(LOG_NOTICE, "Sample program starts (exinf = %d).", (int_t) exinf);

		/* GPIO0のLED制御ピンを出力にする */
	GPIO_SetDir(
			0,			// GPIOポート番号
			LEDMASK,	// 操作するビットマスク
			1			// 設定する値
			);

	while(1)
	{
			/* 500m秒待つ */
		SVC_PERROR(tslp_tsk(500));
			/* LED制御ピンをLにする */
		GPIO_ClearValue(
				0,			// GPIOポート番号
				LEDMASK	// 操作するビットマスク
				);
			/* 500m秒待つ */
		SVC_PERROR(tslp_tsk(500));
			/* LED制御ピンをHにする */
		GPIO_SetValue(
				0,			// GPIOポート番号
				LEDMASK	// 操作するビットマスク
				);
	}


	syslog(LOG_NOTICE, "Sample program ends.");
	SVC_PERROR(ext_ker());
	assert(0);
}
Ejemplo n.º 15
0
void LCD_DC(int enable)
{
    if (enable)
        GPIO_SetValue(LCD_DC_PORT, (1 << LCD_DC_PIN));
    else
        GPIO_ClearValue(LCD_DC_PORT, (1 << LCD_DC_PIN));
}
Ejemplo n.º 16
0
void LED_SetMaskBit(uint8 port, uint32 mask, bool val)
{
   if (val)
      GPIO_ClearValue(port, mask);
   else
      GPIO_SetValue(port, mask);
}
Ejemplo n.º 17
0
/*********************************************************************//**
 * @brief		Turn off LED
 * @param[in]	Led_num		LED number, should be:
 * 				- PRIVILEGE_LED
 * 				- UNPRIVILEGE_LED
 * @return 		None
 **********************************************************************/
void Turn_off_LED(uint8_t Led_num)
{
#ifdef MCB_LPC_1768
	if(Led_num == PRIVILEGE_LED){
		GPIO_ClearValue(PRIVILEGE_LEDPORT,(1<<PRIVILEGE_LED));}
	else{
		GPIO_ClearValue(UNPRIVILEGE_LEDPORT,(1<<UNPRIVILEGE_LED));
	}
#elif defined(IAR_LPC_1768)
	if(Led_num == PRIVILEGE_LED){
		GPIO_SetValue(PRIVILEGE_LEDPORT,(1<<PRIVILEGE_LED));}
	else{
		GPIO_SetValue(UNPRIVILEGE_LEDPORT,(1<<UNPRIVILEGE_LED));
	}
#endif
}
Ejemplo n.º 18
0
///////////////////////////////////////////////////////////////////////////////
/// @brief		TIMER1 interrupt handler sub-routine
/// @param[in]	None
/// @return 	None
///////////////////////////////////////////////////////////////////////////////
void TIMER1_IRQHandler1(void)
{
//	if (TIM_GetIntCaptureStatus(LPC_TIM1,0))
//	{
//		TIM_ClearIntCapturePending(LPC_TIM1,0);
	if(TIM_GetIntStatus(LPC_TIM1, TIM_CR0_INT))	{
		TIM_ClearIntPending(LPC_TIM1, TIM_CR0_INT);
		uint32_t capt = TIM_GetCaptureValue(LPC_TIM1,0);
		uint32_t diff = capt - Timer1Capture0Value;
		if(diff > 5000) {
			if(Recv.index != 12) {
				GPIO_SetValue(TRIG_PORT, TRIG_PIN);
				tim_cr0_int_error++;
				GPIO_ClearValue(TRIG_PORT, TRIG_PIN);
			}
			Recv.index = 0;
		}
		else {
			if(Recv.index < MAX_CHANNELS && diff > 500 && diff < 2500) {
				Recv.channel[Recv.index] = diff;
			}
			Recv.index++;
		}
		Timer1Capture0Value = capt;
	}
}
Ejemplo n.º 19
0
/*********************************************************************//**
* @brief 		Drive /CS pin to high level to disable slave device via /CS
* 				pin state
* @param[in]	ss State of SPI Chip Select ouput pin, can be:
* 				- 0: SlaveSelect low
* 				- 1: SlaveSelect high
* @return		None
***********************************************************************/
void SPI_SlaveSelect (unsigned char ss)
{
	if (ss){
		GPIO_SetValue(CS_PORT_NUM, (1<<CS_PIN_NUM));
	}else{
		GPIO_ClearValue(CS_PORT_NUM, (1<<CS_PIN_NUM));
	}
}
/*********************************************************************//**
 * @brief 		Drive CS output pin to low/high level to select slave device
 * 				via /CS pin state
 * @param[in]	state State of CS output pin that will be driven:
 * 				- 0: Drive CS pin to low level
 * 				- 1: Drive CS pin to high level
 * @return		None
 ***********************************************************************/
void CS_Force(int32_t state)
{
	if (state){
		GPIO_SetValue(CS_PORT_NUM, (1<<CS_PIN_NUM));
	}else{
		GPIO_ClearValue(CS_PORT_NUM, (1<<CS_PIN_NUM));
	}
}
Ejemplo n.º 21
0
void LED_SetValue(LED_STRUCT led, bool val)
{
   // neg. logic
   if (val)
      GPIO_ClearValue(led.port, led.pin);
   else
      GPIO_SetValue(led.port, led.pin);
}
Ejemplo n.º 22
0
void hw_digital_write (size_t ulPin, uint8_t ulVal)
{
    if (ulVal != HW_LOW) {
        GPIO_SetValue(g_APinDescription[ulPin].portNum, 1 << g_APinDescription[ulPin].bitNum);
    } else {
        GPIO_ClearValue(g_APinDescription[ulPin].portNum, 1 << (g_APinDescription[ulPin].bitNum));
    }
}
Ejemplo n.º 23
0
float usScan(void){
  GPIO_SetValue(2, 0xFFFFFFFF);
  TimerCapture();
  Timer(59998);
  GPIO_ClearValue(2, 0xFFFFFFFF);
  Timer(2);
  return ultradist/58;
}
Ejemplo n.º 24
0
Archivo: gpio.c Proyecto: Q-Mart/EMPR
void set_general_gpio(int port, int pin, int value) 
{
    if (value == 1)
    {   
        GPIO_SetValue(port, pin);
    } else {
        GPIO_ClearValue(port, pin);
    }
}
Ejemplo n.º 25
0
InterruptManager::InterruptManager(InterruptManagerOwner* owner)
{
	interruptManagerOwner = owner;
	for(uint32_t i = 0; i < IRQHandler_NUM_VALUES; i++)
		pointers[i] = 0;

	GPIO_ClearValue(2, (1<<0));
	GPIO_SetDir(2, (1<<0), 1);
}
Ejemplo n.º 26
0
int main(void) {
    setup_systemclock();

    //TODO:TimerInitに切り出し
	// Setup SysTick Timer to interrupt at 10 msec intervals
	SysTick_Config(CGU_GetPCLKFrequency(CGU_PERIPHERAL_M4CORE)/100);

	GPIO_SetDir(0,1<<8, 1);	// GPIO0[8](LED)を出力に設定
	GPIO_ClearValue(0,1<<8);// GPIO0[8](LED)出力L

////////////////////wave_gen///////////////////////////////
	gen_dac_cfg_t cfg;
    cfg.amplitude=5000;
    cfg.dcOffset=0;
    cfg.frequency=150;
    cfg.waveform=GEN_DAC_CFG_WAVE_TRIANGLE;
    wave_gen(&cfg, &buf);

////////////////////fft///////////////////////////////
    fft_gen();

////////////////spi///////////////////////////////////
	lcd_init();
	lcd_clear();
////////////////lcd///////////////////////////////////
//		uint16_t lcd_x;
//		uint16_t lcd_y;
//		uint8_t scale_time = 2;//横軸データ数を2倍表示
//		uint8_t scale_fft = 2;//横軸データ数を2倍表示

//////////////////////////////////////////////////////
//	uint16_t i;
//	int j;

	ADC_DMA_Init();
    NVIC_SetPriority(DMA_IRQn,   ((0x01<<3)|0x01));

    // Enter an infinite loop
    while(1) {
//wav_genタイムドメイン表示
//    	for (i = 0; i < 240; i++) {
//    		for (j = 0; j < 25; j++) {
//    			lcd_data[i][j]=0x0000;
//    		}
//    	}
//    	for (i = 0; i < 400*scale_time; i++ ){
//    	    lcd_x = ((int16_t)(i/scale_time) -200) * -1 + 200;//左右逆転(LCD都合
//    		lcd_y = (buf.LUT_BUFFER[i]-2048)/17 + 120;//0~240に正規化
//    		lcd_data[lcd_y][lcd_x/16] = lcd_data[lcd_y][lcd_x/16] | 0x01<<(lcd_x%16);
//    	}
//    	lcd_write(lcd_data);
    	systick_delay(50);
    }
	ADC_DMA_Exit();
    return 0 ;
}
Ejemplo n.º 27
0
/*********************************************************************//**
 * @brief 		Drive CS output pin to low/high level to select slave device
 * 				via /CS pin state
 * @param[in]	state State of CS output pin that will be driven:
 * 				- 0: Drive CS pin to low level
 * 				- 1: Drive CS pin to high level
 * @return		None
 ***********************************************************************/
void CS_Force (FunctionalState state)
{
	if (state)
	{
		GPIO_SetValue(0, _BIT(16));
	}
	else
	{
		GPIO_ClearValue(0, _BIT(16));
	}
}
Ejemplo n.º 28
0
void initComExpress( void )
{

        GPIO_ClearValue(0, 0x01<<9);
        TIM2_CFG();
       // delay();
	GPIO_SetValue(3, 0x01<<25);


	GPIO_ClearValue(1, 0x01<<18);
	delay();
	GPIO_SetValue(1, 0x01<<18);

	GPIO_SetValue(0, 0x01<<4);

	//GPIO_SetValue(0, 0x01<<9);

	GPIO_SetValue(2, 0x01<<5);
	GPIO_SetValue(2, 0x01<<6);
}
Ejemplo n.º 29
0
void led_init(void)	// LED als Ausgang setzen
{
	PINSEL_CFG_Type PinCfg;
	PinCfg.Portnum = LED_ONBOARD_PORT;
	PinCfg.Pinnum = LED_ONBOARD_PIN;
	PinCfg.Pinmode = 0;
	PinCfg.Funcnum = 0;
	PINSEL_ConfigPin(&PinCfg);

	GPIO_SetDir(LED_ONBOARD_PORT, 1 << LED_ONBOARD_PIN, 1);
	GPIO_ClearValue(LED_ONBOARD_PORT, 1 << LED_ONBOARD_PIN);
}
Ejemplo n.º 30
0
/*********************************************************************//**
 * @brief		Output to the GPIO pin an expected value
 * @param[in]	portNum		Port number value, should be in range from 0 to 4
 * @param[in]	bitValue	Value that contains all bits on GPIO to clear,
 * 							in range from 0 to 0xFFFFFFFF.
 * 							example: value 0x5 to clear bit 0 and bit 1.
 * @return		None
 *
 * Note:
 * - For all bits that has been set as input direction, this function will
 * not effect.
 * - For all remaining bits that are not activated in bitValue (value '0')
 * will not be effected by this function.
 **********************************************************************/
void GPIO_OutputValue(uint8_t portNum, uint32_t bitMask, uint8_t value)
{
	if (value == 0)
	{
		GPIO_ClearValue(portNum, bitMask);
	}
	else
	{
		GPIO_SetValue(portNum, bitMask);
	}

}