Contiki 3.x
Functions
lis3dh-arch.c File Reference

    Platform specific functions for LIS3DH accelerometer on the Mulle platform.
More...

#include "lis3dh.h"
#include "K60.h"
#include "interrupt.h"
#include "power-control.h"
#include <stdint.h>
#include <stdbool.h>

Go to the source code of this file.

Functions

void lis3dh_write_byte (const lis3dh_reg_addr_t addr, const uint8_t value)
 Write a single byte to the LIS3DH. More...
 
uint8_t lis3dh_read_byte (const lis3dh_reg_addr_t addr)
 Read a single byte from the LIS3DH. More...
 
int16_t lis3dh_read_int16 (const lis3dh_reg_addr_t lsb_addr)
 Read a 16-bit integer from the LIS3DH. More...
 
void lis3dh_memcpy_from_device (const lis3dh_reg_addr_t start_address, uint8_t *buffer, uint8_t count)
 Read multiple bytes from the LIS3DH. More...
 
void lis3dh_memcpy_to_device (const lis3dh_reg_addr_t start_address, const uint8_t *buffer, uint8_t count)
 Write multiple bytes to the LIS3DH. More...
 
void lis3dh_arch_init ()
 Perform the platform specific part of the initialization process of the LIS3DH. More...
 

Detailed Description

    Platform specific functions for LIS3DH accelerometer on the Mulle platform.
Author
Joakim Gebart joaki.nosp@m.m.ge.nosp@m.bart@.nosp@m.eist.nosp@m.ec.se

Definition in file lis3dh-arch.c.

Function Documentation

void lis3dh_arch_init ( )

Perform the platform specific part of the initialization process of the LIS3DH.

This function is expected to set up the SPI module for the LIS3DH.

Definition at line 231 of file lis3dh-arch.c.

References PORTD, SIM, and SPI0.

Referenced by lis3dh_init().

void lis3dh_memcpy_from_device ( const lis3dh_reg_addr_t  start_address,
uint8_t *  buffer,
uint8_t  count 
)

Read multiple bytes from the LIS3DH.

Parameters
start_addressThe lower address of the source registers.
bufferA buffer to write the read values into.
countNumber of bytes to read.

Definition at line 160 of file lis3dh-arch.c.

References LIS3DH_SPI_ADDRESS_MASK, LIS3DH_SPI_MULTI_MASK, and LIS3DH_SPI_READ_MASK.

Referenced by lis3dh_read_xyz().

void lis3dh_memcpy_to_device ( const lis3dh_reg_addr_t  start_address,
const uint8_t *  buffer,
uint8_t  count 
)

Write multiple bytes to the LIS3DH.

Parameters
start_addressThe lower address of the target registers.
bufferA buffer to read the values from.
countNumber of bytes to write.

Definition at line 197 of file lis3dh-arch.c.

References LIS3DH_SPI_ADDRESS_MASK, and LIS3DH_SPI_MULTI_MASK.

uint8_t lis3dh_read_byte ( const lis3dh_reg_addr_t  addr)

Read a single byte from the LIS3DH.

Parameters
addrThe source register.
Returns
The value of the register.

Definition at line 109 of file lis3dh-arch.c.

References LIS3DH_SPI_ADDRESS_MASK, LIS3DH_SPI_READ_MASK, and LIS3DH_SPI_SINGLE_MASK.

Referenced by lis3dh_clear_bits(), lis3dh_init(), lis3dh_set_bits(), and lis3dh_write_bits().

int16_t lis3dh_read_int16 ( const lis3dh_reg_addr_t  lsb_addr)

Read a 16-bit integer from the LIS3DH.

Parameters
lsb_addrThe lower address of the two source registers.
Returns
The value of the register, byte order depends on the big/little endian setting of the LIS3DH.
Note
The BLE bit of CTRL_REG4 will affect the byte order of the return value.

Definition at line 127 of file lis3dh-arch.c.

References LIS3DH_SPI_ADDRESS_MASK, LIS3DH_SPI_MULTI_MASK, and LIS3DH_SPI_READ_MASK.

Referenced by lis3dh_read_aux_adc1(), lis3dh_read_aux_adc2(), lis3dh_read_aux_adc3(), lis3dh_read_xaxis(), lis3dh_read_yaxis(), and lis3dh_read_zaxis().

void lis3dh_write_byte ( const lis3dh_reg_addr_t  addr,
const uint8_t  value 
)

Write a single byte to the LIS3DH.

Parameters
addrThe target register.
valueThe value to write.

Definition at line 95 of file lis3dh-arch.c.

References LIS3DH_SPI_ADDRESS_MASK, and LIS3DH_SPI_SINGLE_MASK.

Referenced by lis3dh_clear_bits(), lis3dh_init(), lis3dh_set_bits(), and lis3dh_write_bits().