I want to create my library for lpc2478 controller using LPC24xx.h file how I can create library

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

I want to create my library for lpc2478 controller using LPC24xx.h file how I can create library

459 次查看
VijayaJangam1
Contributor II

I want to create my library for lpc2478 controller using LPC24xx.h file how I can create library for different Peripherals  like GPIO, ADC, DAC, PWM, UART, SPI, I2C, Interrupt, set different Clocks PLL, Crystal use how can create the  code for My own board library Include my used pins for set their operations and create my own System.h and System.c file and in my main.c program use only that functions give me one roadmap and guidence 

Thank You... 

0 项奖励
回复
1 回复

175 次查看
Harry_Zhang
NXP Employee
NXP Employee

Hi @VijayaJangam1 

The LPC24xx.h file already defines the peripheral registers.
Your library will wrap these registers into functions/macros that are easy to use and board-specific.
You can organize your project like this:
 
/BoardLib
   |-- inc/
   | |-- system.h
   | |-- gpio.h
   | |-- uart.h
   | |-- spi.h
   | |-- i2c.h
   | |-- adc.h
   | |-- pwm.h
   | |-- clock.h
   |
   |-- src/
         |-- system.c
         |-- gpio.c
         |-- uart.c
         |-- spi.c
         |-- i2c.c
         |-- adc.c
         |-- pwm.c
         |-- clock.c

 

And then Compile src/*.c into a static library (libboard.a) using your toolchain.

Link it with your main.c.

BR

Harry