1#ifndef Bsp_grand_central_m4_Api_h_
2#define Bsp_grand_central_m4_Api_h_
29#include "colony_config.h"
32#include "HardwareSerial.h"
61#define HARDSER_PARITY_EVEN (0x1ul)
62#define HARDSER_PARITY_ODD (0x2ul)
63#define HARDSER_PARITY_NONE (0x3ul)
64#define HARDSER_PARITY_MASK (0xFul)
66#define HARDSER_STOP_BIT_1 (0x10ul)
67#define HARDSER_STOP_BIT_1_5 (0x20ul)
68#define HARDSER_STOP_BIT_2 (0x30ul)
69#define HARDSER_STOP_BIT_MASK (0xF0ul)
71#define HARDSER_DATA_5 (0x100ul)
72#define HARDSER_DATA_6 (0x200ul)
73#define HARDSER_DATA_7 (0x300ul)
74#define HARDSER_DATA_8 (0x400ul)
75#define HARDSER_DATA_MASK (0xF00ul)
77#define SERIAL_5N1 (HARDSER_STOP_BIT_1 | HARDSER_PARITY_NONE | HARDSER_DATA_5)
78#define SERIAL_6N1 (HARDSER_STOP_BIT_1 | HARDSER_PARITY_NONE | HARDSER_DATA_6)
79#define SERIAL_7N1 (HARDSER_STOP_BIT_1 | HARDSER_PARITY_NONE | HARDSER_DATA_7)
80#define SERIAL_8N1 (HARDSER_STOP_BIT_1 | HARDSER_PARITY_NONE | HARDSER_DATA_8)
81#define SERIAL_5N2 (HARDSER_STOP_BIT_2 | HARDSER_PARITY_NONE | HARDSER_DATA_5)
82#define SERIAL_6N2 (HARDSER_STOP_BIT_2 | HARDSER_PARITY_NONE | HARDSER_DATA_6)
83#define SERIAL_7N2 (HARDSER_STOP_BIT_2 | HARDSER_PARITY_NONE | HARDSER_DATA_7)
84#define SERIAL_8N2 (HARDSER_STOP_BIT_2 | HARDSER_PARITY_NONE | HARDSER_DATA_8)
85#define SERIAL_5E1 (HARDSER_STOP_BIT_1 | HARDSER_PARITY_EVEN | HARDSER_DATA_5)
86#define SERIAL_6E1 (HARDSER_STOP_BIT_1 | HARDSER_PARITY_EVEN | HARDSER_DATA_6)
87#define SERIAL_7E1 (HARDSER_STOP_BIT_1 | HARDSER_PARITY_EVEN | HARDSER_DATA_7)
88#define SERIAL_8E1 (HARDSER_STOP_BIT_1 | HARDSER_PARITY_EVEN | HARDSER_DATA_8)
89#define SERIAL_5E2 (HARDSER_STOP_BIT_2 | HARDSER_PARITY_EVEN | HARDSER_DATA_5)
90#define SERIAL_6E2 (HARDSER_STOP_BIT_2 | HARDSER_PARITY_EVEN | HARDSER_DATA_6)
91#define SERIAL_7E2 (HARDSER_STOP_BIT_2 | HARDSER_PARITY_EVEN | HARDSER_DATA_7)
92#define SERIAL_8E2 (HARDSER_STOP_BIT_2 | HARDSER_PARITY_EVEN | HARDSER_DATA_8)
93#define SERIAL_5O1 (HARDSER_STOP_BIT_1 | HARDSER_PARITY_ODD | HARDSER_DATA_5)
94#define SERIAL_6O1 (HARDSER_STOP_BIT_1 | HARDSER_PARITY_ODD | HARDSER_DATA_6)
95#define SERIAL_7O1 (HARDSER_STOP_BIT_1 | HARDSER_PARITY_ODD | HARDSER_DATA_7)
96#define SERIAL_8O1 (HARDSER_STOP_BIT_1 | HARDSER_PARITY_ODD | HARDSER_DATA_8)
97#define SERIAL_5O2 (HARDSER_STOP_BIT_2 | HARDSER_PARITY_ODD | HARDSER_DATA_5)
98#define SERIAL_6O2 (HARDSER_STOP_BIT_2 | HARDSER_PARITY_ODD | HARDSER_DATA_6)
99#define SERIAL_7O2 (HARDSER_STOP_BIT_2 | HARDSER_PARITY_ODD | HARDSER_DATA_7)
100#define SERIAL_8O2 (HARDSER_STOP_BIT_2 | HARDSER_PARITY_ODD | HARDSER_DATA_8)
107#define PIN_ONBOARD_IDT PIN_A0
110#define PIN_BUTTON_A 12
113#define PIN_BUTTON_B 11
116#define PIN_BUTTON_X 10
119#define PIN_BUTTON_Y 9
122#define PIN_HW_SAFETY 8
125#define PIN_RESET_LCD 7
131#define PIN_PWM_LED_RED 5
134#define PIN_PWM_LED_GREEN 4
137#define PIN_PWM_LED_BLUE 3
140#define PIN_PWM_LCD_BACKLIGHT 2
146#define PIN_PWM_HEATER 18
149#define PIN_PWM_FAN 19
152#define PIN_LCD_SPI_CLK PIN_SPI_SCK
155#define PIN_LCD_SPI_MOSI PIN_SPI_MOSI
158#define PIN_LCD_SPI_MISO PIN_SPI_MISO
161#define LCD_SPI_DRIVER SPI
165#define PIN_I2C_BUS_SCK PIN_WIRE_SCL
168#define PIN_I2C_BUS_SDA PIN_WIRE_SDA
171#define I2C_BUS_DRIVER Wire
174#define BSP_I2C_ADDRESS_EEPROM 0x50
182#define Bsp_NVIC_disableIRQ( irqNum ) do { NVIC_DisableIRQ(irqNum); __DSB(); __ISB(); } while(0)
185#define Bsp_NVIC_enableIRQ( irqNum ) do { NVIC_EnableIRQ(irqNum); __DSB(); __ISB(); } while(0)
188#define Bsp_Api_reset_MCU() NVIC_SystemReset()
195#define Bsp_Api_nop_MAP() __asm("nop")
198#define Bsp_Api_disableIrqs_MAP() taskENTER_CRITICAL()
201#define Bsp_Api_enableIrqs_MAP() taskEXIT_CRITICAL()
204#define Bsp_Api_pushAndDisableIrqs_MAP() taskENTER_CRITICAL()
207#define Bsp_Api_popIrqs_MAP() taskEXIT_CRITICAL()
213#ifndef OPTION_BSP_DEBUG_LED1_INDEX
214#define OPTION_BSP_DEBUG_LED1_INDEX PIN_LED
218#ifndef OPTION_BSP_DEBUG_LED2_INDEX
219#define OPTION_BSP_DEBUG_LED2_INDEX DEBUG_LED_IS_NOT_SUPPORTED
224#define Bsp_Api_turnOn_debug1_MAP() digitalWrite( OPTION_BSP_DEBUG_LED1_INDEX, HIGH )
227#define Bsp_Api_turnOff_debug1_MAP() digitalWrite( OPTION_BSP_DEBUG_LED1_INDEX, LOW )
230#define Bsp_Api_toggle_debug1_MAP() digitalWrite( OPTION_BSP_DEBUG_LED1_INDEX, !digitalRead(OPTION_BSP_DEBUG_LED1_INDEX) )
234#define Bsp_Api_turnOn_debug2_MAP() digitalWrite( OPTION_BSP_DEBUG_LED2_INDEX, HIGH )
237#define Bsp_Api_turnOff_debug2_MAP() digitalWrite( OPTION_BSP_DEBUG_LED2_INDEX, LOW )
240#define Bsp_Api_toggle_debug2_MAP() digitalWrite( OPTION_BSP_DEBUG_LED2_INDEX, !digitalRead(OPTION_BSP_DEBUG_LED2_INDEX) )
void Bsp_beginArduinoSerialObject(unsigned long baudrate, uint16_t frameConfig)
Board Specific APIs.
void Bsp_beginFileSystem()
This method initializes and start the SdFat file system on the onboard 8MB data flash.