Changeset 944b4f1 in examples-v2


Ignore:
Timestamp:
Aug 29, 2014, 1:16:23 PM (5 years ago)
Author:
Pierre Ficheux <pierre.ficheux@…>
Branches:
4.11, 286403d7a3d0e521179e677c0d2fd7549c9ceab4
Children:
d1f602e
Parents:
61d2a1f
git-author:
Pierre Ficheux <pierre.ficheux@…> (08/29/14 13:16:23)
git-committer:
Joel Sherrill <joel.sherrill@…> (08/29/14 18:33:34)
Message:

example-v2 patch for RPi B+ (led)

Hi,

Here is the patch for "example-v2" project to support Raspberry Pi B+ as led number is now 47 instead of 16 on RPi B.

regards

--
Pierre FICHEUX -/- CTO OW/OWI, France -\- pierre.ficheux@…

http://ingenierie.openwide.fr
http://www.linuxembedded.fr

I would love to change the world, but they won't give me the source code
From e4d8edfb8650207641bc8e2716cf15ce958ede0f Mon Sep 17 00:00:00 2001
From: Pierre FICHEUX <pierre.ficheux@…>
Date: Fri, 29 Aug 2014 15:11:41 +0200
Subject: [PATCH] Added led blink support for RPi B+

File:
1 edited

Legend:

Unmodified
Added
Removed
  • led/led.h

    r61d2a1f r944b4f1  
    6868#define GPIO_SET *(gpio+7)   // sets   bits which are 1 ignores bits which are 0
    6969#define GPIO_CLR *(gpio+10) // clears bits which are 1 ignores bits which are 0
     70// For GPIO# >= 32 (RPi B+)
     71#define GPIO_SET_EXT *(gpio+8)  // sets   bits which are 1 ignores bits which are 0
     72#define GPIO_CLR_EXT *(gpio+11) // clears bits which are 1 ignores bits which are 0
    7073
    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// RPi B
     75//#define LED_INIT()  do { unsigned int *gpio = (unsigned int *)BCM2835_GPIO_REGS_BASE; OUT_GPIO(16);} while(0)
     76//#define LED_ON()  do { unsigned int *gpio = (unsigned int *)BCM2835_GPIO_REGS_BASE; GPIO_CLR = 1 << 16;} while(0)
     77//#define LED_OFF()  do { unsigned int *gpio = (unsigned int *)BCM2835_GPIO_REGS_BASE; GPIO_SET = 1 << 16;} while(0)
     78// RPi B+ => led 47
     79#define LED_INIT()  do { unsigned int *gpio = (unsigned int *)BCM2835_GPIO_REGS_BASE; OUT_GPIO(47);} while(0)
     80#define LED_ON()  do { unsigned int *gpio = (unsigned int *)BCM2835_GPIO_REGS_BASE; GPIO_CLR_EXT = 1 << (47 % 32);} while(0)
     81#define LED_OFF()  do { unsigned int *gpio = (unsigned int *)BCM2835_GPIO_REGS_BASE; GPIO_SET_EXT = 1 << (47 % 32);} while(0)
    7482
    7583#else
Note: See TracChangeset for help on using the changeset viewer.