A series of blog posts about working with 32 bit ARM microcontrollers
See Part 1 "Surveying the Territory"
and Part 2 "Establishing Base Camp"
Whilst you are waiting for Part 3 - here's some nice bedtime reading
The STM32F ARM M4F Peripherals Explained - in 320 easy slides
In Part 2, I explained how in a typical STM32 device there might be as many as 30 on chip peripherals that require configuring before they can be used. I also stated that for convenience - and to improve code clarity, that the peripheral configuration functions were grouped together in a module which I call periph_config.c.
In this post, I will try to illustrate how a series of re-usable functions, can be utilised to create a simple working environment for code development.
This idea has been heavily borrowed from Arduino Wiring - in an attempt to create a simpler coding environment, where perhaps STM32 Arduino or mbed is not available.
These functions should provide the following:
1. Basic Input and Output using GPIO
2. PWM
3. Analogue to Digital Conversion
4. Digital to Analogue Conversion
5. Millisecond timing, uS and mS delays
6. Serial Input and Output
7. A simple serial command interpreter framework
8. Triggering of events using external interrupts.
1. Basic GPIO
digitalRead(pin)
digitalWrite(pin)
2. PWM
3. 12 bit ADC
Read_ADC_12()
4. DACs
analogWrite(channel, value)
5. Millisecond Timing
delaymS()
delayuS()
6. Serial Input and Output
putchar
print_num
No comments:
Post a Comment