Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: nexpaq_dev nexpaq_mdk
Fork of lib_tst_demo by
Diff: main.cpp
- Revision:
- 6:7b51d2ebef23
- Parent:
- 4:494741f7f5b2
diff -r 9b5534e46d30 -r 7b51d2ebef23 main.cpp
--- a/main.cpp Fri Sep 23 16:52:33 2016 +0000
+++ b/main.cpp Sat Oct 15 18:47:18 2016 +0000
@@ -1,13 +1,6 @@
#include "mbed.h"
#include "nexpaq_mdk.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-extern volatile uint8_t flag_jump_bsl;
-#ifdef __cplusplus
-}
-#endif
DigitalOut ledR(P2_4, LED_OFF);
DigitalOut ledG(P2_5, LED_OFF);
DigitalOut ledB(P2_6, LED_OFF);
@@ -21,47 +14,51 @@
/***** Globals *****/
void my_function_CMD_2700(unsigned char *pData, unsigned char len);
const MDK_REGISTER_CMD my_cmd_func_table[FUNCTION_TABLE_NUM] = {
- {0x2700, my_function_CMD_2700}, // Command -> function
+ {0x2700, my_function_CMD_2700}, // Command -> function
};
int lastBtn = 1;
unsigned char btnPress = 0x01;
/***** Functions *****/
-void my_function_CMD_2700(unsigned char *pData, unsigned char len){
- unsigned char response = 0x00;
- ledR = (pData[0]>0) ? LED_ON : LED_OFF ;
- ledG = (pData[1]>0) ? LED_ON : LED_OFF ;
- ledB = (pData[2]>0) ? LED_ON : LED_OFF ;
- np_api_upload(0x2701, &response, 1);
+void my_function_CMD_2700(unsigned char *pData, unsigned char len)
+{
+ unsigned char response = 0x00;
+ ledR = (pData[0]>0) ? LED_ON : LED_OFF ;
+ ledG = (pData[1]>0) ? LED_ON : LED_OFF ;
+ ledB = (pData[2]>0) ? LED_ON : LED_OFF ;
+ np_api_upload(0x2701, &response, 1);
}
/******************************************************************************/
-void app_setup(){
- if ( np_api_register((MDK_REGISTER_CMD*)my_cmd_func_table, FUNCTION_TABLE_NUM) == MDK_REGISTER_FAILD ) {
- // Register failed handle code
- error("MDK Register Failed");
- }
+void app_setup()
+{
+ if ( np_api_register((MDK_REGISTER_CMD*)my_cmd_func_table, FUNCTION_TABLE_NUM) == MDK_REGISTER_FAILD ) {
+ // Register failed handle code
+ error("MDK Register Failed");
+ }
}
-void app_loop() {
- if (!button && lastBtn) {
+void app_loop()
+{
+ if (!button && lastBtn) {
np_api_upload(0x2800, &btnPress, 1);
- }
- lastBtn = button;
+ }
+ lastBtn = button;
}
-int main(void){
-
- np_api_init();
- app_setup();
- np_api_start();
- while(1){
- Thread::wait(LOOP_DELAY);
- app_loop();
- np_api_bsl_chk();
- }
+int main(void)
+{
- return 0;
+ np_api_init();
+ app_setup();
+ np_api_start();
+ while(1) {
+ Thread::wait(LOOP_DELAY);
+ app_loop();
+ np_api_bsl_chk();
+ }
+
+ return 0;
}
