Code:
#include <msp430.h>
#include <stdlib.h>
#include <stdint.h>
/*
* rc.h
*
* Created on: Mar 19, 2020
* Author: ridge
*/
#ifndef RC_H_
#define RC_H_
//macros, etc.
const unsigned int Customer_ID = 0xa316;
const unsigned int CRC_Init = 0xFFFF;
#define PAYLOAD_SIZE 3 //does not include CRC
#define TENTHSEC 3277
#define st(x) do { x } while (0)
#define IOconfig st(P1DIR = 0x01; /*input*/ \
P1OUT = 0x03; P1REN = 0xFE; /*pulldowns..p1.1 - pullup*/ \
P1IES = 0x02; P1IE =0xFE; /*interrupts*/ \
P2SEL1 |= BIT5 | BIT6; P2SEL0 &= ~(BIT5 | BIT6); /* USCI_A0 UART operation*/ \
P3DIR |= BIT4; P3SEL1 |= BIT4; /*output 3.4 with SMCLK*/ \
PJSEL0 |= BIT4 | BIT5; /*LFXT*/\
PM5CTL0 &= ~LOCKLPM5; P1IFG = 0x00; /*disable default Hi-Z, Must clear IFG here else P1.1 will interrupt*/)
enum switches{SW1 = 1,SW2,SW3 = 4,SW4 = 8,SW5 = 16,SW6 = 32,ALL = 64}; //ALL will flip the state of all switches
//declarations
void initClockTo16MHz(void);
void initUART(void);
unsigned int CRC(char *payload);
void initTimerB0(void);
void resetTimerSeq(void);
//unsigned int CCITT_Update(unsigned int init, unsigned int input);
#endif /* RC_H_ */