ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • Raspberry Pi GIPO
    embedded system 2014. 11. 8. 11:58


    GPIO(general purpose IO)?


    As well as supplying power (GND, 3.3V and 5V) all the GPIO pins can be used as either digital inputs or outputs. The pins labelled SCL and SDA can be used for I2C. The pins labelled MOSI, MISO and SCKL can be used to connect to high speed SPI devices.

    All the pins have 3.3V logic levels and are not 5V-safe so the output levels are 0-3.3V and the inputs should not be higher than 3.3V.

     즉, pin을 내가원하는 용도로 사용할 수 있다. 


    BROADCOM BCM2835 ARM Peripherals


    BROADCOM BCM2835 ARM Peripherals Datasheet을 참조하여 레지스터, 함수를 세팅해준다.


    GPIO pin에 원하는 함수를 설정할 수 있다. 


    wiringPi 


    GPIO 핀 함수 세팅은 생각보다 번거롭다. 

    wiringPi 라이브러리는 자체적인 pin map을 가지고 있다. 



    GPIO 23번 pint을 LED의 output을 선택하고 싶다면,

    #include <wiringPi.h>

    #define LED 4 // GPIO 23

    ..

    pinMode(LED, OUTPUT);

    digitalWrite(LED, 1); //LED ON

    digitalWrite(LED, 0); //LED OFF


    과 같이 사용할 수 있다. 

    'embedded system' 카테고리의 다른 글

    embedded linux Booting  (0) 2015.01.07
    임베디드 개발 환경  (0) 2015.01.07
    raspbery pi gyro module  (0) 2014.11.08
    raspbery pi camera module  (0) 2014.11.08
    linux에서 Arm cross compiler 설치  (0) 2014.08.05
Designed by Tistory.