-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathAMG88_proc.h
107 lines (85 loc) · 3.51 KB
/
AMG88_proc.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/*!\file AMG88_proc.h
** \author SMFSW
** \copyright MIT (c) 2017-2024, SMFSW
** \brief AMG88 Driver procedures
** \details AMG88: Infrared Array Sensor (Grid-EYE)
**/
/****************************************************************/
#ifndef __AMG88_PROC_H__
#define __AMG88_PROC_H__
#ifdef __cplusplus
extern "C" {
#endif
#include "sarmfsw.h"
#include "AMG88.h"
#if defined(HAL_I2C_MODULE_ENABLED)
/****************************************************************/
// *****************************************************************************
// Section: Constants
// *****************************************************************************
#define AMG88_CHIP_ID 0x00 //!< AMG88 Chip ID to check against
// *****************************************************************************
// Section: Types
// *****************************************************************************
/*!\struct AMG88_t
** \brief AMG88 user interface struct
**/
typedef struct AMG88_t {
uint16_t Pixels[8][8]; //!< Grid-EYE current raw temperature
uint16_t Thermistor; //!< Thermistor raw temperature
struct {
I2C_slave_t * slave_inst; //!< Slave structure
PeripheralGPIO_t INT_GPIO; //!< Interrupt GPIO struct
} cfg;
} AMG88_t;
extern AMG88_t AMG88[I2C_AMG88_NB]; //!< AMG88 User structure
// *****************************************************************************
// Section: Interface Routines
// *****************************************************************************
/******************/
/*** Procedures ***/
/******************/
/*!\brief Initialization Sequence for AMG88 peripheral
** \weak AMG88 Init sequence may be user implemented if custom initialization sequence needed
** \param[in] pCpnt - Pointer to AMG88 component
** \return FctERR - error code
**/
FctERR NONNULL__ AMG88_Init_Sequence(AMG88_t * const pCpnt);
/*!\brief Handler for AMG88 peripheral
** \weak AMG88 handler may be user implemented to suit custom needs
** \note May be called periodically to handle AMG88 tasks
** \note Alternately may be called when event occurs on AMG88 pin (or by calling \ref AMG88_handler_it instead)
** \param[in] pCpnt - Pointer to AMG88 component
** \return FctERR - error code
**/
FctERR NONNULL__ AMG88_handler(AMG88_t * const pCpnt);
/*!\brief Handler for AMG88 peripheral GPIO interrupt
** \note \ref AMG88_INT_GPIO_Init has to be called at init before using interrupt handler function
** \weak AMG88 GPIO interrupt handler may be user implemented to suit custom needs
** \note May be called periodically to handle AMG88 tasks through interrupts
** \param[in] pCpnt - Pointer to AMG88 component
** \return FctERR - error code
**/
FctERR NONNULL__ AMG88_handler_it(AMG88_t * const pCpnt);
/*!\brief Handler for all AMG88 peripherals
** \note May be called periodically to handle all AMG88 tasks
**/
__INLINE void INLINE__ AMG88_handler_all(void) {
for (AMG88_t * pCpnt = AMG88 ; pCpnt < &AMG88[I2C_AMG88_NB] ; pCpnt++) {
AMG88_handler(pCpnt); }
}
/*!\brief Handler for all AMG88 peripherals GPIO interrupt
** \note \ref AMG88_INT_GPIO_Init has to be called at init before using interrupt handler function
** \note May be called periodically to handle all AMG88 tasks
**/
__INLINE void INLINE__ AMG88_handler_it_all(void) {
for (AMG88_t * pCpnt = AMG88 ; pCpnt < &AMG88[I2C_AMG88_NB] ; pCpnt++) {
AMG88_handler_it(pCpnt); }
}
/****************************************************************/
#endif
#ifdef __cplusplus
}
#endif
#endif /* __AMG88_PROC_H__ */
/****************************************************************/