+ /**
+ * Write the MDMCTRL0 register
+ */
+ void writeMdmctrl0() {
+ atomic {
+ call MDMCTRL0.write( ( 1 << CC2420_MDMCTRL0_RESERVED_FRAME_MODE ) |
+ ( 0 << CC2420_MDMCTRL0_ADR_DECODE ) | // Sniffer behavior
+ ( 2 << CC2420_MDMCTRL0_CCA_HYST ) |
+ ( 3 << CC2420_MDMCTRL0_CCA_MOD ) |
+ ( 1 << CC2420_MDMCTRL0_AUTOCRC ) |
+ ( 0 << CC2420_MDMCTRL0_AUTOACK ) | // Sniffer behavior
+ ( 0 << CC2420_MDMCTRL0_AUTOACK ) |
+ ( 2 << CC2420_MDMCTRL0_PREAMBLE_LENGTH ) );
+ }
+ // Jon Green:
+ // MDMCTRL1.CORR_THR is defaulted to 20 instead of 0 like the datasheet says
+ // If we add in changes to MDMCTRL1, be sure to include this fix.
+ }
+
+ /**
+ * Write the PANID register
+ */
+ void writeId() {
+ nxle_uint16_t id[ 2 ];
+
+ atomic {
+ id[ 0 ] = m_pan;
+ id[ 1 ] = m_short_addr;
+ }
+
+ call PANID.write(0, (uint8_t*)&id, sizeof(id));
+ }
+
+
+