nexpaq / Mbed OS ALS_Prox_Demo

Dependencies:   MAX44000 nexpaq_mdk

Fork of ALS_Prox_Demo by Maxim nexpaq

Committer:
nexpaq
Date:
Sat Sep 17 16:21:40 2016 +0000
Revision:
0:b86eda0e990d
checking in to share

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nexpaq 0:b86eda0e990d 1 /*
nexpaq 0:b86eda0e990d 2 * np_module_mdk_v1.h
nexpaq 0:b86eda0e990d 3 * developer call the API of MDK by the include file.
nexpaq 0:b86eda0e990d 4 * Created on: July 14, 2016
nexpaq 0:b86eda0e990d 5 * Author: Alan.Lin
nexpaq 0:b86eda0e990d 6 *
nexpaq 0:b86eda0e990d 7 * Copyright: NexPack Ltd.
nexpaq 0:b86eda0e990d 8 */
nexpaq 0:b86eda0e990d 9
nexpaq 0:b86eda0e990d 10 #ifndef NP_MODULE_MDK_V1_H_
nexpaq 0:b86eda0e990d 11 #define NP_MODULE_MDK_V1_H_
nexpaq 0:b86eda0e990d 12
nexpaq 0:b86eda0e990d 13 #include <stdint.h>
nexpaq 0:b86eda0e990d 14
nexpaq 0:b86eda0e990d 15 #ifdef __cplusplus
nexpaq 0:b86eda0e990d 16 extern "C" {
nexpaq 0:b86eda0e990d 17 #endif
nexpaq 0:b86eda0e990d 18
nexpaq 0:b86eda0e990d 19 typedef void (*my_VOID_UCUC)(uint8_t*, uint8_t);
nexpaq 0:b86eda0e990d 20 typedef void (*app_function)(void);
nexpaq 0:b86eda0e990d 21
nexpaq 0:b86eda0e990d 22 typedef struct {
nexpaq 0:b86eda0e990d 23 uint16_t command;
nexpaq 0:b86eda0e990d 24 my_VOID_UCUC function;
nexpaq 0:b86eda0e990d 25 } MDK_REGISTER_CMD;
nexpaq 0:b86eda0e990d 26
nexpaq 0:b86eda0e990d 27 #define MDK_REGISTER_SUCCESS 0x00
nexpaq 0:b86eda0e990d 28 #define MDK_REGISTER_FAILD 0x01
nexpaq 0:b86eda0e990d 29
nexpaq 0:b86eda0e990d 30 void delay_ms(uint32_t t_ms);
nexpaq 0:b86eda0e990d 31 /*
nexpaq 0:b86eda0e990d 32 * Description: API to make the app initial by the api
nexpaq 0:b86eda0e990d 33 * Parameter: np_app_setup-the initial function of APP
nexpaq 0:b86eda0e990d 34 * Return: null
nexpaq 0:b86eda0e990d 35 */
nexpaq 0:b86eda0e990d 36 void np_api_setup(app_function np_app_setup);
nexpaq 0:b86eda0e990d 37
nexpaq 0:b86eda0e990d 38 /*
nexpaq 0:b86eda0e990d 39 * Description: initialize mdk
nexpaq 0:b86eda0e990d 40 * Parameter: null
nexpaq 0:b86eda0e990d 41 * Return: null
nexpaq 0:b86eda0e990d 42 */
nexpaq 0:b86eda0e990d 43 void np_api_init();
nexpaq 0:b86eda0e990d 44
nexpaq 0:b86eda0e990d 45 /*
nexpaq 0:b86eda0e990d 46 * Description: signal ready to start
nexpaq 0:b86eda0e990d 47 * Parameter: null
nexpaq 0:b86eda0e990d 48 * Return: null
nexpaq 0:b86eda0e990d 49 */
nexpaq 0:b86eda0e990d 50 void np_api_start();
nexpaq 0:b86eda0e990d 51
nexpaq 0:b86eda0e990d 52 /*
nexpaq 0:b86eda0e990d 53 * Description: check for bootloader request
nexpaq 0:b86eda0e990d 54 * Parameter: null
nexpaq 0:b86eda0e990d 55 * Return: null
nexpaq 0:b86eda0e990d 56 */
nexpaq 0:b86eda0e990d 57 void np_api_bsl_chk();
nexpaq 0:b86eda0e990d 58
nexpaq 0:b86eda0e990d 59 /*
nexpaq 0:b86eda0e990d 60 * Description: API to run the loop function of APP, "np_app_loop()" will run on while(1),running forever when software on app mode
nexpaq 0:b86eda0e990d 61 * Parameter: np_app_loop-the loop function of APP
nexpaq 0:b86eda0e990d 62 * Return: null
nexpaq 0:b86eda0e990d 63 */
nexpaq 0:b86eda0e990d 64 void np_api_loop(app_function np_app_loop);
nexpaq 0:b86eda0e990d 65
nexpaq 0:b86eda0e990d 66 /*
nexpaq 0:b86eda0e990d 67 * Description: API to set app firmware version
nexpaq 0:b86eda0e990d 68 * Parameter: null
nexpaq 0:b86eda0e990d 69 * Return: null
nexpaq 0:b86eda0e990d 70 */
nexpaq 0:b86eda0e990d 71 void np_api_set_app_version(uint8_t HV, uint8_t MV, uint8_t LV);
nexpaq 0:b86eda0e990d 72 /*
nexpaq 0:b86eda0e990d 73 * Description: API to register developer's command callback function
nexpaq 0:b86eda0e990d 74 * Parameter :
nexpaq 0:b86eda0e990d 75 * cmd_func_table:the callback function about the command.
nexpaq 0:b86eda0e990d 76 * The callback function will be called when MDK get the corresponding command.
nexpaq 0:b86eda0e990d 77 * num :The callback function number
nexpaq 0:b86eda0e990d 78 * Return : 0-success; 1-fail
nexpaq 0:b86eda0e990d 79 */
nexpaq 0:b86eda0e990d 80 uint8_t np_api_register(MDK_REGISTER_CMD* cmd_func_table, uint8_t num);
nexpaq 0:b86eda0e990d 81
nexpaq 0:b86eda0e990d 82 /*
nexpaq 0:b86eda0e990d 83 * Description: API to upload data to Phone
nexpaq 0:b86eda0e990d 84 * Parameter:
nexpaq 0:b86eda0e990d 85 * rcmd : The command of the message.
nexpaq 0:b86eda0e990d 86 * pData: Pointer of the space for hold the parameter of the message.
nexpaq 0:b86eda0e990d 87 * pLen : The length of the "pData"
nexpaq 0:b86eda0e990d 88 * Return : 0-success; 1-fail
nexpaq 0:b86eda0e990d 89 */
nexpaq 0:b86eda0e990d 90 uint8_t np_api_upload(uint16_t rcmd,uint8_t *pData, uint8_t pLen);
nexpaq 0:b86eda0e990d 91
nexpaq 0:b86eda0e990d 92 /*
nexpaq 0:b86eda0e990d 93 * Description: API to upload data to Gateway
nexpaq 0:b86eda0e990d 94 * rcmd : The command of the message.
nexpaq 0:b86eda0e990d 95 * pData: Pointer of the space for hold the parameter of the message.
nexpaq 0:b86eda0e990d 96 * pLen : The length of the "pData"
nexpaq 0:b86eda0e990d 97 * Return : 0-success; 1-fail
nexpaq 0:b86eda0e990d 98 */
nexpaq 0:b86eda0e990d 99 uint8_t np_api_upload_to_station(uint16_t rcmd, uint8_t *pData, uint8_t pLen);
nexpaq 0:b86eda0e990d 100
nexpaq 0:b86eda0e990d 101 /*
nexpaq 0:b86eda0e990d 102 * Description: API to set a manually output address for next POST message
nexpaq 0:b86eda0e990d 103 * Parameter: address-the source address of next message
nexpaq 0:b86eda0e990d 104 * Return: null
nexpaq 0:b86eda0e990d 105 */
nexpaq 0:b86eda0e990d 106 void np_api_set_post_address(uint8_t address);
nexpaq 0:b86eda0e990d 107
nexpaq 0:b86eda0e990d 108 #ifdef __cplusplus
nexpaq 0:b86eda0e990d 109 }
nexpaq 0:b86eda0e990d 110 #endif
nexpaq 0:b86eda0e990d 111
nexpaq 0:b86eda0e990d 112 #endif /* NP_MODULE_MDK_V1_H_ */