62 lines
1.1 KiB
C
62 lines
1.1 KiB
C
|
|
/*
|
|||
|
|
* BL25CM1A.c
|
|||
|
|
*
|
|||
|
|
* Created on: 7 <EFBFBD><EFBFBD><EFBFBD><EFBFBD>. 2023 <EFBFBD>.
|
|||
|
|
* Author: seklyuts
|
|||
|
|
*/
|
|||
|
|
#include "f28x_project.h"
|
|||
|
|
#include "spi_init.h"
|
|||
|
|
|
|||
|
|
#define WREN 0b00000110 //Enable Write Operations
|
|||
|
|
#define WRDI 0b00000100 //Disable Write Operations
|
|||
|
|
#define RDSR 0b00000101 //Read Status Register
|
|||
|
|
#define WRSR 0b00000001 //Write Status Register
|
|||
|
|
#define READ 0b00000011 //Read Data from Memory
|
|||
|
|
#define WRITE 0b00000010 //Write Data to Memory
|
|||
|
|
#define RDID 0b10000011 //Read identification page
|
|||
|
|
#define WRID 0b10000010 //Write identification page
|
|||
|
|
#define RDLS 0b10000011 //Reads the identification page lock status
|
|||
|
|
#define LID 0b10000010 //Locks the identification page in read-only mode
|
|||
|
|
|
|||
|
|
|
|||
|
|
uint16_t sdata2 = RDSR; // sent data
|
|||
|
|
uint16_t rdata2 = 0; // received data
|
|||
|
|
uint16_t error2 = 0;
|
|||
|
|
|
|||
|
|
void Bl25cm1a_en(void)
|
|||
|
|
{
|
|||
|
|
transmitBData(WREN);
|
|||
|
|
while(SpibRegs.SPIFFRX.bit.RXFFST != 1)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
rdata2 = SpibRegs.SPIRXBUF;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
void Bl25cm1a_write(void)
|
|||
|
|
{
|
|||
|
|
transmitBData(sdata2);
|
|||
|
|
|
|||
|
|
//
|
|||
|
|
// Wait until data is received
|
|||
|
|
//
|
|||
|
|
while(SpibRegs.SPIFFRX.bit.RXFFST != 1)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
rdata2 = SpibRegs.SPIRXBUF;
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
void Bl25cm1a_read(void)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|