PHiLIP
app_reg.h
Go to the documentation of this file.
1 /*
2  * Copyright 2020 Kevin Weiss for HAW Hamburg
3  *
4  * This file is subject to the terms and conditions of the MIT License. See the
5  * file LICENSE in the top level directory for more details.
6  * SPDX-License-Identifier: MIT
7  */
8 
22 #ifndef APP_REG_H_
23 #define APP_REG_H_
24 
25 /* Function prototypes ********************************************************/
32 void init_app_reg(map_t *reg);
33 
41 error_t execute_reg_change();
42 
48 uint32_t get_reg_size();
49 
65 void unprotected_read_uint8(uint32_t index, uint8_t *data);
66 
77 error_t read_reg(uint32_t index, uint8_t *data);
78 
92 error_t read_regs(uint32_t index, uint8_t *data, uint16_t size);
93 
107 error_t write_reg(uint32_t index, uint8_t data, uint8_t access);
108 
123 error_t write_regs(uint32_t index, uint8_t *data, uint16_t size, uint8_t access);
124 
130 void add_index(uint16_t *i);
131 
137 void sub_index(uint16_t *i);
138 #endif /* APP_REG_H_ */
139 
error_t execute_reg_change()
Executes or commits all register changes on the periphs.
Definition: app_reg.c:61
error_t write_regs(uint32_t index, uint8_t *data, uint16_t size, uint8_t access)
Writes multiple register from the register map.
Definition: app_reg.c:104
error_t read_regs(uint32_t index, uint8_t *data, uint16_t size)
Reads multiple registers from the register map.
Definition: app_reg.c:89
uint32_t get_reg_size()
Gets the total size of the register map in bytes.
Definition: app_reg.c:77
void add_index(uint16_t *i)
Adds a number and wraps around if register size exceeded.
Definition: app_reg.c:122
void unprotected_read_uint8(uint32_t index, uint8_t *data)
An unprotected read from the register map.
Definition: app_reg.c:81
The memory map.
Definition: PHiLIP_typedef.h:340
error_t write_reg(uint32_t index, uint8_t data, uint8_t access)
Writes a register from the register map.
Definition: app_reg.c:99
error_t read_reg(uint32_t index, uint8_t *data)
Reads a register from the register map.
Definition: app_reg.c:85
void init_app_reg(map_t *reg)
Initializes application registers.
Definition: app_reg.c:50
void sub_index(uint16_t *i)
Subtracts a number and wraps around if 0.
Definition: app_reg.c:128