program for conv1, universal converter before including conv2 code

Dependencies:   mbed-src

Fork of _8_CONV_1_SLAVE by Marek Trojan

main.h

Committer:
marcus255
Date:
2015-12-25
Revision:
9:58c110e686f0
Parent:
8:47ae8b74cd43
Child:
10:7eaae60dc9e4

File content as of revision 9:58c110e686f0:

/*
* Project: I2C to UART converter
* File: main.h
* Author: Marek Trojan
*/

#ifndef MAIN_H
#define MAIN_H

#include <mbed.h>
#define RECBUFSIZE 64
#define SET_CONV2_FUNCT            0x22
#define UART_CONFIRMATION_CHAR     0x33
#define UART_CHAR_INCOMING         0x44
#define END_OF_TRANSMISSION        0x66
#define DATA_TO_READ_CHAR          0x99
#define UART_NON_CONFIRMATION_CHAR 0xAA
#define DATA_TO_WRITE_CHAR         0xCC
#define I2C_FREQUENCY_STANDARD   100000 /* Hz */

I2CSlave slave(PTB4, PTB3);
I2C i2c(PTB4, PTB3);
Serial device(USBTX, USBRX);
InterruptIn SDA_interrupt(PTB7);
InterruptIn SCL_interrupt(PTA12);
DigitalIn SDA_state(PTB6);

char buffer;
int count;
volatile int discovered_address;
volatile int clk_count;
int frequency;
int transmission;

void on_SDA_falling_slope_interrupt(void);
void on_SCL_rising_slope_interrupt(void);
void onUartChar(void);

void init_conv1(int, char);
void init_conv2(int);
void init_conv(void);

#endif