nova verzija tcp+udp->serial com

Committer:
bosko001
Date:
Sat Apr 11 17:11:38 2020 +0000
Revision:
4:7abcf4543282
Parent:
DataFlash/dataFlash.cpp@3:1196befeace0
dxml bug removed

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bosko001 3:1196befeace0 1 #include "dataFlash.h"
bosko001 3:1196befeace0 2
bosko001 3:1196befeace0 3 #include "flashDataBlock.h"
bosko001 3:1196befeace0 4 #include "EthernetSetup.h"
bosko001 3:1196befeace0 5 #include "clubbing.h"
bosko001 3:1196befeace0 6 #include "dataFlash.h"
bosko001 3:1196befeace0 7
bosko001 3:1196befeace0 8 //
bosko001 3:1196befeace0 9 //struct S_EthernetAddress
bosko001 3:1196befeace0 10 //{
bosko001 3:1196befeace0 11 // char ip[16];
bosko001 3:1196befeace0 12 // char mask[16];
bosko001 3:1196befeace0 13 // char gate[16];
bosko001 3:1196befeace0 14 // // int port;
bosko001 3:1196befeace0 15 //};
bosko001 3:1196befeace0 16 //
bosko001 3:1196befeace0 17 //struct S_EthernetAddress_Remote
bosko001 3:1196befeace0 18 //{
bosko001 3:1196befeace0 19 // char ip[16];
bosko001 3:1196befeace0 20 // int port;
bosko001 3:1196befeace0 21 //};
bosko001 3:1196befeace0 22 //
bosko001 3:1196befeace0 23 //struct S_FlashData
bosko001 3:1196befeace0 24 //{
bosko001 3:1196befeace0 25 // struct S_EthernetAddress s_EthAdd;
bosko001 3:1196befeace0 26 // char serverPortUdp[6];
bosko001 3:1196befeace0 27 // char serverPortTcp[6];
bosko001 3:1196befeace0 28 // struct S_EthernetAddress_Remote s_EthAddRemUdp[3];
bosko001 3:1196befeace0 29 //// struct S_EthernetAddress_RangeRemote s_EthAddRangeRemUDP;
bosko001 3:1196befeace0 30 // struct S_EthernetAddress_Remote s_EthAddRemTcp[3];
bosko001 3:1196befeace0 31 //// struct S_EthernetAddress_RangeRemote s_EthAddRangeRemTcp;
bosko001 3:1196befeace0 32 // int baudRate, parity, dataBits, stopBits;
bosko001 3:1196befeace0 33 //};
bosko001 3:1196befeace0 34 //
bosko001 3:1196befeace0 35 //union U_FlashData
bosko001 3:1196befeace0 36 //{
bosko001 3:1196befeace0 37 // struct S_FlashData s_flashData;
bosko001 3:1196befeace0 38 // char data[sizeof( struct S_FlashData )];
bosko001 3:1196befeace0 39 //};
bosko001 3:1196befeace0 40
bosko001 3:1196befeace0 41
bosko001 3:1196befeace0 42 struct S_FlashData s_flashData, *gps_fd = &s_flashData;
bosko001 3:1196befeace0 43
bosko001 3:1196befeace0 44 void progDataIntoFlash( struct S_FlashData *ps_fd )
bosko001 3:1196befeace0 45 {
bosko001 3:1196befeace0 46 write_niz_in_flash( 0, (char *)ps_fd, sizeof(S_FlashData) );
bosko001 3:1196befeace0 47 }
bosko001 3:1196befeace0 48
bosko001 3:1196befeace0 49 void readDataFromFlash( struct S_FlashData *ps_fd )
bosko001 3:1196befeace0 50 {
bosko001 3:1196befeace0 51 read_fdb( 0, (char*)ps_fd, sizeof(struct S_FlashData) );
bosko001 3:1196befeace0 52 }
bosko001 3:1196befeace0 53
bosko001 3:1196befeace0 54 void fillDataIntoFlash( void )
bosko001 3:1196befeace0 55 {
bosko001 3:1196befeace0 56 write_niz_in_flash( 0, (char *)gps_fd, sizeof(S_FlashData) );
bosko001 3:1196befeace0 57 }
bosko001 3:1196befeace0 58
bosko001 3:1196befeace0 59 void refreshDataFromFlash( void )
bosko001 3:1196befeace0 60 {
bosko001 3:1196befeace0 61 read_fdb( 0, (char*)gps_fd, sizeof(struct S_FlashData) );
bosko001 3:1196befeace0 62 }
bosko001 3:1196befeace0 63
bosko001 3:1196befeace0 64
bosko001 3:1196befeace0 65 void init_FlashData( void )
bosko001 3:1196befeace0 66 {
bosko001 3:1196befeace0 67 init_fdb( );
bosko001 3:1196befeace0 68 readDataFromFlash( gps_fd );
bosko001 3:1196befeace0 69
bosko001 3:1196befeace0 70 }
bosko001 3:1196befeace0 71
bosko001 3:1196befeace0 72
bosko001 3:1196befeace0 73 void deinit_FlashData( void )
bosko001 3:1196befeace0 74 {
bosko001 3:1196befeace0 75 deinit_fdb( );
bosko001 3:1196befeace0 76 }
bosko001 3:1196befeace0 77
bosko001 3:1196befeace0 78 void showFlashData( void )
bosko001 3:1196befeace0 79 {
bosko001 3:1196befeace0 80 P_str( "FLASH IP ", gps_fd->s_EthAdd.ip );
bosko001 3:1196befeace0 81 P_str( "FLASH MASK ", gps_fd->s_EthAdd.mask );
bosko001 3:1196befeace0 82 P_str( "FLASH GATE ", gps_fd->s_EthAdd.gate );
bosko001 3:1196befeace0 83
bosko001 3:1196befeace0 84 P_str( "FLASH UDP PORT ", gps_fd->serverPortUdp );
bosko001 3:1196befeace0 85 P_str( "FLASH TCP PORT ", gps_fd->serverPortTcp );
bosko001 3:1196befeace0 86
bosko001 3:1196befeace0 87 P_str( "FLASH UDP IP[0] ", gps_fd->s_EthAddRemUdp[0].ip );
bosko001 3:1196befeace0 88 P_int( "FLASH UDP PORT[0] ", gps_fd->s_EthAddRemUdp[0].port );
bosko001 3:1196befeace0 89 P_str( "FLASH TCP IP[0] ", gps_fd->s_EthAddRemTcp[0].ip );
bosko001 3:1196befeace0 90 P_int( "FLASH TCP PORT[0] ", gps_fd->s_EthAddRemTcp[0].port );
bosko001 3:1196befeace0 91
bosko001 3:1196befeace0 92 // P_int( "FLASH SERIAL BAUD ", gps_fd->baudRate );
bosko001 3:1196befeace0 93 // P_int( "FLASH SERIAL BAUD ", gps_fd->parity );
bosko001 3:1196befeace0 94 // P_int( "FLASH SERIAL BAUD ", gps_fd->dataBits );
bosko001 3:1196befeace0 95 // P_int( "FLASH SERIAL BAUD ", gps_fd->stopBits );
bosko001 3:1196befeace0 96 }