So I decided to try and find code that will just make it work. I can work on integrating the code into my project later. I found the following example code:
http://forum.sparkfun.com/download/file.php?id=574When I go to compile it there are two issues:
1) I do not have (or know how to make) the MPL115A1.h library
2) It does not like the line:
static FILE mystdout = FDEV_SETUP_STREAM(uart_putchar, NULL, _FDEV_SETUP_WRITE);
Here is general program with out the functions:
#include <avr/io.h>
#include <stdio.h>
#include "MPL115A1.h"
#define PRESH 0x00 // 80
#define PRESL 0x02 // 82
#define TEMPH 0x04 // 84
#define TEMPL 0x06 // 86
#define A0MSB 0x08 // 88
#define A0LSB 0x0A // 8A
#define B1MSB 0x0C // 8C
#define B1LSB 0x0E // 8E
#define B2MSB 0x10 // 90
#define B2LSB 0x12 // 92
#define C12MSB 0x14 // 94
#define C12LSB 0x16 // 96
#define C11MSB 0x18 // 98
#define C11LSB 0x1A // 9A
#define C22MSB 0x1C // 9C
#define C22LSB 0x1E // 9E
//======================//
// Macros //
//======================//
#define sbi(var, mask) ((var) |= (uint8_t)(1 << mask))
#define cbi(var, mask) ((var) &= (uint8_t)~(1 << mask))
//======================//
// MPL115A1 Defines //
//======================//
#define CS 8 //pin for chip select
#define SDN 9 // pin for interrupt
//======================//
// General Functions //
//======================//
void ioinit(void);
void delay_ms(uint16_t x);
void delay_us(uint16_t x);
static int uart_putchar(char c, FILE *stream);
uint8_t uart_getchar(void);
static FILE mystdout = FDEV_SETUP_STREAM(uart_putchar, NULL, _FDEV_SETUP_WRITE);
Any suggestions on how to convert this code to the Arduino Uno?