105 lines
3.0 KiB
C
105 lines
3.0 KiB
C
/*
|
|
* File: DigitalIO_Pinguino.h
|
|
* Author: JF
|
|
*
|
|
* Created on November 24, 2018, 3:20 PM
|
|
*/
|
|
|
|
#ifndef DIGITALIO_PINGUINO_H
|
|
#define DIGITALIO_PINGUINO_H
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
|
|
/* ************************************************************************** */
|
|
/* Includes */
|
|
#include "define.h"
|
|
/* ************************************************************************** */
|
|
/* Defines */
|
|
|
|
#define SYS_FREQ (80000000L) //Clock period = 12.5 ns
|
|
#define PERIPHERAL_FREQ (80000000L)
|
|
|
|
|
|
|
|
//Output pins hardware definitions
|
|
//
|
|
// #define HEARTBEAT_LED_2_PIN_DIR TRISGbits.TRISG6
|
|
// #define HEARTBEAT_LED_2_PIN LATGbits.LATG6
|
|
// #define HEARTBEAT_LED_2_TOGGLE_REG LATGINV
|
|
// #define HEARTBEAT_LED_2_SET_REG LATGSET
|
|
// #define HEARTBEAT_LED_2_CLEAR_REG LATGCLR
|
|
// #define HEARTBEAT_LED_2_TOGGLE_MASK _LATG_LATG6_MASK
|
|
|
|
#define HEARTBEAT_LED_1_PIN_DIR TRISDbits.TRISD1
|
|
#define HEARTBEAT_LED_1_PIN LATDbits.LATD1
|
|
#define HEARTBEAT_LED_1_TOGGLE_REG LATDINV
|
|
#define HEARTBEAT_LED_1_SET_REG LATDSET
|
|
#define HEARTBEAT_LED_1_CLEAR_REG LATDCLR
|
|
#define HEARTBEAT_LED_1_TOGGLE_MASK _LATD_LATD1_MASK
|
|
|
|
|
|
// #define SD_CARD_DETECT_PIN_DIR TRISDbits.TRISD8
|
|
// #define SD_CARD_DETECT_PIN LATDbits.LATD8
|
|
|
|
//SPI port defs
|
|
#define SPI_SDO_PIN_DIR TRISGbits.TRISG8
|
|
#define SPI_SDI_PIN_DIR TRISGbits.TRISG7
|
|
#define SPI_SCK_PIN_DIR TRISGbits.TRISG6
|
|
|
|
//SD Card
|
|
#define SD_SPI_SS_PIN_DIR TRISBbits.TRISB13
|
|
#define SD_SPI_SS_PIN LATBbits.LATB13
|
|
|
|
//Wifi (WINC3400 module)
|
|
#define WIFI_SPI_SS_PIN_DIR TRISFbits.TRISF1
|
|
#define WIFI_SPI_SS_PIN LATFbits.LATF1
|
|
#define WIFI_IRQ_PIN_DIR TRISDbits.TRISD0
|
|
#define WIFI_IRQ_PIN PORTDbits.RD0
|
|
#define WIFI_WAKE_PIN_DIR TRISEbits.TRISE0
|
|
#define WIFI_WAKE_PIN LATEbits.LATE0
|
|
#define WIFI_SPI_CFG_PIN_DIR TRISEbits.TRISE1
|
|
#define WIFI_SPI_CFG_PIN LATEbits.LATE1
|
|
#define WIFI_CHP_EN_PIN_DIR TRISEbits.TRISE2
|
|
#define WIFI_CHP_EN_PIN LATEbits.LATE2
|
|
#define WIFI_CHP_RST_PIN_DIR TRISEbits.TRISE3
|
|
#define WIFI_CHP_RST_PIN LATEbits.LATE3
|
|
|
|
//Control knob encoder
|
|
#define KNOB_PH_A_PIN_DIR TRISDbits.TRISD8
|
|
#define KNOB_PH_A_PIN PORTDbits.RD8
|
|
#define KNOB_PH_B_PIN_DIR TRISDbits.TRISD7
|
|
#define KNOB_PH_B_PIN PORTDbits.RD7
|
|
#define KNOB_TGLE_BTN_PIN_DIR TRISDbits.TRISD11
|
|
#define KNOB_TGLE_BTN_PIN PORTDbits.RD11
|
|
|
|
//Led controller PWM
|
|
#define LED_PWM_PIN_DIR TRISDbits.TRISD2
|
|
#define LED_PWM_PIN LATDbits.LATD2
|
|
#define LED_PWM_VAL_REG OC3RS
|
|
|
|
|
|
//Misc CPU or board related defines
|
|
#define PWM_RANGE_MAX 16000
|
|
|
|
#define GP_DEBUG_1_PIN_DIR TRISEbits.TRISE5
|
|
#define GP_DEBUG_1_PIN LATEbits.LATE5
|
|
#define GP_DEBUG_2_PIN_DIR TRISEbits.TRISE6
|
|
#define GP_DEBUG_2_PIN LATEbits.LATE6
|
|
|
|
|
|
|
|
/* ************************************************************************** */
|
|
/* Prototypes */
|
|
void InitDigitalIO(void);
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* DIGITALIO_PINGUINO_H */
|
|
|