Sample SPI drivers for a number of the Adesto Technologies flash devices.
Functions | Variables
moneta.h File Reference

Detailed Description

Declarations of Moneta functions.

Definition in file moneta.h.

#include "cmd_defs.h"
#include "spi_driver.h"
#include "helper_functions.h"
#include <stdio.h>
#include <stdlib.h>

Go to the source code of this file.

Functions

void monetaWaitOnReady ()
 : Wait while Read/Busy Status bit in SRB is 1 (device is busy). More...
 
void monetaWriteEnable ()
 OPCODE: 0x06
Sends opcode to enable writing. More...
 
void monetaWriteDisable ()
 OPCODE: 0x04
Sends opcode to disable writing. More...
 
void monetaReadSR (uint8_t *rxBuffer)
 OPCODE: 0x05
Reads the value in the status registers. More...
 
void monetaWriteSRB1 (uint8_t data)
 OPCODE: 0x01
Writes the value in data to status register byte 1. More...
 
void monetaWriteSRB2 (uint8_t data)
 OPCODE: 0x31
Writes the value in data to status register byte 2. More...
 
void monetaReadArray (uint16_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
 OPCODE: 0x03
Reads rxNumBytes starting from location 'address' and stores the data in the byte array rx. More...
 
void monetaWriteArray (uint16_t address, uint8_t *txBuffer, uint32_t txNumBytes)
 OPCODE: 0x02
Writes txNumBytes bytes of data starting at the address indicated by address. More...
 
void monetaReadMID (uint8_t *rxBuffer)
 OPCODE: 0x9F
Reads the manufacturer ID and stores the data in rxBuffer. More...
 
void monetaUDPDMode1 ()
 OPCODE: 0x79
Sends the device into Ultra Deep Power Down Mode 1. Exit UDPD Mode 1 by power cycling the device or calling function monetaEUDPDHardwareReset() which performs a JEDEC reset. More...
 
void monetaHardwareReset ()
 Exits Ultra Deep Power Down mode using the hardware reset option. More...
 

Variables

uint8_t txMonetaInternalBuffer [MAXIMUM_TX_BYTES]
 

Function Documentation

◆ monetaHardwareReset()

void monetaHardwareReset ( )

Exits Ultra Deep Power Down mode using the hardware reset option.

Return values
void

Definition at line 177 of file moneta.c.

◆ monetaReadArray()

void monetaReadArray ( uint16_t  address,
uint8_t *  rxBuffer,
uint32_t  rxNumBytes 
)

OPCODE: 0x03
Reads rxNumBytes starting from location 'address' and stores the data in the byte array rx.

Parameters
address2 byte address starting from which the data in memory will be read.
rxBufferPointer to the byte array in which the read data will be stored. Must have at least rxNumBytes elements.
rxNumBytesNumber of bytes to be read from the memory. rxBuffer must have a minimum of this many elements.
Return values
void

Definition at line 121 of file moneta.c.

◆ monetaReadMID()

void monetaReadMID ( uint8_t *  rxBuffer)

OPCODE: 0x9F
Reads the manufacturer ID and stores the data in rxBuffer.

Parameters
rxBufferPointer to a byte array in which the data will be stored. Minimum of 8 bytes required.
Return values
void

Definition at line 157 of file moneta.c.

◆ monetaReadSR()

void monetaReadSR ( uint8_t *  rxBuffer)

OPCODE: 0x05
Reads the value in the status registers.

Parameters
rxBufferPointer to the byte array in which the read data will be stored. Must have at least 2 elements.
Return values
void

Definition at line 86 of file moneta.c.

◆ monetaUDPDMode1()

void monetaUDPDMode1 ( )

OPCODE: 0x79
Sends the device into Ultra Deep Power Down Mode 1. Exit UDPD Mode 1 by power cycling the device or calling function monetaEUDPDHardwareReset() which performs a JEDEC reset.

Return values
void

Definition at line 167 of file moneta.c.

◆ monetaWaitOnReady()

void monetaWaitOnReady ( )

: Wait while Read/Busy Status bit in SRB is 1 (device is busy).

Return values
void

Definition at line 53 of file moneta.c.

◆ monetaWriteArray()

void monetaWriteArray ( uint16_t  address,
uint8_t *  txBuffer,
uint32_t  txNumBytes 
)

OPCODE: 0x02
Writes txNumBytes bytes of data starting at the address indicated by address.

Parameters
addressThe 2 bytes address indicating the first location to be written to. Note page restrictions in manual.
txBufferPointer to the tx bytes that will be stored in memory. Must have a minimum of txNumBytes elements.
txNumBytesNumber of bytes to be written to the device. txBuffer must have a minimum of this many elements.
Return values
void
Warning
Check datasheet for the maximum number of bytes that can be written, as well as the device behavior if writing goes beyond the page boundary.

Definition at line 134 of file moneta.c.

◆ monetaWriteDisable()

void monetaWriteDisable ( )

OPCODE: 0x04
Sends opcode to disable writing.

Return values
void

Definition at line 75 of file moneta.c.

◆ monetaWriteEnable()

void monetaWriteEnable ( )

OPCODE: 0x06
Sends opcode to enable writing.

Return values
void

Definition at line 64 of file moneta.c.

◆ monetaWriteSRB1()

void monetaWriteSRB1 ( uint8_t  data)

OPCODE: 0x01
Writes the value in data to status register byte 1.

Parameters
dataByte of data to be written into status register byte 1.
Return values
void

Definition at line 97 of file moneta.c.

◆ monetaWriteSRB2()

void monetaWriteSRB2 ( uint8_t  data)

OPCODE: 0x31
Writes the value in data to status register byte 2.

Parameters
dataByte of data to be written into status register byte 2.
Return values
void

Definition at line 109 of file moneta.c.

Variable Documentation

◆ txMonetaInternalBuffer

uint8_t txMonetaInternalBuffer[MAXIMUM_TX_BYTES]

Definition at line 49 of file moneta.c.