@@ -1078,4 +1078,114 @@ void WiFiDrv::analogWrite(uint8_t pin, uint8_t value)
10781078 SpiDrv::spiSlaveDeselect ();
10791079}
10801080
1081+ void WiFiDrv::wpa2EntSetIdentity (const char * identity)
1082+ {
1083+ WAIT_FOR_SLAVE_SELECT ();
1084+ // Send Command
1085+ SpiDrv::sendCmd (WPA2_ENTERPRISE_SET_IDENTITY, PARAM_NUMS_1);
1086+ SpiDrv::sendParam ((uint8_t *)identity, strlen (identity), LAST_PARAM);
1087+
1088+ // pad to multiple of 4
1089+ int commandSize = 5 + strlen (identity);
1090+ while (commandSize % 4 ) {
1091+ SpiDrv::readChar ();
1092+ commandSize++;
1093+ }
1094+
1095+ SpiDrv::spiSlaveDeselect ();
1096+ // Wait the reply elaboration
1097+ SpiDrv::waitForSlaveReady ();
1098+ SpiDrv::spiSlaveSelect ();
1099+
1100+ // Wait for reply
1101+ uint8_t _data = 0 ;
1102+ uint8_t _dataLen = 0 ;
1103+ if (!SpiDrv::waitResponseCmd (WPA2_ENTERPRISE_SET_IDENTITY, PARAM_NUMS_1, &_data, &_dataLen))
1104+ {
1105+ WARN (" error waitResponse" );
1106+ _data = WL_FAILURE;
1107+ }
1108+ SpiDrv::spiSlaveDeselect ();
1109+ }
1110+
1111+ void WiFiDrv::wpa2EntSetPassword (const char * password)
1112+ {
1113+ WAIT_FOR_SLAVE_SELECT ();
1114+ // Send Command
1115+ SpiDrv::sendCmd (WPA2_ENTERPRISE_SET_PASSWORD, PARAM_NUMS_1);
1116+ SpiDrv::sendParam ((uint8_t *)password, strlen (password), LAST_PARAM);
1117+
1118+ // pad to multiple of 4
1119+ int commandSize = 5 + strlen (password);
1120+ while (commandSize % 4 ) {
1121+ SpiDrv::readChar ();
1122+ commandSize++;
1123+ }
1124+
1125+ SpiDrv::spiSlaveDeselect ();
1126+ // Wait the reply elaboration
1127+ SpiDrv::waitForSlaveReady ();
1128+ SpiDrv::spiSlaveSelect ();
1129+
1130+ // Wait for reply
1131+ uint8_t _data = 0 ;
1132+ uint8_t _dataLen = 0 ;
1133+ if (!SpiDrv::waitResponseCmd (WPA2_ENTERPRISE_SET_PASSWORD, PARAM_NUMS_1, &_data, &_dataLen))
1134+ {
1135+ WARN (" error waitResponse" );
1136+ _data = WL_FAILURE;
1137+ }
1138+ SpiDrv::spiSlaveDeselect ();
1139+ }
1140+
1141+ void WiFiDrv::wpa2EntSetUsername (const char * username)
1142+ {
1143+ WAIT_FOR_SLAVE_SELECT ();
1144+ // Send Command
1145+ SpiDrv::sendCmd (WPA2_ENTERPRISE_SET_USERNAME, PARAM_NUMS_1);
1146+ SpiDrv::sendParam ((uint8_t *)username, strlen (username), LAST_PARAM);
1147+
1148+ // pad to multiple of 4
1149+ int commandSize = 5 + strlen (username);
1150+ while (commandSize % 4 ) {
1151+ SpiDrv::readChar ();
1152+ commandSize++;
1153+ }
1154+
1155+ SpiDrv::spiSlaveDeselect ();
1156+ // Wait the reply elaboration
1157+ SpiDrv::waitForSlaveReady ();
1158+ SpiDrv::spiSlaveSelect ();
1159+
1160+ // Wait for reply
1161+ uint8_t _data = 0 ;
1162+ uint8_t _dataLen = 0 ;
1163+ if (!SpiDrv::waitResponseCmd (WPA2_ENTERPRISE_SET_USERNAME, PARAM_NUMS_1, &_data, &_dataLen))
1164+ {
1165+ WARN (" error waitResponse" );
1166+ _data = WL_FAILURE;
1167+ }
1168+ SpiDrv::spiSlaveDeselect ();
1169+ }
1170+
1171+ void WiFiDrv::wpa2EntEnable ()
1172+ {
1173+ WAIT_FOR_SLAVE_SELECT ();
1174+
1175+ // Send Command
1176+ SpiDrv::sendCmd (WPA2_ENTERPRISE_ENABLE, PARAM_NUMS_0);
1177+
1178+ SpiDrv::spiSlaveDeselect ();
1179+ // Wait the reply elaboration
1180+ SpiDrv::waitForSlaveReady ();
1181+ SpiDrv::spiSlaveSelect ();
1182+
1183+ // Wait for reply
1184+ uint8_t _data = 1 ;
1185+ uint8_t _dataLen = 0 ;
1186+ SpiDrv::waitResponseCmd (WPA2_ENTERPRISE_ENABLE, PARAM_NUMS_1, &_data, &_dataLen);
1187+
1188+ SpiDrv::spiSlaveDeselect ();
1189+ }
1190+
10811191WiFiDrv wiFiDrv;
0 commit comments