Changeset 2df97c4 in examples-v2


Ignore:
Timestamp:
Oct 24, 2013, 11:26:24 PM (5 years ago)
Author:
Pierre Ficheux <pierre.ficheux@…>
Branches:
4.11, 286403d7a3d0e521179e677c0d2fd7549c9ceab4
Children:
3a9c7d6
Parents:
5805cb6
git-author:
Pierre Ficheux <pierre.ficheux@…> (10/24/13 23:26:24)
git-committer:
Joel Sherrill <joel.sherrill@…> (10/24/13 23:26:24)
Message:

led.h: Add support for Raspberry Pi and BSPs using same SoC

File:
1 edited

Legend:

Unmodified
Added
Removed
  • led/led.h

    r5805cb6 r2df97c4  
    6262#define LED_OFF() LED_ROTATE()
    6363
     64#elif defined(BCM2835_GPIO_REGS_BASE)
     65// Raspberry Pi
     66#define INP_GPIO(g) *(gpio+((g)/10)) &= ~(7<<(((g)%10)*3))
     67#define OUT_GPIO(g) *(gpio+((g)/10)) |=  (1<<(((g)%10)*3))
     68#define GPIO_SET *(gpio+7)   // sets   bits which are 1 ignores bits which are 0
     69#define GPIO_CLR *(gpio+10) // clears bits which are 1 ignores bits which are 0
     70
     71#define LED_INIT()  do { unsigned int *gpio = (unsigned int *)BCM2835_GPIO_REGS_BASE; OUT_GPIO(16);} while(0)
     72#define LED_ON()  do { unsigned int *gpio = (unsigned int *)BCM2835_GPIO_REGS_BASE; GPIO_CLR = 1 << 16;} while(0)
     73#define LED_OFF()  do { unsigned int *gpio = (unsigned int *)BCM2835_GPIO_REGS_BASE; GPIO_SET = 1 << 16;} while(0)
     74
    6475#else
    6576/* default case is to print */
     
    6879#define LED_ON()  fputs( "LED ON\n", stderr )
    6980#define LED_OFF() fputs( "LED OFF\n", stderr )
    70 
    7181#endif
    7282
Note: See TracChangeset for help on using the changeset viewer.