Download presentation
Presentation is loading. Please wait.
1
February 26, 2015 Jacob Beningo, CSDP
Baremetal C Programming for Embedded Systems Class 4: Design Patterns for Firmware February 26, 2015 Jacob Beningo, CSDP
2
Course Overview C Concepts for Embedded Systems
Baremetal Scheduling Techniques Driver Design Techniques Design Patterns for Firmware Writing Portable Code
3
Session Overview Defining Design Patterns Circular Buffers
A SPI Driver Example
4
Defining a Design Pattern
Pattern – a model or design used to guide development Common Repetitive Operating System Drivers Buffers Design elements (pushbuttons, leds, etc) Opportunities to reuse Save cost and development time
5
Circular Buffers Definition
A circular buffer is a data structure that uses a single, fixed-size buffer as if it were connected end-to-end. (Wikipedia hehe)
6
Circular Buffer Design
7
Circular Buffer Implementation
8
Driver Design Process Developing drivers will follow a simple process
Develop the structure for the configuration table Create the peripheral channel list Populate the configuration table Define the pointer arrays Define initialization functions Define application functions
9
Serial Peripheral Interface (SPI)
10
Blocking vs. Non-Blocking
MCU Device MCU Device
11
Serial Peripheral Interface (SPI)
Configuration Table Definition Mode Baud Rate Communication etc
12
Serial Peripheral Interface (SPI)
Transfer Configuration Table Definition Phase and Polarity Buffer etc
13
Serial Peripheral Interface (SPI)
Channel Definition Each channel can be given an identifier Used to identify the element in the configuration table
14
Serial Peripheral Interface (SPI)
Configuration Table Setup
15
Serial Peripheral Interface (SPI)
Pointer Arrays Functions
16
Serial Peripheral Interface (SPI)
Spi_Transfer
17
Serial Peripheral Interface (SPI)
Spi_Transfer
18
Serial Peripheral Interface (SPI)
Spi_SetCs
19
Additional Resources Download Course Material for
Updated C Doxygen Templates (Feb 2015) Example drivers source code Microcontroller API Standard EDN Embedded Basics Articles Embedded Bytes Newsletter From under - Blog and Articles > Software Techniques > CEC Baremetal C Programming
20
Jacob Beningo Newsletters P.O. Box 400 Embedded Bytes
Linden, Michigan 48451 Newsletters Embedded Bytes Training MicroPython Bootloaders Low Power Design Real-time Software C/C++ Embedded : : : Jacob_Beningo : Beningo Engineering : JacobBeningo : Embedded Basics Jacob Beningo Principal Consultant 20
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.