Instruction Manual
UG_6612_036 78M6612 M-API Library User Guide
Rev. 1.00 17
4 MAPI Libraries
The following sections describe the available MAPI calls supported by these libraries.
4.1 Library Initialization and Operation
4.1.1 MAPI_Init()
Purpose Initialize all critical variables, start the Compute Engine (CE) and its interrupts,
start the MPU timer, setup all default values. The application must first call this
API before any attempt to use other APIs.
Synopsis Void MAPI_Init( void );
Parameters None.
Return Codes None.
4.1.2 MAPI_MeterRun()
Purpose Run this function in foreground mode periodically to reset the watchdog, update
all measurement outputs, and compare data to Min/Max thresholds. Once
MAPI_Init is called, the CE will update all atomic measurements periodically. It
is the task of the application to put this API into its main loop so that it can post-
process the data just imported from the CE. If this API is called more than once
within the same accumulation interval, no changes will be updated and a FALSE
will be returned. Typically, the application layer will then call
MAPI_MeterStatus() to check for any alarm conditions and call
MAPI_GetSetRegister()to get updated measurement data.
Synopsis Bool MAPI_MeterRun ( void );
Parameters None.
Return Codes TRUE (1) – New data has been updated.
FALSE(0) – No change from the last update run.
4.1.3 MAPI_MinMaxSetGet()
Purpose Start or Stop MinMax control.
Synopsis uint8_t MAPI_MinMaxSetGet( uint8_t SetData, uint8_t Op)
Parameters Op: input parameter.
Get = 0, Set = 1.
SetData: input parameter.
When Op = 1, set MinMax control register to SetData. MinMax control register is
defined as: Bit1=Start_MinMax, Bit0=Reset_MinMax. It is customary that when
Start_MinMax is set (Bit1 = 1), Reset_MinMax (Bit0 = 1) shall also be set.
Reset_MinMax is auto-cleared by the library.
Return Codes Current value of MinMax register.