/*---------------------------------------------------------------------------*/ void leds_arch_set(unsigned char leds) { if (leds & LEDS_GREEN) { GPIOB_PSOR = GPIO_PSOR_PTSO(0x00080000); } else { GPIOB_PCOR |= GPIO_PCOR_PTCO(0x00080000); } if (leds & LEDS_RED) { GPIOB_PSOR = GPIO_PSOR_PTSO(0x00040000); } else { GPIOB_PCOR |= GPIO_PCOR_PTCO(0x00040000); } if (leds & LEDS_BLUE) { GPIOD_PSOR = GPIO_PSOR_PTSO(0x02); } else { GPIOD_PCOR |= GPIO_PCOR_PTCO(0x02); } }
/* ** =================================================================== ** Method : PTC_Init (component Init_GPIO) ** Description : ** This method initializes registers of the GPIO module ** according to the Peripheral Initialization settings. ** Call this method in user code to initialize the module. By ** default, the method is called by PE automatically; see "Call ** Init method" property of the component for more details. ** Parameters : None ** Returns : Nothing ** =================================================================== */ void PTC_Init(void) { /* GPIOC_PSOR: PTSO|=0x10 */ GPIOC_PSOR |= GPIO_PSOR_PTSO(0x10); /* GPIOC_PCOR: PTCO&=~0x10 */ GPIOC_PCOR &= (uint32_t)~(uint32_t)(GPIO_PCOR_PTCO(0x10)); /* GPIOC_PDDR: PDD&=~0x62,PDD|=0x10 */ GPIOC_PDDR = (uint32_t)((GPIOC_PDDR & (uint32_t)~(uint32_t)( GPIO_PDDR_PDD(0x62) )) | (uint32_t)( GPIO_PDDR_PDD(0x10) )); }
void display_7segments_displayOn(display_position_e eDispPos) { // Enables display cDispNum switch(eDispPos) { case DS1: GPIOC_PSOR = GPIO_PSOR_PTSO(DS1_EN_PIN); break; case DS2: GPIOC_PSOR = GPIO_PSOR_PTSO(DS2_EN_PIN); break; case DS3: GPIOC_PSOR = GPIO_PSOR_PTSO(DS3_EN_PIN); break; case DS4: GPIOC_PSOR = GPIO_PSOR_PTSO(DS4_EN_PIN); break; case ALL: GPIOC_PSOR = GPIO_PSOR_PTSO(DS1_EN_PIN | DS2_EN_PIN | DS3_EN_PIN | DS4_EN_PIN); break; } }