69 lines
1.9 KiB
C
69 lines
1.9 KiB
C
/*******************************************************************************
|
|
* @file app_raw_main.h
|
|
|
|
******************************************************************************/
|
|
|
|
#ifndef _CAT_INTERFACE_H_
|
|
#define _CAT_INTERFACE_H_
|
|
#include "sdk_config.h"
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <stdarg.h>
|
|
#include <stdint.h>
|
|
#include <stdlib.h>
|
|
#include "nordic_common.h"
|
|
#include "nrf.h"
|
|
#include "sdk_errors.h"
|
|
#define EEPROM_I2C_ADDRESS 0x50
|
|
#define EEPROM_PAGE_SIZE 64
|
|
#define SERIAL_ADDRESS 0x0030
|
|
|
|
|
|
ret_code_t encrypt_data(const uint8_t *input, size_t length, uint8_t *output, size_t *output_len);
|
|
|
|
ret_code_t decrypt_data(const uint8_t *input, size_t length, uint8_t *output);
|
|
|
|
ret_code_t eeprom_write_encrypted(uint16_t mem_address, const uint8_t *plaintext, size_t length);
|
|
|
|
|
|
ret_code_t eeprom_read_decrypted(uint16_t mem_address, uint8_t *plaintext, size_t original_length);
|
|
|
|
|
|
|
|
ret_code_t eeprom_read_page(uint16_t mem_address, uint8_t *data);
|
|
|
|
ret_code_t eeprom_write_page(uint16_t mem_address, const uint8_t *data);
|
|
|
|
ret_code_t eeprom_write_byte(uint16_t mem_address, uint8_t data);
|
|
|
|
ret_code_t eeprom_read_byte(uint16_t mem_address, uint8_t *data);
|
|
|
|
ret_code_t eeprom_write_bytes(uint16_t mem_address, const uint8_t *data, size_t length);
|
|
|
|
ret_code_t eeprom_read_bytes(uint16_t mem_address, uint8_t *data, size_t length);
|
|
|
|
ret_code_t eeprom_write_uint16_array(uint16_t start_address, const uint16_t *data, size_t count);
|
|
|
|
ret_code_t eeprom_read_uint16_array(uint16_t start_address, uint16_t *data, size_t count);
|
|
|
|
ret_code_t eeprom_write_word(uint16_t mem_address, uint16_t data);
|
|
|
|
ret_code_t eeprom_read_word(uint16_t mem_address, uint16_t *data);
|
|
|
|
|
|
void eeprom_uninitialize(void);
|
|
|
|
void eeprom_initialize(void);
|
|
|
|
ret_code_t eeprom_initialize_safe(void);
|
|
|
|
|
|
|
|
ret_code_t eeprom_write_uint32(uint16_t mem_address, uint32_t data);
|
|
|
|
ret_code_t eeprom_read_uint32(uint16_t mem_address, uint32_t *data);
|
|
|
|
|
|
#endif /* */
|
|
|