Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <csl_gpio.h>
- #include <csl_general.h>
- CSL_GpioObj GpioObj;
- CSL_GpioObj *hGpio;
- void main(void){
- CSL_Status status;
- CSL_GpioPinConfig config;
- int i=0;
- short toggle=0x00;
- printf("%d",sizeof(int));
- /* // Reset interrupts and set vector table
- IRQ_globalDisable();
- IRQ_clearAll();
- IRQ_disableAll();
- IRQ_setVecs((Uint32)(&VECSTART));
- */
- // Open GPIO module
- hGpio = GPIO_open(&GpioObj,&status);
- if((NULL == hGpio) || (CSL_SOK != status))
- {
- printf("GPIO open failed\n");
- }
- else
- {
- printf("GPIO_open Successful\n");
- }
- // Reset GPIO module
- GPIO_reset(hGpio);
- // GPIO_config API to make PIN14 as output
- config.pinNum = CSL_GPIO_PIN14;
- config.direction = CSL_GPIO_DIR_OUTPUT;
- config.trigger = CSL_GPIO_TRIG_CLEAR_EDGE;
- status = GPIO_configBit(hGpio,&config);
- if(CSL_SOK != status)
- {
- printf("test failed - GPIO_configBit\n");
- }
- else
- {
- printf("GPIO PIN14 and 15 are configured as output pins\n");
- }
- while(1){
- status = GPIO_write(hGpio,CSL_GPIO_PIN14,toggle);
- for(i=0;i<=50000000; i++){
- asm(" nop");
- }
- toggle^=0x01;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement