Sample SPI drivers for a number of the Adesto Technologies flash devices.
moneta.h
Go to the documentation of this file.
1 /*
2  * The Clear BSD License
3  * Copyright (c) 2018 Adesto Technologies Corporation, Inc
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without modification,
7  * are permitted (subject to the limitations in the disclaimer below) provided
8  * that the following conditions are met:
9  *
10  * o Redistributions of source code must retain the above copyright notice, this list
11  * of conditions and the following disclaimer.
12  *
13  * o Redistributions in binary form must reproduce the above copyright notice, this
14  * list of conditions and the following disclaimer in the documentation and/or
15  * other materials provided with the distribution.
16  *
17  * o Neither the name of the copyright holder nor the names of its
18  * contributors may be used to endorse or promote products derived from this
19  * software without specific prior written permission.
20  *
21  * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE.
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
23  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24  * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
25  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
26  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
27  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
29  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 
41 #ifndef MONETA_H_
42 #define MONETA_H_
43 
44 #include "cmd_defs.h"
45 #include "spi_driver.h"
46 #include "helper_functions.h"
47 #include <stdio.h>
48 #include <stdlib.h>
49 
50 #if (PARTNO == RM331x) || \
51  (ALL == 1)
52 
54 
55 /******************************************
56  *
57  *
58  * Moneta Commands
59  *
60  *
61  ******************************************/
62 
68 void monetaWaitOnReady();
69 
76 void monetaWriteEnable();
77 
84 void monetaWriteDisable();
85 
95 void monetaReadSR(uint8_t *rxBuffer);
96 
105 void monetaWriteSRB1(uint8_t data);
106 
115 void monetaWriteSRB2(uint8_t data);
116 
129 void monetaReadArray(uint16_t address, uint8_t *rxBuffer, uint32_t rxNumBytes);
130 
147 void monetaWriteArray(uint16_t address, uint8_t *txBuffer, uint32_t txNumBytes);
148 
158 void monetaReadMID(uint8_t *rxBuffer);
159 
168 void monetaUDPDMode1();
169 
175 void monetaHardwareReset();
176 
177 #endif
178 
179 #endif /* ADESTO_LAYER_H_ */
uint8_t txMonetaInternalBuffer[MAXIMUM_TX_BYTES]
Definition: moneta.c:49
void monetaWriteEnable()
OPCODE: 0x06 Sends opcode to enable writing.
Definition: moneta.c:64
void monetaWaitOnReady()
: Wait while Read/Busy Status bit in SRB is 1 (device is busy).
Definition: moneta.c:53
Definitions for opcodes.
#define MAXIMUM_TX_BYTES
Definition: cmd_defs.h:46
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...
Definition: moneta.c:134
void monetaHardwareReset()
Exits Ultra Deep Power Down mode using the hardware reset option.
Definition: moneta.c:177
Declarations of spi_driver functions.
void monetaWriteSRB1(uint8_t data)
OPCODE: 0x01 Writes the value in data to status register byte 1.
Definition: moneta.c:97
void monetaReadMID(uint8_t *rxBuffer)
OPCODE: 0x9F Reads the manufacturer ID and stores the data in rxBuffer.
Definition: moneta.c:157
void monetaWriteDisable()
OPCODE: 0x04 Sends opcode to disable writing.
Definition: moneta.c:75
void monetaReadArray(uint16_t address, uint8_t *rxBuffer, uint32_t rxNumBytes)
OPCODE: 0x03 Reads rxNumBytes starting from location &#39;address&#39; and stores the data in the byte arra...
Definition: moneta.c:121
void monetaWriteSRB2(uint8_t data)
OPCODE: 0x31 Writes the value in data to status register byte 2.
Definition: moneta.c:109
Declarations of helper functions.
void monetaUDPDMode1()
OPCODE: 0x79 Sends the device into Ultra Deep Power Down Mode 1. Exit UDPD Mode 1 by power cycling ...
Definition: moneta.c:167
void monetaReadSR(uint8_t *rxBuffer)
OPCODE: 0x05 Reads the value in the status registers.
Definition: moneta.c:86