LPC1768 HAL formatting/comments

This commit is contained in:
Scott Lahteine 2018-02-21 18:43:42 -06:00
parent 424b9a83cd
commit 799e3b2b40
8 changed files with 39 additions and 64 deletions

View file

@ -21,13 +21,12 @@
*/
/**
* Description: HAL for Arduino Due and compatible (SAM3X8E)
*
* For ARDUINO_ARCH_SAM
* HAL_LPC1768/HAL.h
* Hardware Abstraction Layer for NXP LPC1768
*/
#ifndef _HAL_LPC1768_H
#define _HAL_LPC1768_H
#ifndef _HAL_LPC1768_H_
#define _HAL_LPC1768_H_
// --------------------------------------------------------------------------
// Includes
@ -141,4 +140,4 @@ void HAL_adc_enable_channel(int pin);
void HAL_adc_start_conversion(const uint8_t adc_pin);
uint16_t HAL_adc_get_result(void);
#endif // _HAL_LPC1768_H
#endif // _HAL_LPC1768_H_

View file

@ -20,12 +20,8 @@
*
*/
#ifdef TARGET_LPC1768
void u8g_i2c_init(uint8_t options);
uint8_t u8g_i2c_wait(uint8_t mask, uint8_t pos);
uint8_t u8g_i2c_start(uint8_t sla);
uint8_t u8g_i2c_send_byte(uint8_t data);
void u8g_i2c_stop(void);
#endif
void u8g_i2c_init(uint8_t options);
uint8_t u8g_i2c_wait(uint8_t mask, uint8_t pos);
uint8_t u8g_i2c_start(uint8_t sla);
uint8_t u8g_i2c_send_byte(uint8_t data);
void u8g_i2c_stop(void);

View file

@ -29,18 +29,14 @@
* one microsecond delay being about 4uS.
*/
#ifdef __cplusplus
extern "C" {
#endif
void U8g_delay(int msec);
void u8g_MicroDelay(void);
void u8g_10MicroDelay(void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -30,18 +30,7 @@
* resulted in using about about 25% of the CPU's time.
*/
void u8g_SetPinOutput(uint8_t internal_pin_number);
void u8g_SetPinInput(uint8_t internal_pin_number);
void u8g_SetPinLevel(uint8_t pin, uint8_t pin_status);
uint8_t u8g_GetPinLevel(uint8_t pin);

View file

@ -24,35 +24,31 @@
* LPC1768 LCD-specific defines
*/
#ifdef TARGET_LPC1768
// pointers to low level routines - must always supply these
//#define U8G_HAL_LINKS
#define HAL_LCD_pin_routines "HAL_LPC1768/HAL_LCD_pin_routines.h"
#define HAL_LCD_I2C_routines "HAL_LPC1768/HAL_LCD_I2C_routines.h"
#define HAL_LCD_delay "HAL_LPC1768/HAL_LCD_delay.h"
// pointers to low level routines - must always supply these
//#define U8G_HAL_LINKS
#define HAL_LCD_pin_routines "HAL_LPC1768/HAL_LCD_pin_routines.h"
#define HAL_LCD_I2C_routines "HAL_LPC1768/HAL_LCD_I2C_routines.h"
#define HAL_LCD_delay "HAL_LPC1768/HAL_LCD_delay.h"
// The following are optional depending on the platform.
// The following are optional depending on the platform.
// definitions of HAL specific com and device drivers.
uint8_t u8g_com_HAL_LPC1768_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
uint8_t u8g_com_HAL_LPC1768_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
uint8_t u8g_com_HAL_LPC1768_ST7920_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
uint8_t u8g_com_HAL_LPC1768_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
uint8_t u8g_com_HAL_LPC1768_ssd_hw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
// definitions of HAL specific com and device drivers.
uint8_t u8g_com_HAL_LPC1768_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
uint8_t u8g_com_HAL_LPC1768_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
uint8_t u8g_com_HAL_LPC1768_ST7920_hw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
uint8_t u8g_com_HAL_LPC1768_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
uint8_t u8g_com_HAL_LPC1768_ssd_hw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
// connect U8g com generic com names to the desired driver
#define U8G_COM_HW_SPI u8g_com_HAL_LPC1768_hw_spi_fn // use LPC1768 specific hardware SPI routine
#define U8G_COM_SW_SPI u8g_com_HAL_LPC1768_sw_spi_fn // use LPC1768 specific software SPI routine
#define U8G_COM_ST7920_HW_SPI u8g_com_HAL_LPC1768_ST7920_hw_spi_fn
#define U8G_COM_ST7920_SW_SPI u8g_com_HAL_LPC1768_ST7920_sw_spi_fn
#define U8G_COM_SSD_I2C u8g_com_HAL_LPC1768_ssd_hw_i2c_fn
// connect U8g com generic com names to the desired driver
#define U8G_COM_HW_SPI u8g_com_HAL_LPC1768_hw_spi_fn // use LPC1768 specific hardware SPI routine
#define U8G_COM_SW_SPI u8g_com_HAL_LPC1768_sw_spi_fn // use LPC1768 specific software SPI routine
#define U8G_COM_ST7920_HW_SPI u8g_com_HAL_LPC1768_ST7920_hw_spi_fn
#define U8G_COM_ST7920_SW_SPI u8g_com_HAL_LPC1768_ST7920_sw_spi_fn
#define U8G_COM_SSD_I2C u8g_com_HAL_LPC1768_ssd_hw_i2c_fn
// let these default for now
#define U8G_COM_PARALLEL u8g_com_null_fn
#define U8G_COM_T6963 u8g_com_null_fn
#define U8G_COM_FAST_PARALLEL u8g_com_null_fn
#define U8G_COM_UC_I2C u8g_com_null_fn
#endif
// let these default for now
#define U8G_COM_PARALLEL u8g_com_null_fn
#define U8G_COM_T6963 u8g_com_null_fn
#define U8G_COM_FAST_PARALLEL u8g_com_null_fn
#define U8G_COM_UC_I2C u8g_com_null_fn

View file

@ -19,6 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#pragma once
#ifdef TARGET_LPC1768
#include <stdint.h>

View file

@ -116,9 +116,7 @@ int main(void) {
LPC1768_PWM_init();
setup();
while (true) {
loop();
}
for (;;) loop();
}
#endif // TARGET_LPC1768

View file

@ -59,10 +59,10 @@
#ifdef TARGET_LPC1768
// #include <inttypes.h>
//#include <inttypes.h>
// #include "src/core/macros.h"
// #include "Configuration.h"
//#include "src/core/macros.h"
//#include "Configuration.h"
#include <U8glib.h>