nexpaq module interface library

Fork of nexpaq_mdk by Maxim nexpaq

Committer:
nexpaq
Date:
Fri Sep 23 16:19:39 2016 +0000
Revision:
0:9ac726a95d44
Moved nexpaq_mdk to a library

Who changed what in which revision?

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