void vscp_init(void) { vscp_initledfunc = VSCP_LED_ON; // read the nickname id vscp_nickname = vscp_readNicknamePermanent(); // if zero set to uninitialised if ( 0 == vscp_nickname) vscp_nickname = VSCP_ADDRESS_FREE; // Start init. blink if no nodeid if ( VSCP_ADDRESS_FREE == vscp_nickname ) vscp_initledfunc = VSCP_LED_BLINK1; // Init. incoming event vscp_imsg.flags = 0; vscp_imsg.priority = 0; vscp_imsg.vscp_class = 0; vscp_imsg.vscp_type = 0; // Init. outgoing event vscp_omsg.flags = 0; vscp_omsg.priority = 0; vscp_omsg.vscp_class = 0; vscp_omsg.vscp_type = 0; vscp_errorcnt = 0; // No errors yet vscp_alarmstatus = 0; // No alarm status vscp_probe_address = 0; // Initial state vscp_node_state = VSCP_STATE_STARTUP; vscp_node_substate = VSCP_SUBSTATE_NONE; vscp_probe_cnt = 0; vscp_page_select = 0; // Initialise time keeping vscp_timer = 0; vscp_configtimer = 0; vscp_second = 0; vscp_minute = 0; vscp_hour = 0; }
/*! * @brief verify functionality of the custom defined vscp functions * vscp_firmware.h @ line 457 */ void test_vscp_externals(){ uint8_t FlashValue8; /*! gets an 8-bit vscp data field from permanent storage */ uint8_t val; /*! assign a value to write to buffer -> permanent storage */ printf("Testing vscp_functions\r\n"); val = 0x11; vscp_writeNicknamePermanent(val); FlashValue8 = vscp_readNicknamePermanent(); printf("Read %d dec, %x hex\r\n", FlashValue8, FlashValue8); val = 0x22; vscp_setSegmentCRC(val); FlashValue8 = vscp_getSegmentCRC(); printf("Read %d dec, %x hex\r\n", FlashValue8, FlashValue8); val = 0x33; vscp_setControlByte(val); FlashValue8 = vscp_getControlByte(); printf("Read %d dec, %x hex\r\n", FlashValue8, FlashValue8); }