EasyManua.ls Logo

Texas Instruments MSP430

Texas Instruments MSP430
413 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
243
{
while(!(IFG2 & UCB0TXIFG));
UCB0TXBUF = tx_data;
while(UCB0STAT & UCBUSY);
}
unsigned char SPI_read(void)
{
unsigned char rx_data = 0;
while(!(IFG2 & UCB0RXIFG));
rx_data = UCB0RXBUF;
while(UCB0STAT & UCBUSY);
return rx_data;
}
unsigned char SPI_transfer(unsigned char tx_data)
{
unsigned char rx_data = 0;
while(!(IFG2 & UCB0TXIFG));
UCB0TXBUF = tx_data;
while(UCB0STAT & UCBUSY);
while(!(IFG2 & UCB0RXIFG));
rx_data = UCB0RXBUF;
while(UCB0STAT & UCBUSY);
return rx_data;
}
SSD1306.h
#include <MSP430.h>
#include "delay.h"
#include "HW_SPI.h"
#define OLED_PORT P1OUT
#define OLED_DIR P1DIR
#define RST_pin BIT2
#define DC_pin BIT3
#define CS_pin BIT4
#define OLED_PORT_OUT() OLED_DIR |= (RST_pin | DC_pin |
CS_pin)
#define OLED_RST_HIGH() OLED_PORT |= RST_pin
#define OLED_RST_LOW() OLED_PORT &= ~RST_pin
#define OLED_DC_HIGH() OLED_PORT |= DC_pin
#define OLED_DC_LOW() OLED_PORT &= ~DC_pin
#define OLED_CS_HIGH() OLED_PORT |= CS_pin
#define OLED_CS_LOW() OLED_PORT &= ~CS_pin
#define Set_Lower_Column_Start_Address_CMD 0x00

Table of Contents

Other manuals for Texas Instruments MSP430

Related product manuals