From: Nathael Pajani Date: Wed, 16 Sep 2015 10:10:47 +0000 (+0200) Subject: Add comments to the head of each file to introduce the code and help readers to figur... X-Git-Url: http://git.techno-innov.fr/?a=commitdiff_plain;h=45d0e3922f34ae223cfae246f9a9975be980e91f;p=soft%2Flpc122x%2Fcore Add comments to the head of each file to introduce the code and help readers to figure out what's done in each file. --- diff --git a/core/fault_handlers.c b/core/fault_handlers.c index f057ba3..fdade54 100644 --- a/core/fault_handlers.c +++ b/core/fault_handlers.c @@ -22,6 +22,11 @@ * *****************************************************************************/ +/* Default "fault" handlers, which catch the fault exceptions. + * These are defined as weak aliases of a dummy fault handler which enters an empty infinite + * loop and chould be overidden by user defined handlers. + */ + #include "core/lpc_regs_12xx.h" void fault_info(const char* name, uint32_t len) __attribute__ ((weak, alias ("Dummy_Fault_Handler"))); diff --git a/core/pio.c b/core/pio.c index f2fe4a3..81a8bad 100644 --- a/core/pio.c +++ b/core/pio.c @@ -22,7 +22,9 @@ /* GPIOs */ /***************************************************************************** */ -/* Public access to Pins setup */ +/* Public access to Pins setup + * Refer to LPC1224 documentation (UM10441.pdf) for more information. + */ #include diff --git a/core/rom_helpers.c b/core/rom_helpers.c index 263b157..c29d80f 100644 --- a/core/rom_helpers.c +++ b/core/rom_helpers.c @@ -18,6 +18,13 @@ * *************************************************************************** */ +/* ROM helpers are functions avalable for the user which do not use space in the + * internal reprogrammable flash. + * They are stored in the internal ROM memory and may be called using specific + * calls with defined parameters depending on the ROM call used. + * Refer to LPC1224 documentation (UM10441.pdf) for more information. + */ + #include #include "core/system.h" #include "core/lpc_core_cm0.h" diff --git a/core/system.c b/core/system.c index d63fef1..5671d13 100644 --- a/core/system.c +++ b/core/system.c @@ -22,6 +22,11 @@ * *************************************************************************** */ +/* + * This file holds some system wide initialisation functions and clock or sleep + * related functions. + */ + #include #include "core/lpc_regs_12xx.h" diff --git a/core/systick.c b/core/systick.c index 27a8334..e07b4f3 100644 --- a/core/systick.c +++ b/core/systick.c @@ -19,11 +19,14 @@ *************************************************************************** */ - /***************************************************************************** */ /* System Tick Timer */ /***************************************************************************** */ +/* Driver for the internal systick timer of the LPC1224. + * Refer to the LPC1224 documentation (UM10441.pdf) for more information + */ + #include #include "core/lpc_regs_12xx.h" #include "core/lpc_core_cm0.h" diff --git a/drivers/adc.c b/drivers/adc.c index aa8bb79..9b85444 100644 --- a/drivers/adc.c +++ b/drivers/adc.c @@ -24,6 +24,10 @@ /* Analog to Digital Converter (ADC) */ /***************************************************************************** */ +/* ADC driver for the integrated ADC module of the LPC1224. + * Refer to LPC1224 documentation (UM10441.pdf) for more information. + */ + #include #include "core/lpc_regs_12xx.h" #include "core/lpc_core_cm0.h" diff --git a/drivers/gpio.c b/drivers/gpio.c index 3f06c81..be02053 100644 --- a/drivers/gpio.c +++ b/drivers/gpio.c @@ -22,6 +22,9 @@ /* GPIOs and GPIO Interrupts */ /***************************************************************************** */ +/* Driver for GPIO configuration and access (including GPIO interrupts) on the LPC1224. + * Refer to LPC1224 documentation (UM10441.pdf) for more information. + */ #include diff --git a/drivers/i2c.c b/drivers/i2c.c index 9031db4..3be66a4 100644 --- a/drivers/i2c.c +++ b/drivers/i2c.c @@ -25,6 +25,10 @@ /* I2C */ /**************************************************************************** */ +/* I2C driver for the I2C bus integrated module of the LPC1224. + * Refer to LPC1224 documentation (UM10441.pdf) for more information. + */ + #include #include "core/lpc_regs_12xx.h" diff --git a/drivers/rtc.c b/drivers/rtc.c index 80a134e..3e90d10 100644 --- a/drivers/rtc.c +++ b/drivers/rtc.c @@ -1,7 +1,7 @@ /**************************************************************************** * drivers/rtc.c * - * Copyright 2012 Nathael Pajani + * Copyright 2014 Nathael Pajani * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,7 +22,9 @@ /* RTC and RTC Interrupts */ /***************************************************************************** */ - +/* The RTC is an integrated module of the LPC1224. + * Refer to LPC12xx documentation (UM10441.pdf) for more information + */ #include #include "core/lpc_regs_12xx.h" diff --git a/drivers/serial.c b/drivers/serial.c index c6bb107..c7522f6 100644 --- a/drivers/serial.c +++ b/drivers/serial.c @@ -23,6 +23,10 @@ /***************************************************************************** */ /* UARTs */ /***************************************************************************** */ +/* UART driver for the integrated UARTs of the LPC1224. + * Refer to LPC1224 documentation (UM10441.pdf) for more information. + */ + /* Both UARTs are available, UART numbers are in the range 0 - 1 */ #include diff --git a/drivers/ssp.c b/drivers/ssp.c index d209e60..749ba17 100644 --- a/drivers/ssp.c +++ b/drivers/ssp.c @@ -24,6 +24,10 @@ /* SSP */ /***************************************************************************** */ +/* SSP/SPI driver for the SSP bus integrated module of the LPC1224. + * Refer to LPC1224 documentation (UM10441.pdf) for more information. + */ + #include #include "core/lpc_regs_12xx.h" #include "core/lpc_core_cm0.h" diff --git a/drivers/timers.c b/drivers/timers.c index d3d1c98..26c3e56 100644 --- a/drivers/timers.c +++ b/drivers/timers.c @@ -24,6 +24,11 @@ /* Timers */ /***************************************************************************** */ +/* Timers driver for the integrated timers of the LPC1224. + * The LPC1224 Has two 16bits timers and 2 32bits timers. + * Refer to LPC1224 documentation (UM10441.pdf) for more information. + */ + #include #include "core/lpc_regs_12xx.h" #include "core/lpc_core_cm0.h" diff --git a/extdrv/cc1101.c b/extdrv/cc1101.c index 065b5fc..3b30dde 100644 --- a/extdrv/cc1101.c +++ b/extdrv/cc1101.c @@ -28,6 +28,10 @@ #include "drivers/gpio.h" #include "extdrv/cc1101.h" +/* Driver for the CC1101 Sub-1GHz RF transceiver from Texas Instrument. + * Refer to CC1101 documentation for more information (swrs061i.pdf) + */ + /***************************************************************************** */ /* CC1101 */ diff --git a/extdrv/ncn5120.c b/extdrv/ncn5120.c index e3aec83..3be493f 100644 --- a/extdrv/ncn5120.c +++ b/extdrv/ncn5120.c @@ -34,6 +34,13 @@ /* Debug */ #include "lib/stdio.h" + +/* NCN5120 driver + * The NCN5120 chip is a KNX to serial transceiver made by On Semiconductor. + * Refer to the NCN5120 documentation or http://www.onsemi.com/ for more information. + */ + + static struct ncn5120_device ncn5120 = { .serial_num = 1, .current_state = NCN5120_STATE_NORMAL, diff --git a/include/core/iap.h b/include/core/iap.h index c13499c..ca8eff2 100644 --- a/include/core/iap.h +++ b/include/core/iap.h @@ -1,7 +1,7 @@ /**************************************************************************** * core/iap.h * - * + * Copyright 2015 Nathael Pajani * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/include/core/systick.h b/include/core/systick.h index f643414..67e1b62 100644 --- a/include/core/systick.h +++ b/include/core/systick.h @@ -30,6 +30,11 @@ /* System Tick Timer */ /***************************************************************************** */ +/* Driver for the internal systick timer of the LPC1224. + * Refer to the LPC1224 documentation (UM10441.pdf) for more information + */ + + /* Start the system tick timer * Starting the systick timer also resets the internal tick counters. * If you need a value that goes beyond one start/stop cycle and accross resets, diff --git a/include/core/user_information_block.h b/include/core/user_information_block.h index 8732b9c..1f53788 100644 --- a/include/core/user_information_block.h +++ b/include/core/user_information_block.h @@ -21,6 +21,26 @@ * *************************************************************************** */ +/* The user information block is persistant flash memory block which can be programmed + * and read by user code using IAP calls. + * It can provide the same functionnality as an EEPROM, though the reading access is + * much more simple. + * Writting to the user flash is slightly more complicated though, mainly because flash + * pages in the user information block are big 512 bytes blocks, much more than the + * usual small eeprom pages. + * One must erase a full page before modifying data in it, thus reading it first to RAM, + * modifying the RAM area, erasing the page, and then writting back. + * Reading/modify/write may be limited to the required size, but erase size will always + * be a full page. + */ + +/* The user information block of the LPC1224 has three 512 bytes pages. */ + +/* Actually, the only purpose of this code is to return the address of the begining + * of the user information block in flash, set by the linker from information in + * the liker script (lpc_link_lpc1224.ld). +*/ + #ifndef USER_INFORMATION_BLOCK_H #define USER_INFORMATION_BLOCK_H diff --git a/include/drivers/adc.h b/include/drivers/adc.h index 0230f65..6fa8132 100644 --- a/include/drivers/adc.h +++ b/include/drivers/adc.h @@ -28,6 +28,10 @@ /* Analog to Digital Converter (ADC) */ /***************************************************************************** */ +/* ADC driver for the integrated ADC module of the LPC1224. + * Refer to LPC1224 documentation (UM10441.pdf) for more information. + */ + enum adc_events { /* CT32B0 */ ADC_CONV_ON_CT32B0_CAP0_RISING, diff --git a/include/drivers/gpio.h b/include/drivers/gpio.h index c8a88c1..777284d 100644 --- a/include/drivers/gpio.h +++ b/include/drivers/gpio.h @@ -18,6 +18,14 @@ * *************************************************************************** */ +/***************************************************************************** */ +/* GPIOs and GPIO Interrupts */ +/***************************************************************************** */ + +/* Driver for GPIO configuration and access (including GPIO interrupts) on the LPC1224. + * Refer to LPC1224 documentation (UM10441.pdf) for more information. + */ + #ifndef DRIVERS_GPIO_H #define DRIVERS_GPIO_H diff --git a/include/drivers/i2c.h b/include/drivers/i2c.h index de21457..c5f41ad 100644 --- a/include/drivers/i2c.h +++ b/include/drivers/i2c.h @@ -20,6 +20,14 @@ * *************************************************************************** */ +/**************************************************************************** */ +/* I2C */ +/**************************************************************************** */ + +/* I2C driver for the I2C bus integrated module of the LPC1224. + * Refer to LPC1224 documentation (UM10441.pdf) for more information. + */ + #ifndef DRIVERS_I2C_H #define DRIVERS_I2C_H diff --git a/include/drivers/rtc.h b/include/drivers/rtc.h index 0448f01..2af2f32 100644 --- a/include/drivers/rtc.h +++ b/include/drivers/rtc.h @@ -1,7 +1,7 @@ /**************************************************************************** * drivers/rtc.h * - * Copyright 2012 Nathael Pajani + * Copyright 2014 Nathael Pajani * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,6 +22,10 @@ /* RTC and RTC Interrupts */ /***************************************************************************** */ +/* The RTC is an integrated module of the LPC1224. + * Refer to LPC12xx documentation (UM10441.pdf) for more information + */ + #include diff --git a/include/drivers/serial.h b/include/drivers/serial.h index 8fce4f0..7f0bce8 100644 --- a/include/drivers/serial.h +++ b/include/drivers/serial.h @@ -18,6 +18,15 @@ * *************************************************************************** */ +/***************************************************************************** */ +/* UARTs */ +/***************************************************************************** */ +/* UART driver for the integrated UARTs of the LPC1224. + * Refer to LPC1224 documentation (UM10441.pdf) for more information. + */ + +/* Both UARTs are available, UART numbers are in the range 0 - 1 */ + #ifndef DRIVERS_SERIAL_H #define DRIVERS_SERIAL_H diff --git a/include/drivers/ssp.h b/include/drivers/ssp.h index 54ffcaa..fd9516c 100644 --- a/include/drivers/ssp.h +++ b/include/drivers/ssp.h @@ -26,6 +26,10 @@ /* SSP */ /***************************************************************************** */ +/* SSP/SPI driver for the SSP bus integrated module of the LPC1224. + * Refer to LPC1224 documentation (UM10441.pdf) for more information. + */ + #include diff --git a/include/drivers/timers.h b/include/drivers/timers.h index dcb4f08..acac774 100644 --- a/include/drivers/timers.h +++ b/include/drivers/timers.h @@ -26,9 +26,11 @@ /***************************************************************************** */ /* Timers */ /***************************************************************************** */ -/* Four timers are available, Two 16 bits and two 32 bits +/* Timers driver for the integrated timers of the LPC1224. + * Four timers are available, Two 16 bits and two 32 bits * All timers have 4 channels though 32 bits timers have all 4 channels available * on capture /match pins while 16bits ones have only two (channels 0 and 1). + * Refer to LPC1224 documentation (UM10441.pdf) for more information. */ #define NUM_TIMERS 4 #define NUM_CHANS 4 diff --git a/include/extdrv/cc1101.h b/include/extdrv/cc1101.h index 5549fe7..6527903 100644 --- a/include/extdrv/cc1101.h +++ b/include/extdrv/cc1101.h @@ -1,6 +1,17 @@ -/** +/**************************************************************************** + * extdrv/cc1101.h + * + * CC1101 Low-Power Sub-1 GHz RF Transceiver. + * + * Copyright 2013 Nathael Pajani + */ + + +/* * @author Athanassios Mavrogeorgiadis - * @author TI CC1101 library developed by Athanassios Mavrogeorgiadis (tmav Electronics) as template based on TI C8051 SOURCE CODE swrc021f + * @author TI CC1101 library developed by Athanassios Mavrogeorgiadis (tmav Electronics) + * as template based on TI C8051 SOURCE CODE swrc021f + * * @section LICENSE * * Copyright (c) 2010 ARM Limited diff --git a/include/extdrv/lcd_char.h b/include/extdrv/lcd_char.h index a6fba1a..b8d9096 100644 --- a/include/extdrv/lcd_char.h +++ b/include/extdrv/lcd_char.h @@ -20,6 +20,16 @@ * *************************************************************************** */ +/* This file holds the interface to the code used to handle LCD character displays that are + * compatible with the Hitachi HD44780 driver. + * There are many of them out there, and you can usually tell them by the 16-pin interface. + * + * Driver inspired by Arduino LiquidCrystal library code submited by + * David A. Mellis, Limor Fried (http://www.ladyada.net) and Tom Igoe. + * + * Refer to HD44780U documentation from Hitachi for more information. + */ + #ifndef EXTDRV_LCD_CHAR_H #define EXTDRV_LCD_CHAR_H diff --git a/include/extdrv/ncn5120.h b/include/extdrv/ncn5120.h index cf08e7e..e8633c1 100644 --- a/include/extdrv/ncn5120.h +++ b/include/extdrv/ncn5120.h @@ -18,6 +18,10 @@ * *************************************************************************** */ +/* NCN5120 driver + * The NCN5120 chip is a KNX to serial transceiver made by On Semiconductor. + * Refer to the NCN5120 documentation or http://www.onsemi.com/ for more information. + */ #ifndef EXTDRV_NCN5120_H #define EXTDRV_NCN5120_H diff --git a/include/extdrv/status_led.h b/include/extdrv/status_led.h index c766467..1ff64ce 100644 --- a/include/extdrv/status_led.h +++ b/include/extdrv/status_led.h @@ -28,6 +28,9 @@ /***************************************************************************** */ /* Status LED */ +/* The status led is a bicolor led found on all Techno-Innov modules. + * It could be any two leds found on your module if you are not using one of Techno-Innov's modules. + */ /* Configure the status led, giving the red and green pio structure */ void status_led_config(const struct pio* green, const struct pio* red);