📄 lib_22eb06_mc.h
字号:
/*
***********************************************************************
Embest Info&Tech Co., Ltd. All rights reserved.
www.embedinfo.com
***********************************************************************
---------------- file information -------------------------------------
file name: 22eb06_lib_modulecontrol.h
version : v0
author : peter pan / panqan@hotmail.com
panqian@embedinfo.com
begin : 2006-02-10
finish : 2006-02-10
define : lpc22eb06 module control to enable or disable the module
notes :
---------------- modify information -----------------------------------
version :
modify :
begin :
finish :
define :
-----------------------------------------------------------------------
*/
/*
this lib need gcc mathematics lib support!!!!!!!!!!!!!!!!!!!!!!!!!!!
project setting>>linker>>category>>
include object and library modules:
-lc
-lm
-lgcc
add library searching path:
build\xgcc-arm-elf\arm-elf\lib\arm-inter
build\xgcc-arm-elf\lib\gcc-lib\arm-elf\3.0.2\arm-inter
*/
// (--------------------- compiler condition --------------------------
#ifndef h22eb06_lib_modulecontrol_h
#define h22eb06_lib_modulecontrol_h
// --------------------- compiler condition --------------------------)
/*-------------------------------------------------------------------*/
/* include files */
/*---------------------------------------------------------------- --*/
#include "..\..\..\com\type_redefine.h"
#include "..\..\..\com\register_lpc22xx.h"
#include "..\..\..\com\lib_lpc\lib_lpc_spi\lib_lpc_spi.h"
/*-------------------------------------------------------------------*/
/* variable define */
/*-------------------------------------------------------------------*/
// 88 control
//(--------------------------------------------------------------------
// P2 to 88_latch
// 88latch p2.19
// 88en p2.18
#define P2__16_31__GPIO_PINSEL2_VALUE (0x01<<4)
#define P2__16_31__GPIO_PINSEL2_MASK (0x03<<4)
// GPIO2.18 to 88 en
#define GPIO2_18__88EN_IOXXX_VALUE (0x01<<18)
#define GPIO2_18__88EN_IOXXX_MASK (0x01<<18)
// IOXXX-->IOSET/IODIR/CLR....
// GPIO2.19 to 88 latch
#define GPIO2_19__88latch_IOXXX_VALUE (0x01<<19)
#define GPIO2_19__88latch_IOXXX_MASK (0x01<<19)
// 88 data define
#define D88_A (0x1) //
#define D88_B (0x1<<1) //
#define D88_C (0x1<<2) //
#define D88_D (0x1<<3) //
#define D88_E (0x1<<4) //
#define D88_F (0x1<<5) //
#define D88_G (0x1<<6) //
#define D88_DP (0x1<<7) //
// assembled to digital data
#define D88_0 (D88_A+D88_B+D88_C+D88_D+D88_E+D88_F)
#define D88_1 (D88_B+D88_C)
#define D88_2 (D88_A+D88_B+D88_G+D88_E+D88_D)
#define D88_3 (D88_A+D88_B+D88_G+D88_C+D88_D)
#define D88_4 (D88_B+D88_G+D88_F+D88_C)
#define D88_5 (D88_A+D88_F+D88_G+D88_C+D88_D)
#define D88_6 (D88_A+D88_F+D88_G+D88_C+D88_D+D88_E)
#define D88_7 (D88_A+D88_B+D88_C)
#define D88_8 (D88_A+D88_B+D88_C+D88_D+D88_E+D88_F+D88_G)
#define D88_9 (D88_A+D88_B+D88_C+D88_D+D88_F+D88_G)
typedef enum {
display88_latchen=0,
display88_latchdis,
display88_outen,
display88_outdis,
} display88_control;
//--------------------------------------------------------------------)
// SPI extend module control
//(--------------------------------------------------------------------
// GPIO2.16 to spi extend latch
#define GPIO2_16__ext_latch_IOxxx_V (0x01<<16)
#define GPIO2_16__ext_latch_IOxxx_M (0x01<<16)
// GPIO2.17 to spi extend out en
#define GPIO2_17__ext_out_IOxxx_V (0x01<<17)
#define GPIO2_17__ext_out_IOxxx_M (0x01<<17)
// extend module control mask define
// first 8 bit
#define module_c_MOTOR_MASK (0x1<<1) //
#define module_c_MMC_SD_MASK (0x1<<2) //
#define module_c_U0_MASK_1 (0x1<<3) //
#define module_c_U0_MASK_2 (0x1<<4) //
#define module_c_U1_MASK (0x1<<5) //
#define module_c_RS485_MASK1 (0x1<<6) //
#define module_c_RS485_MASK2 (0x1<<7) //
// next 8 bit
#define module_c_AUDIO_MASK (0x1) //
#define module_c_PS2_MASK (0x1<<1) //
#define module_c_SSEL1_C_MASK (0x1<<2) //
#define module_c_LCM_EN_MASK (0x1<<3) //
#define module_c_USB_RESET_MASK (0x1<<4) //
#define module_c_LCM_RESET_MASK (0x1<<5) //
#define module_c_CF_RESET_MASK (0x1<<6) //
#define module_c_CF_EN_MASK (0x1<<7) //
// extend module control value define enable
#define module_c_MOTOR_EN0 (0x0<<1) //
#define module_c_MMC_SD_EN0 (0x0<<2) //
#define module_c_U0_EN1_EN1 (0x1<<3) //
#define module_c_U0_EN2_EN0 (0x0<<4) //
#define module_c_U1_EN1 (0x1<<5) //
#define module_c_RS485_EN1_EN0 (0x0<<6) //
#define module_c_RS485_EN2_EN1 (0x1<<7) //
// next 8 bit
#define module_c_AUDIO_EN0 (0x0) //
#define module_c_PS2_EN0 (0x0<<1) //
#define module_c_SSEL1_C_EN1 (0x1<<2) //
#define module_c_LCM_EN0 (0x0<<3) //
#define module_c_USB_RESET_EN0 (0x0<<4) //
#define module_c_LCM_RESET_EN0 (0x0<<5) //
#define module_c_CF_RESET_EN0 (0x0<<6) //
#define module_c_CF_EN0 (0x0<<7) //
// extend module control value define disable
#define module_c_MOTOR_DIS (0x1<<1) //
#define module_c_MMC_SD_DIS (0x1<<2) //
#define module_c_U0_EN1_DIS (0x0<<3) //
#define module_c_U0_EN2_DIS (0x1<<4) //
#define module_c_U1_DIS (0x0<<5) //
#define module_c_RS485_EN1_DIS (0x1<<6) //
#define module_c_RS485_EN2_DIS (0x0<<7) //
// next 8 bit
#define module_c_AUDIO_DIS (0x1) //
#define module_c_PS2_DIS (0x1<<1) //
#define module_c_SSEL1_C_DIS (0x0<<2) //
#define module_c_LCM_DIS (0x1<<3) //
#define module_c_USB_RESET_DIS (0x1<<4) //
#define module_c_LCM_RESET_DIS (0x1<<5) //
#define module_c_CF_RESET_DIS (0x1<<6) //
#define module_c_CF_DIS (0x1<<7) //
#define module_c_all_module_off_BL (module_c_MOTOR_DIS + module_c_MMC_SD_DIS\
+module_c_U0_EN1_DIS + module_c_U0_EN2_DIS + module_c_U1_DIS\
+module_c_RS485_EN1_DIS + module_c_RS485_EN2_DIS)
#define module_c_all_module_off_BH (module_c_AUDIO_DIS + module_c_PS2_DIS + module_c_SSEL1_C_DIS\
+module_c_LCM_DIS + module_c_USB_RESET_DIS + module_c_LCM_RESET_DIS\
+module_c_CF_RESET_DIS + module_c_CF_DIS )
#define module_c_all_module_off (module_c_all_module_off_BL + (module_c_all_module_off_BH<<8))
typedef enum {
module_c_MOTOR_EN=0,
module_c_MMC_SD_EN,
module_c_U0_EN,
module_c_U1_EN,
module_c_RS485_EN,
// next 8 bit
module_c_AUDIO_EN,
module_c_PS2_EN,
module_c_SSEL1_C_EN,
module_c_LCM_EN,
module_c_USB_RESET_EN,
module_c_LCM_RESET_EN,
module_c_CF_RESET_EN,
module_c_CF_EN,
} module_c_device;
typedef enum {
ext_device_on=0,
ext_device_off,
ext_device_all_latchen,
ext_device_all_latchdis,
ext_device_all_outen,
ext_device_all_outdis,
} ext_device_control;
/*
typedef enum {
XXX,
} XXX;
*/
//extern
//INT32U g_spi_extend_data;
extern INT32U g_spi_extend_data;
//--------------------------------------------------------------------)
//dc motor
#define P0_14__GPIO_PINSEL0_MASK (0x3<<28)
#define P0_15__GPIO_PINSEL0_MASK (0x3<<30)
#define P0_14__GPIO_PINSEL0_VALUE (0x0<<28)
#define P0_15__GPIO_PINSEL0_VALUE (0x0<<30)
#define P0_0__PWM1_PINSEL0_MASK (0x3<<1)
#define P0_1__PWM3_PINSEL0_MASK (0x3<<2)
#define P0_0__PWM1_PINSEL0_VALUE (0x2<<1)
#define P0_1__PWM3_PINSEL0_VALUE (0x2<<2)
#define motor_control_PINSEL0_MASK (P0_14__GPIO_PINSEL0_MASK+P0_15__GPIO_PINSEL0_MASK\
+P0_0__PWM1_PINSEL0_MASK+P0_1__PWM3_PINSEL0_MASK)
#define motor_control_PINSEL0_VALUE (P0_14__GPIO_PINSEL0_VALUE+P0_15__GPIO_PINSEL0_VALUE\
+P0_0__PWM1_PINSEL0_VALUE+P0_1__PWM3_PINSEL0_VALUE)
typedef enum {
deasil=0,
contrarotate,
} dc_motor_direction;
typedef enum {
on=0,
off,
} on_off_value;
// pwm used para
#define PWM_PR_DATA 50
/*-------------------------------------------------------------------*/
/* local function declare */
/*-------------------------------------------------------------------*/
// 88 control
//(--------------------------------------------------------------------
INT32U display88_latch(display88_control LATCH_ENDIS);
INT32U display88_outputen(display88_control OUTPUTENDIS);
INT32U display88(INT32U display_88_data, INT32U display_cycle);
//--------------------------------------------------------------------)
// SPI extend module control
//(--------------------------------------------------------------------
INT32U spi_extend_latch(ext_device_control latch_endis);
INT32U spi_extend_outputen(ext_device_control outendis);
void spi_extend_set(ext_device_control extend_io_onoff, module_c_device device_name);
void spi_extend_alloff(void);
//--------------------------------------------------------------------)
INT32U dc_motor(dc_motor_direction direction, INT32U dc_motor_speed);
INT32U dc_motor_onoff(on_off_value onoff);
/*-------------------------------------------------------------------*/
/* extern function declare */
/*-------------------------------------------------------------------*/
/*--- define in XXX.c ---
extern void XXX();
*/
/*-------------------------------------------------------------------*/
/* extern variable declare */
/*-------------------------------------------------------------------*/
/*--- USED in XXX() ---
XXX SSS; // used inXXX()
*/
/*-------------------------------------------------------------------*/
/* function code */
/*-------------------------------------------------------------------*/
/**********************************************************************
* name : xxxxx
* func : xxxxx
* para : xxxx
* ret : xxxx
* glob : xxxx
* inc :
* author:
* date :
* modify:
* comment:
**********************************************************************/
/*void xxx(xxx xxx)
{
}
*/
#endif //h22eb06_lib_modulecontrol_h
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -