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) * HAL_LPC1768/HAL.h
* * Hardware Abstraction Layer for NXP LPC1768
* For ARDUINO_ARCH_SAM
*/ */
#ifndef _HAL_LPC1768_H #ifndef _HAL_LPC1768_H_
#define _HAL_LPC1768_H #define _HAL_LPC1768_H_
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// Includes // Includes
@ -141,4 +140,4 @@ void HAL_adc_enable_channel(int pin);
void HAL_adc_start_conversion(const uint8_t adc_pin); void HAL_adc_start_conversion(const uint8_t adc_pin);
uint16_t HAL_adc_get_result(void); 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);
void u8g_i2c_init(uint8_t options); uint8_t u8g_i2c_start(uint8_t sla);
uint8_t u8g_i2c_wait(uint8_t mask, uint8_t pos); uint8_t u8g_i2c_send_byte(uint8_t data);
uint8_t u8g_i2c_start(uint8_t sla); void u8g_i2c_stop(void);
uint8_t u8g_i2c_send_byte(uint8_t data);
void u8g_i2c_stop(void);
#endif

View File

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

View File

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

View File

@ -24,35 +24,31 @@
* LPC1768 LCD-specific defines * 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 // The following are optional depending on the platform.
//#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. // 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);
// definitions of HAL specific com and device drivers. 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_hw_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_sw_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_ST7920_hw_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);
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 // 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_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_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_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_ST7920_SW_SPI u8g_com_HAL_LPC1768_ST7920_sw_spi_fn
#define U8G_COM_SSD_I2C u8g_com_HAL_LPC1768_ssd_hw_i2c_fn #define U8G_COM_SSD_I2C u8g_com_HAL_LPC1768_ssd_hw_i2c_fn
// let these default for now // let these default for now
#define U8G_COM_PARALLEL u8g_com_null_fn #define U8G_COM_PARALLEL u8g_com_null_fn
#define U8G_COM_T6963 u8g_com_null_fn #define U8G_COM_T6963 u8g_com_null_fn
#define U8G_COM_FAST_PARALLEL u8g_com_null_fn #define U8G_COM_FAST_PARALLEL u8g_com_null_fn
#define U8G_COM_UC_I2C u8g_com_null_fn #define U8G_COM_UC_I2C u8g_com_null_fn
#endif

View File

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

View File

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

View File

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