#pragma once
#ifndef _UTILS_H
#define _UTILS_H

#include "stm32g0xx.h"

/* Type defs */
typedef union {
  uint64_t  u64;
  int64_t   i64;
  uint32_t  u32[2];
  int32_t   i32[2];
} nt64_t;

typedef enum {
  Flash_Ok = 0,
  Flash_Error = 1,
  Flash_PG_End = 2,
  Flash_PG_Clear = 3
} flash_result_t;

/* Defines */
#define FLASH_PAGE_START  0x0800F800
#define FLASH_PAGE_END    0x0800FFF8
#define FLASH_PAGE_NMB    31
#define FLASH_PAGE_NUM    1

/* Functions prototypes */
flash_result_t Flash_Write(uint64_t * data);
flash_result_t Flash_Read(uint64_t * data);

#endif /* _UTILS_H */
