-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsoftuart.h
57 lines (45 loc) · 1.32 KB
/
softuart.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
* softuart.h
*
* Created on: 01 ìàðòà 2015 ã.
* Author: pavel
*/
#ifndef SOFTUART_H_
#define SOFTUART_H_
#include "msp430g2231.h"
#include "stdbool.h"
#include "settings.h"
uint8_t BitCnt; // Bit count, used when transmitting byte
uint16_t TXRegister; // Value sent over UART when Transmit() is called
uint16_t RXRegister; // Value recieved once hasRecieved is set
uint8_t i; // 'for' loop variable
bool isReceiving; // Status for when the device is receiving
bool hasReceived; // Lets the program know when a byte is received
bool isTimeout;
/**
* Transmits the value currently in TXByte. The function waits till it is
* finished transmiting before it returns.
**/
//void Transmit(void);
/**
* Handles the received byte and calls the needed functions.\
**/
//void Receive(void);
/**
* Starts the receive timer, and disables any current transmission.
**/
//#pragma vector=PORT1_VECTOR
//__interrupt
void Port_1_ISR(void);
/**
* Timer interrupt routine. This handles transmiting and receiving bytes.
**/
//#pragma vector=TIMERA0_VECTOR
//__interrupt
void Timer_A0_ISR(void);
bool softuart_getc(uint8_t *c);
void softuart_putc(const uint8_t c);
void softuart_puts(const uint8_t *str);
uint8_t softuart_read(uint8_t *buf, uint8_t bufSize);
void softuart_write(const uint8_t *buf, uint8_t bufSize);
#endif /* SOFTUART_H_ */