pihwm
A lightweight C library for Raspberry Pi hardware modules.
 All Data Structures Files Functions Groups Pages
pi_spi.c File Reference

SPI library function implementation. More...

#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdint.h>
#include <errno.h>
#include <string.h>
#include <sys/ioctl.h>
#include <linux/types.h>
#include <linux/spi/spidev.h>
#include "pihwm.h"
#include "pi_spi.h"

Go to the source code of this file.

Functions

int spi_init (uint8_t channel)
 Initialises the spidev interface.
 
int spi_config (int fd, uint8_t mode, uint8_t bits, uint32_t speed, uint16_t delay)
 Configures the spidev interface.
 
int spi_config_default (int fd)
 Configures the spidev interface with default values.
 
int spi_transfer (int fd, uint8_t txbuf[], uint8_t rxbuf[], uint8_t len)
 Initiates SPI transfers.
 

Detailed Description

SPI library function implementation.

Author
Omer Kilic omerk.nosp@m.ilic.nosp@m.@gmai.nosp@m.l.co.nosp@m.m - Erlang Solutions

LICENSE

Copyright (C) 2013 Omer Kilic omerk.nosp@m.ilic.nosp@m.@gmai.nosp@m.l.co.nosp@m.m - Erlang Solutions

This file is part of pihwm http://omerk.github.io/pihwm

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at:

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Definition in file pi_spi.c.