Skip to content
Snippets Groups Projects
main.c 875 B
Newer Older
  • Learn to ignore specific revisions
  • Pascal Koch's avatar
    Pascal Koch committed
    #include <pico/stdlib.h>
    
    
    Pascal Koch's avatar
    Pascal Koch committed
    unsigned* enablerregister = (void *) (SIO_BASE + SIO_GPIO_OE_SET_OFFSET);
    unsigned* volatile outregister = (void *) (SIO_BASE + SIO_GPIO_OUT_SET_OFFSET);
    unsigned* volatile outclearregister = (void *) (SIO_BASE + SIO_GPIO_OUT_CLR_OFFSET);
    
    Pascal Koch's avatar
    Pascal Koch committed
    unsigned* gpioregister = (void *) (IO_BANK0_BASE + IO_BANK0_GPIO25_CTRL_OFFSET );
    
    Pascal Koch's avatar
    Pascal Koch committed
    unsigned* resetspace = (void *) (RESETS_BASE);
    
    
    
    Pascal Koch's avatar
    Pascal Koch committed
    
    int main() {
        
    
    Pascal Koch's avatar
    Pascal Koch committed
        *resetspace &= ~(1u<<5);
    
    Pascal Koch's avatar
    Pascal Koch committed
        *gpioregister = 5;
        *enablerregister = 0x01 << PICO_DEFAULT_LED_PIN;
        for(int i = 0; i< 10 ;i++){
    
    Pascal Koch's avatar
    Pascal Koch committed
            for(int j = 0; j <1000000; j++){
    
    Pascal Koch's avatar
    Pascal Koch committed
                *outregister = 0x01 << PICO_DEFAULT_LED_PIN;
            }
    
    Pascal Koch's avatar
    Pascal Koch committed
            for(int j = 0; j <1000000; j++){
                //*outregister = 0x00 << SIO_GPIO_HI_OUT_CLR_OFFSET;
                *outclearregister = 0x01 << PICO_DEFAULT_LED_PIN;
    
                
    
    Pascal Koch's avatar
    Pascal Koch committed
    
            }
        }
    
        return 0;
    }