An adapter, supporting a first charging mode and a second charging mode, the first charging mode being a constant voltage mode, the second charging mode being a constant current mode; in the second charging mode, an output voltage and an output current of the adapter being directly applied to both ends of a battery of a device to be charged for direct charging of the battery, and the adapter comprising: a power conversion unit comprising an input for inputting alternating current, a primary rectifier unit, a switch controlled by a PWM controller, a transformer (Tl), and a secondary rectifier unit, the transformer coupling current to a secondary side from a primary side, wherein one end of the primary winding of the transformer is coupled to the primary rectifier unit, another end of the primary winding of the transformer is coupled to the switch controlled by the PWM controller, and the secondary winding of the transformer is coupled to the secondary rectifier unit, wherein the power conversion unit is configured to convert the input alternating current to obtain the output voltage and the output current of the adapter, wherein a primary filtering unit and a secondary filtering unit in the power conversion unit are omitted, such that the output current of the adapter is a current with a first pulsating waveform; a sampling and holding unit, coupled to the power conversion unit, and configured to sample the current with the first pulsating waveform in a sampling state, and to hold a peak value of the current with the first pulsating waveform in a holding state; a current sampling control unit, coupled to the sampling and holding unit, and configured to determine whether the sampling and holding unit is in the holding state, and to sample the peak value of the current with the first pulsating waveform held by the sampling and holding unit when the sampling and holding unit is in the holding state, wherein the current sampling control unit is configured to receive a synchronous signal, and to determine whether the sampling and holding unit is in the holding state based on the synchronous signal, in which a cycle of the synchronous signal is 1/N of a cycle of the first pulsating waveform, N is an integer greater than 1; and a voltage adjusting unit, coupled to the power conversion unit, and configured to detect and adjust the output voltage of the adapter, wherein the current sampling control unit is coupled to the voltage adjusting unit, and configured to adjust the peak value of the current with the first pulsating waveform by the voltage adjusting unit. a power conversion unit comprising an input for inputting alternating current, a primary rectifier unit, a switch controlled by a PWM controller, a transformer (Tl), and a secondary rectifier unit, the transformer coupling current to a secondary side from a primary side, wherein one end of the primary winding of the transformer is coupled to the primary rectifier unit, another end of the primary winding of the transformer is coupled to the switch controlled by the PWM controller, and the secondary winding of the transformer is coupled to the secondary rectifier unit, wherein the power conversion unit is configured to convert the input alternating current to obtain the output voltage and the output current of the adapter, wherein a primary filtering unit and a secondary filtering unit in the power conversion unit are omitted, such that the output current of the adapter is a current with a first pulsating waveform; a sampling and holding unit, coupled to the power conversion unit, and configured to sample the current with the first pulsating waveform in a sampling state, and to hold a peak value of the current with the first pulsating waveform in a holding state; a current sampling control unit, coupled to the sampling and holding unit, and configured to determine whether the sampling and holding unit is in the holding state, and to sample the peak value of the current with the first pulsating waveform held by the sampling and holding unit when the sampling and holding unit is in the holding state, wherein the current sampling control unit is configured to receive a synchronous signal, and to determine whether the sampling and holding unit is in the holding state based on the synchronous signal, in which a cycle of the synchronous signal is 1/N of a cycle of the first pulsating waveform, N is an integer greater than 1; and a voltage adjusting unit, coupled to the power conversion unit, and configured to detect and adjust the output voltage of the adapter, wherein the current sampling control unit is coupled to the voltage adjusting unit, and configured to adjust the peak value of the current with the first pulsating waveform by the voltage adjusting unit.