GM6000 Digital Heater Controller Branch: main
SDX-1330
Macros | Functions
Api.h File Reference

Detailed Description

This BSP is developed/build with a 'just-in-time' approach.

This means as functional is added to the BSP incrementally as there is 'client' need for. This BSP does not claim to provide full/complete functional and/or APIs for everything the board supports.

DO NOT include this file directly! Instead include the generic BSP interface - src/Bsp/Api.h - and then configure your project's 'colony_map.h' to include THIS file.


#include "colony_config.h"
#include "FreeRTOS.h"
#include "USBAPI.h"
#include "HardwareSerial.h"
#include "variant.h"
Include dependency graph for Api.h:

Go to the source code of this file.

Macros

#define HARDSER_PARITY_EVEN   (0x1ul)
 Returns a reference to the Primary Serial Port Object.
 
#define HARDSER_PARITY_ODD   (0x2ul)
 
#define HARDSER_PARITY_NONE   (0x3ul)
 
#define HARDSER_PARITY_MASK   (0xFul)
 
#define HARDSER_STOP_BIT_1   (0x10ul)
 
#define HARDSER_STOP_BIT_1_5   (0x20ul)
 
#define HARDSER_STOP_BIT_2   (0x30ul)
 
#define HARDSER_STOP_BIT_MASK   (0xF0ul)
 
#define HARDSER_DATA_5   (0x100ul)
 
#define HARDSER_DATA_6   (0x200ul)
 
#define HARDSER_DATA_7   (0x300ul)
 
#define HARDSER_DATA_8   (0x400ul)
 
#define HARDSER_DATA_MASK   (0xF00ul)
 
#define SERIAL_5N1   (HARDSER_STOP_BIT_1 | HARDSER_PARITY_NONE | HARDSER_DATA_5)
 
#define SERIAL_6N1   (HARDSER_STOP_BIT_1 | HARDSER_PARITY_NONE | HARDSER_DATA_6)
 
#define SERIAL_7N1   (HARDSER_STOP_BIT_1 | HARDSER_PARITY_NONE | HARDSER_DATA_7)
 
#define SERIAL_8N1   (HARDSER_STOP_BIT_1 | HARDSER_PARITY_NONE | HARDSER_DATA_8)
 
#define SERIAL_5N2   (HARDSER_STOP_BIT_2 | HARDSER_PARITY_NONE | HARDSER_DATA_5)
 
#define SERIAL_6N2   (HARDSER_STOP_BIT_2 | HARDSER_PARITY_NONE | HARDSER_DATA_6)
 
#define SERIAL_7N2   (HARDSER_STOP_BIT_2 | HARDSER_PARITY_NONE | HARDSER_DATA_7)
 
#define SERIAL_8N2   (HARDSER_STOP_BIT_2 | HARDSER_PARITY_NONE | HARDSER_DATA_8)
 
#define SERIAL_5E1   (HARDSER_STOP_BIT_1 | HARDSER_PARITY_EVEN | HARDSER_DATA_5)
 
#define SERIAL_6E1   (HARDSER_STOP_BIT_1 | HARDSER_PARITY_EVEN | HARDSER_DATA_6)
 
#define SERIAL_7E1   (HARDSER_STOP_BIT_1 | HARDSER_PARITY_EVEN | HARDSER_DATA_7)
 
#define SERIAL_8E1   (HARDSER_STOP_BIT_1 | HARDSER_PARITY_EVEN | HARDSER_DATA_8)
 
#define SERIAL_5E2   (HARDSER_STOP_BIT_2 | HARDSER_PARITY_EVEN | HARDSER_DATA_5)
 
#define SERIAL_6E2   (HARDSER_STOP_BIT_2 | HARDSER_PARITY_EVEN | HARDSER_DATA_6)
 
#define SERIAL_7E2   (HARDSER_STOP_BIT_2 | HARDSER_PARITY_EVEN | HARDSER_DATA_7)
 
#define SERIAL_8E2   (HARDSER_STOP_BIT_2 | HARDSER_PARITY_EVEN | HARDSER_DATA_8)
 
#define SERIAL_5O1   (HARDSER_STOP_BIT_1 | HARDSER_PARITY_ODD | HARDSER_DATA_5)
 
#define SERIAL_6O1   (HARDSER_STOP_BIT_1 | HARDSER_PARITY_ODD | HARDSER_DATA_6)
 
#define SERIAL_7O1   (HARDSER_STOP_BIT_1 | HARDSER_PARITY_ODD | HARDSER_DATA_7)
 
#define SERIAL_8O1   (HARDSER_STOP_BIT_1 | HARDSER_PARITY_ODD | HARDSER_DATA_8)
 
#define SERIAL_5O2   (HARDSER_STOP_BIT_2 | HARDSER_PARITY_ODD | HARDSER_DATA_5)
 
#define SERIAL_6O2   (HARDSER_STOP_BIT_2 | HARDSER_PARITY_ODD | HARDSER_DATA_6)
 
#define SERIAL_7O2   (HARDSER_STOP_BIT_2 | HARDSER_PARITY_ODD | HARDSER_DATA_7)
 
#define SERIAL_8O2   (HARDSER_STOP_BIT_2 | HARDSER_PARITY_ODD | HARDSER_DATA_8)
 
#define PIN_ONBOARD_IDT   PIN_A0
 Board Specific APIs.
 
#define PIN_BUTTON_A   12
 Arduino Pin Number.
 
#define PIN_BUTTON_B   11
 Arduino Pin Number.
 
#define PIN_BUTTON_X   10
 Arduino Pin Number.
 
#define PIN_BUTTON_Y   9
 Arduino Pin Number.
 
#define PIN_HW_SAFETY   8
 Arduino Pin Number.
 
#define PIN_RESET_LCD   7
 Arduino Pin Number.
 
#define PIN_LCD_DC   6
 Arduino Pin Number.
 
#define PIN_PWM_LED_RED   5
 Arduino Pin Number.
 
#define PIN_PWM_LED_GREEN   4
 Arduino Pin Number.
 
#define PIN_PWM_LED_BLUE   3
 Arduino Pin Number.
 
#define PIN_PWM_LCD_BACKLIGHT   2
 Arduino Pin Number.
 
#define PIN_LCD_CS   53
 Arduino Pin Number.
 
#define PIN_PWM_HEATER   18
 Arduino Pin Number.
 
#define PIN_PWM_FAN   19
 Arduino Pin Number.
 
#define PIN_LCD_SPI_CLK   PIN_SPI_SCK
 Arduino Pin Number (alias)
 
#define PIN_LCD_SPI_MOSI   PIN_SPI_MOSI
 Arduino Pin Number (alias)
 
#define PIN_LCD_SPI_MISO   PIN_SPI_MISO
 Arduino Pin Number (alias)
 
#define LCD_SPI_DRIVER   SPI
 Arduino SPI driver instance (alias)
 
#define PIN_I2C_BUS_SCK   PIN_WIRE_SCL
 Arduino Pin Number (alias)
 
#define PIN_I2C_BUS_SDA   PIN_WIRE_SDA
 Arduino Pin Number (alias)
 
#define I2C_BUS_DRIVER   Wire
 Arduino I2C driver instance (alias)
 
#define BSP_I2C_ADDRESS_EEPROM   0x50
 7bit address for the offboard EEPROM
 
#define Bsp_NVIC_disableIRQ(irqNum)   do { NVIC_DisableIRQ(irqNum); __DSB(); __ISB(); } while(0)
 ARM Specific APIs.
 
#define Bsp_NVIC_enableIRQ(irqNum)   do { NVIC_EnableIRQ(irqNum); __DSB(); __ISB(); } while(0)
 Enable a specific interrupt (with memory barrier protection)
 
#define Bsp_Api_reset_MCU()   NVIC_SystemReset()
 Resets the MCU.
 
#define Bsp_Api_nop_MAP()   __asm("nop")
 Generic APIs.
 
#define Bsp_Api_disableIrqs_MAP()   taskENTER_CRITICAL()
 Generic API.
 
#define Bsp_Api_enableIrqs_MAP()   taskEXIT_CRITICAL()
 Generic API.
 
#define Bsp_Api_pushAndDisableIrqs_MAP()   taskENTER_CRITICAL()
 Generic API.
 
#define Bsp_Api_popIrqs_MAP()   taskEXIT_CRITICAL()
 Generic API.
 
#define OPTION_BSP_DEBUG_LED1_INDEX   PIN_LED
 Default Mapping for the "debug LED 1".
 
#define OPTION_BSP_DEBUG_LED2_INDEX   DEBUG_LED_IS_NOT_SUPPORTED
 Default Mapping for the "debug LED 2".
 
#define Bsp_Api_turnOn_debug1_MAP()   digitalWrite( OPTION_BSP_DEBUG_LED1_INDEX, HIGH )
 Generic API.
 
#define Bsp_Api_turnOff_debug1_MAP()   digitalWrite( OPTION_BSP_DEBUG_LED1_INDEX, LOW )
 Generic API.
 
#define Bsp_Api_toggle_debug1_MAP()   digitalWrite( OPTION_BSP_DEBUG_LED1_INDEX, !digitalRead(OPTION_BSP_DEBUG_LED1_INDEX) )
 Generic API.
 
#define Bsp_Api_turnOn_debug2_MAP()   digitalWrite( OPTION_BSP_DEBUG_LED2_INDEX, HIGH )
 Generic API.
 
#define Bsp_Api_turnOff_debug2_MAP()   digitalWrite( OPTION_BSP_DEBUG_LED2_INDEX, LOW )
 Generic API.
 
#define Bsp_Api_toggle_debug2_MAP()   digitalWrite( OPTION_BSP_DEBUG_LED2_INDEX, !digitalRead(OPTION_BSP_DEBUG_LED2_INDEX) )
 Generic API.
 

Functions

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.
 

Macro Definition Documentation

◆ Bsp_Api_disableIrqs_MAP

#define Bsp_Api_disableIrqs_MAP (   void)    taskENTER_CRITICAL()

Generic API.

◆ Bsp_Api_enableIrqs_MAP

#define Bsp_Api_enableIrqs_MAP (   void)    taskEXIT_CRITICAL()

Generic API.

◆ Bsp_Api_nop_MAP

#define Bsp_Api_nop_MAP (   void)    __asm("nop")

Generic APIs.

Generic API

◆ Bsp_Api_popIrqs_MAP

#define Bsp_Api_popIrqs_MAP (   void)    taskEXIT_CRITICAL()

Generic API.

◆ Bsp_Api_pushAndDisableIrqs_MAP

#define Bsp_Api_pushAndDisableIrqs_MAP (   void)    taskENTER_CRITICAL()

Generic API.

◆ Bsp_Api_reset_MCU

#define Bsp_Api_reset_MCU ( )    NVIC_SystemReset()

Resets the MCU.

◆ Bsp_Api_toggle_debug1_MAP

#define Bsp_Api_toggle_debug1_MAP ( )    digitalWrite( OPTION_BSP_DEBUG_LED1_INDEX, !digitalRead(OPTION_BSP_DEBUG_LED1_INDEX) )

Generic API.

◆ Bsp_Api_toggle_debug2_MAP

#define Bsp_Api_toggle_debug2_MAP ( )    digitalWrite( OPTION_BSP_DEBUG_LED2_INDEX, !digitalRead(OPTION_BSP_DEBUG_LED2_INDEX) )

Generic API.

◆ Bsp_Api_turnOff_debug1_MAP

#define Bsp_Api_turnOff_debug1_MAP ( )    digitalWrite( OPTION_BSP_DEBUG_LED1_INDEX, LOW )

Generic API.

◆ Bsp_Api_turnOff_debug2_MAP

#define Bsp_Api_turnOff_debug2_MAP ( )    digitalWrite( OPTION_BSP_DEBUG_LED2_INDEX, LOW )

Generic API.

◆ Bsp_Api_turnOn_debug1_MAP

#define Bsp_Api_turnOn_debug1_MAP ( )    digitalWrite( OPTION_BSP_DEBUG_LED1_INDEX, HIGH )

Generic API.

◆ Bsp_Api_turnOn_debug2_MAP

#define Bsp_Api_turnOn_debug2_MAP ( )    digitalWrite( OPTION_BSP_DEBUG_LED2_INDEX, HIGH )

Generic API.

◆ BSP_I2C_ADDRESS_EEPROM

#define BSP_I2C_ADDRESS_EEPROM   0x50

7bit address for the offboard EEPROM

◆ Bsp_NVIC_disableIRQ

#define Bsp_NVIC_disableIRQ (   irqNum)    do { NVIC_DisableIRQ(irqNum); __DSB(); __ISB(); } while(0)

ARM Specific APIs.

Disable a specific interrupt (with memory barrier protection)

◆ Bsp_NVIC_enableIRQ

#define Bsp_NVIC_enableIRQ (   irqNum)    do { NVIC_EnableIRQ(irqNum); __DSB(); __ISB(); } while(0)

Enable a specific interrupt (with memory barrier protection)

◆ HARDSER_PARITY_EVEN

#define HARDSER_PARITY_EVEN   (0x1ul)

Returns a reference to the Primary Serial Port Object.

This is implicitly exposed (can't directly expose it due to racing conditions on how the colony_map.h header files work). This means that the application must cut-n-paste the following extern statement to get access to this method.

extern Cpl::Io::InputOutput& Bsp_Serial(void);

◆ I2C_BUS_DRIVER

#define I2C_BUS_DRIVER   Wire

Arduino I2C driver instance (alias)

◆ LCD_SPI_DRIVER

#define LCD_SPI_DRIVER   SPI

Arduino SPI driver instance (alias)

◆ OPTION_BSP_DEBUG_LED1_INDEX

#define OPTION_BSP_DEBUG_LED1_INDEX   PIN_LED

Default Mapping for the "debug LED 1".

◆ OPTION_BSP_DEBUG_LED2_INDEX

#define OPTION_BSP_DEBUG_LED2_INDEX   DEBUG_LED_IS_NOT_SUPPORTED

Default Mapping for the "debug LED 2".

◆ PIN_BUTTON_A

#define PIN_BUTTON_A   12

Arduino Pin Number.

◆ PIN_BUTTON_B

#define PIN_BUTTON_B   11

Arduino Pin Number.

◆ PIN_BUTTON_X

#define PIN_BUTTON_X   10

Arduino Pin Number.

◆ PIN_BUTTON_Y

#define PIN_BUTTON_Y   9

Arduino Pin Number.

◆ PIN_HW_SAFETY

#define PIN_HW_SAFETY   8

Arduino Pin Number.

◆ PIN_I2C_BUS_SCK

#define PIN_I2C_BUS_SCK   PIN_WIRE_SCL

Arduino Pin Number (alias)

◆ PIN_I2C_BUS_SDA

#define PIN_I2C_BUS_SDA   PIN_WIRE_SDA

Arduino Pin Number (alias)

◆ PIN_LCD_CS

#define PIN_LCD_CS   53

Arduino Pin Number.

◆ PIN_LCD_DC

#define PIN_LCD_DC   6

Arduino Pin Number.

◆ PIN_LCD_SPI_CLK

#define PIN_LCD_SPI_CLK   PIN_SPI_SCK

Arduino Pin Number (alias)

◆ PIN_LCD_SPI_MISO

#define PIN_LCD_SPI_MISO   PIN_SPI_MISO

Arduino Pin Number (alias)

◆ PIN_LCD_SPI_MOSI

#define PIN_LCD_SPI_MOSI   PIN_SPI_MOSI

Arduino Pin Number (alias)

◆ PIN_ONBOARD_IDT

#define PIN_ONBOARD_IDT   PIN_A0

Board Specific APIs.

Arduino Pin Number

◆ PIN_PWM_FAN

#define PIN_PWM_FAN   19

Arduino Pin Number.

◆ PIN_PWM_HEATER

#define PIN_PWM_HEATER   18

Arduino Pin Number.

◆ PIN_PWM_LCD_BACKLIGHT

#define PIN_PWM_LCD_BACKLIGHT   2

Arduino Pin Number.

◆ PIN_PWM_LED_BLUE

#define PIN_PWM_LED_BLUE   3

Arduino Pin Number.

◆ PIN_PWM_LED_GREEN

#define PIN_PWM_LED_GREEN   4

Arduino Pin Number.

◆ PIN_PWM_LED_RED

#define PIN_PWM_LED_RED   5

Arduino Pin Number.

◆ PIN_RESET_LCD

#define PIN_RESET_LCD   7

Arduino Pin Number.

Function Documentation

◆ Bsp_beginArduinoSerialObject()

void Bsp_beginArduinoSerialObject ( unsigned long  baudrate,
uint16_t  frameConfig 
)

Board Specific APIs.

Initialize the primary serial port AND it waits for a Host to connect to the serial port.

◆ Bsp_beginFileSystem()

void Bsp_beginFileSystem ( )

This method initializes and start the SdFat file system on the onboard 8MB data flash.