lalallaa

Dependencies:   MMA8452 mbed

Committer:
EtienneB
Date:
Tue Oct 03 01:28:03 2017 +0000
Revision:
1:6738a65b699f
Parent:
0:4a3d5d86258c
Version semi-finale et commentee de la version a valider

Who changed what in which revision?

UserRevisionLine numberNew contents of line
EtienneB 0:4a3d5d86258c 1 // Envoie message vers Zigbee
EtienneB 0:4a3d5d86258c 2 void init_xbee(uint16_t pan_id){
EtienneB 0:4a3d5d86258c 3 uint8_t MSB = (pan_id >> 8) & 0xFF;
EtienneB 0:4a3d5d86258c 4 uint8_t LSB = pan_id & 0xFF;
EtienneB 0:4a3d5d86258c 5
EtienneB 0:4a3d5d86258c 6 // Mettre a 0 la broche RESET pour 400ms
EtienneB 0:4a3d5d86258c 7 resetXBEE = 0; wait_ms(400);
EtienneB 0:4a3d5d86258c 8 resetXBEE = 1;
EtienneB 0:4a3d5d86258c 9
EtienneB 0:4a3d5d86258c 10 uint8_t mess_set_ID[] = {0x49, 0x44, MSB, LSB }; // PAN_ID
EtienneB 0:4a3d5d86258c 11 uint8_t mess_set_SC[] = {0x53, 0x43, 0x09 }; // SC
EtienneB 0:4a3d5d86258c 12 uint8_t mess_WR [] = {0x57, 0x52}; // WR
EtienneB 0:4a3d5d86258c 13 uint8_t mess_AC [] = {0x41, 0x43}; // AC
EtienneB 0:4a3d5d86258c 14
EtienneB 0:4a3d5d86258c 15 serialXBEE.putc(PLUS);
EtienneB 0:4a3d5d86258c 16 serialXBEE.putc(PLUS);
EtienneB 0:4a3d5d86258c 17 serialXBEE.putc(PLUS); wait_ms(30);
EtienneB 0:4a3d5d86258c 18 send_frame_2Xbee(CMD_AT, FRM_ID_01, mess_set_ID, sizeof(mess_set_ID));
EtienneB 0:4a3d5d86258c 19 send_frame_2Xbee(CMD_AT, FRM_ID_01, mess_set_SC, sizeof(mess_set_SC)); wait_ms(30);
EtienneB 0:4a3d5d86258c 20 send_frame_2Xbee(CMD_AT, FRM_ID_01, mess_WR, sizeof(mess_WR)); wait_ms(30);
EtienneB 0:4a3d5d86258c 21 send_frame_2Xbee(CMD_AT, FRM_ID_01, mess_AC, sizeof(mess_AC)); wait_ms(30);
EtienneB 0:4a3d5d86258c 22 send_frame_2Xbee(CMD_TX_RQST, FRM_ID_01, mess_AC, sizeof(mess_AC));
EtienneB 0:4a3d5d86258c 23 }