Flintlock mechanism

The flintlock mechanism is a type of lock used on muskets, rifles, and pistols from the early 17th to the mid-19th century. It is commonly referred to as a "flintlock" (without the word "mechanism"), though that term is also commonly used for the weapons themselves as a whole, and not just the lock mechanism.
The flintlock mechanism, also known as the true flintlock, was developed in France in the early 17th century. It quickly replaced earlier technologies, such as the matchlock and wheellock and the earlier flintlocks. It continued to be in common use for over two centuries, until it was finally replaced by the percussion lock.
History.
Flintlock firing mechanisms made their appearance in the 16th century in the form of the snaplock, the snaphance, the miquelet, and the doglock. The so-called "true flintlock" was developed in France in the early 17th century. Though its exact origins are not known, credit for the development of the true flintlock is usually given to Marin le Bourgeoys, an artist, gunsmith, luthier, and inventor from Normandy, France. Marin le Bourgeoys's basic design became the standard for flintlocks, quickly replacing most older firing mechanisms throughout Europe. Flintlock weapons based on this design were used for over two centuries, until gradually superseded by caplock mechanisms in the early 19th century.
The key element apparently added by Marin le Bourgeoys was the vertically acting sear. The sear is a "catch" or "latch" which holds the mechanism in a position ready to fire; the trigger acts upon, or is part of, the sear, releasing it and allowing a strong spring to act on the mechanism to fire the gun. Previously the sear, located within the lock, had acted through a hole in the lockplate to engage the cock on the outside of the plate. The vertically acting sear acted on a piece called the tumbler, on the inside of the lock which was mounted on the same rotating shaft as the cock. This design proved to be the most efficient in terms of cost and reliability.
Construction and operation.
A typical flintlock mechanism has a piece of flint which is held in place in between a set of jaws on the end of a short hammer (sometimes called the "cock" due to its shape resembling a rooster's beak). Before shooting, the hammer is pulled back into a spring-tensioned (or "cocked") position. Pulling the trigger disengages the sear and releases the hammer, which swings forward causing the flint to strike a piece of steel called the "frizzen". At the same time, the motion of the flint and hammer pushes the frizzen back, opening the cover to a concealed flash pan, which contains a small charge of gunpowder. As the flint strikes the frizzen it creates a spark which falls into the pan and ignites the powder. Flame burns through a small touch hole into the gun barrel and ignites the main propellant charge, causing the weapon to fire off the projectile.
Most hammers follow Marin le Bourgeoys's design, and have a "half-cocked" position, which is the "safe" position since pulling the trigger from this position does not cause the gun to fire. From this position, the frizzen can be opened, and powder can be placed in the pan. Then the frizzen is closed, and the hammer is pulled back into the "full cocked" position, from which it is fired.
The phrase "don't go off half cocked" originated with these types of weapons, which were not supposed to fire from the half cocked position of the hammer.
Internal flintlock.
Weapons using internal flintlock are relatively rare. This variant of the lock does not have an external cock. Its function is similar to striker-fired guns. Instead of the striker there is a rod holding the flint. The pan is located on the upper side of the barrel. The pan has a hinged cover with grooves on the underside. The gunsmith Stanislav Patzelta is considered to be the inventor of this system. According to other sources could be this lock invented by the Austrian gunsmith Karl Bischof (Carl Pischoff). 
Flints.
A "gun flint" is a piece of flint that has been shaped, or knapped into a wedge-shape that fits in the jaws of a flintlock. The gun flints were wrapped in a small piece of lead or leather (known as a "flint pad") to hold them firmly in place and were made in different sizes to suit different weapons. Pieces of the mineral agate could be used instead of flint, but this was difficult and expensive to shape and only used by countries such as Prussia that were without access to flint deposits.
The experience of modern flintlock shooters shows that a good quality flint can be used for hundreds of shots, although for reliable shooting it must be sharpened periodically. Despite this, it was the British practice to include a new flint in each box of twenty rounds for the Brown Bess musket. A skilled craftsman could make several thousand gun flints a day so they were individually quite cheap items.
In times of war, millions of gun flints were needed and in the United Kingdom, mining flint and then knapping it became a substantial cottage industry around Brandon, Suffolk, an area that previously saw large scale flint mining in the Neolithic area. In 1804, Brandon was supplying over 400,000 flints a month to the British military. However flint knappers suffered from silicosis, known as "Knappers Rot" due to the inhalation of flint dust. It has been claimed this was responsible for the early death of three-quarters of Brandon gun flint makers.
Brandon gun flints were well regarded as they had a lower rate of misfire than flints from other sources. The industry reached its height during and after the Napoleonic Wars, when Brandon flints were exported worldwide with a near global monopoly. However it declined rapidly as flintlocks were replaced by percussion locks. Although it still supplied 11 million flints a year to the Turkish army during the Crimean War and was exporting flints to Africa as late as the 1960s.
In France, gun flint production between the 17th and 19th centuries centered around the small towns of Meusnes and Couffy. Meusnes has a small museum dedicated to the industry. A slightly different method of manufacture can allow archaeologists to distinguish between British-made and French made flints. 
In North America, imported French and British flints were both widely used, as well as flints from the Netherlands and Nordic countries. In the Eastern United States, Indigenous American people reportedly made their own gun flints by re-working stone spear heads.
Small scale suppliers of gun flints still exist in the 21st century, supplying gun enthusiasts who continue to shoot flintlock firearms.
Gunlocks.
A "gunlock" was a flintlock mechanism that fired a cannon. They were a significant innovation in naval gunnery and were first used by the Royal Navy in 1745. Their use spread slowly as they could not be retrofitted to older guns – the French had still not generally adopted them by the time of the Battle of Trafalgar (1805).
The earlier method of firing a cannon was to apply a linstock – a wooden staff holding a length of smoldering match at the end – to the touch hole of the gun, which was filled with loose priming powder. This was dangerous and made accurate shooting from a moving ship impossible as the gun had to be fired while standing to the side to avoid its recoil, and there was a noticeable delay between the application of the linstock and the gun firing.
The gunlock was operated by pulling a cord, known as a lanyard. The gun-captain could stand behind the gun, safely beyond its range of recoil, and sight along the gun, firing when the roll of the ship lined the gun up with the enemy and so avoid the chance of the shot hitting the sea or flying high over the enemy's deck. Loading the gun was faster and safer as the gunlock didn't use loose priming powder; the main charge was ignited by a quill filled with priming powder that was pushed through the touch hole during loading and pierced the cartridge bag, containing the main charge of gunpowder.
After the introduction of gunlocks, linstocks were retained, but only as a backup means of firing.
Other uses.
Some early land mines, or "fougasses", were detonated by flintlocks. Flintlocks were also used to launch Congreve rockets.
A flintlock tinder lighter, or tinder pistol, was a device that saw use in wealthy households from the 18th Century until the invention of reliable matches. It somewhat resembled a small flintlock pistol, but without a barrel and with a candle holder and with legs so it could be stood upright. When the trigger was pulled, the sparks from the frizzen lit dry tinder in the pan, from which the candle would be quickly lit. The device provided a quick and reliable source of light, and flame for the lighting of fires.
Alarm clocks exist that, as well as sounding a bell, used a flintlock mechanism to light a candle. German and Austrian-made examples of these, dating from the 18th century, are preserved in the collections of the British Museum and the Hermitage Museum in Russia. An example dating from 1550 is in the 
"Germanisches Nationalmuseum" (National Museum of Germanic Culture) in Nuremberg.