Skip to content

Commit

Permalink
add sensor watch board definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
joeycastillo committed Jul 9, 2024
1 parent 300fdef commit efba273
Show file tree
Hide file tree
Showing 6 changed files with 216 additions and 0 deletions.
6 changes: 6 additions & 0 deletions boards/sensorwatch_blue/board.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
CHIP = saml22
LDSCRIPT = saml22n18

DEFINES += \
-D__SAML22J18A__ \
-DSTATIC_FREQUENCY_CORRECTION=11 \
67 changes: 67 additions & 0 deletions boards/sensorwatch_blue/pins.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#pragma once

#include "hal_gpio.h"


// Analog pins
HAL_GPIO_PIN(A0, B, 4)
HAL_GPIO_PIN(A1, B, 1)
HAL_GPIO_PIN(A2, B, 2)
HAL_GPIO_PIN(A3, B, 3)
HAL_GPIO_PIN(A4, B, 0)

// SPI
HAL_GPIO_PIN(MISO, B, 0)
HAL_GPIO_PIN(SCK, B, 1)
HAL_GPIO_PIN(MOSI, B, 2)
HAL_GPIO_PIN(CS, B, 3)
#define SPI_SERCOM 3
#define SPI_SERCOM_DOPO SPI_DOPO_0_SCK_3
#define SPI_SERCOM_DIPO SPI_DIPO_2

// I2C
HAL_GPIO_PIN(SDA, B, 30)
HAL_GPIO_PIN(SCL, B, 31)
#define I2C_SERCOM 1

// Light
HAL_GPIO_PIN(BLUE, A, 20)
HAL_GPIO_PIN(RED, A, 21)
HAL_GPIO_PIN(LED, A, 21) // Default to red LED for blinky tests

// Sound
HAL_GPIO_PIN(BUZZER, A, 27)

// Buttons
HAL_GPIO_PIN(BTN_LIGHT, A, 22)
HAL_GPIO_PIN(BTN_MODE, A, 23)
HAL_GPIO_PIN(BTN_ALARM, A, 2)

// Segment LCD
HAL_GPIO_PIN(SLCD0, B, 6)
HAL_GPIO_PIN(SLCD1, B, 7)
HAL_GPIO_PIN(SLCD2, B, 8)
HAL_GPIO_PIN(SLCD3, B, 9)
HAL_GPIO_PIN(SLCD4, A, 5)
HAL_GPIO_PIN(SLCD5, A, 4)
HAL_GPIO_PIN(SLCD6, A, 6)
HAL_GPIO_PIN(SLCD7, A, 7)
HAL_GPIO_PIN(SLCD8, A, 8)
HAL_GPIO_PIN(SLCD9, A, 9)
HAL_GPIO_PIN(SLCD10, A, 10)
HAL_GPIO_PIN(SLCD11, A, 11)
HAL_GPIO_PIN(SLCD12, B, 11)
HAL_GPIO_PIN(SLCD13, B, 12)
HAL_GPIO_PIN(SLCD14, B, 13)
HAL_GPIO_PIN(SLCD15, B, 14)
HAL_GPIO_PIN(SLCD16, B, 15)
HAL_GPIO_PIN(SLCD17, A, 12)
HAL_GPIO_PIN(SLCD18, A, 13)
HAL_GPIO_PIN(SLCD19, A, 14)
HAL_GPIO_PIN(SLCD20, A, 15)
HAL_GPIO_PIN(SLCD21, A, 16)
HAL_GPIO_PIN(SLCD22, A, 17)
HAL_GPIO_PIN(SLCD23, A, 18)
HAL_GPIO_PIN(SLCD24, A, 19)
HAL_GPIO_PIN(SLCD25, B, 16)
HAL_GPIO_PIN(SLCD26, B, 17)
6 changes: 6 additions & 0 deletions boards/sensorwatch_green/board.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
CHIP = saml22
LDSCRIPT = saml22n18

DEFINES += \
-D__SAML22J18A__ \
-DSTATIC_FREQUENCY_CORRECTION=22 \
67 changes: 67 additions & 0 deletions boards/sensorwatch_green/pins.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#pragma once

#include "hal_gpio.h"


// Analog pins
HAL_GPIO_PIN(A0, B, 4)
HAL_GPIO_PIN(A1, B, 1)
HAL_GPIO_PIN(A2, B, 2)
HAL_GPIO_PIN(A3, B, 3)
HAL_GPIO_PIN(A4, B, 0)

// SPI
HAL_GPIO_PIN(MISO, B, 0)
HAL_GPIO_PIN(SCK, B, 1)
HAL_GPIO_PIN(MOSI, B, 2)
HAL_GPIO_PIN(CS, B, 3)
#define SPI_SERCOM 3
#define SPI_SERCOM_DOPO SPI_DOPO_0_SCK_3
#define SPI_SERCOM_DIPO SPI_DIPO_2

// I2C
HAL_GPIO_PIN(SDA, B, 30)
HAL_GPIO_PIN(SCL, B, 31)
#define I2C_SERCOM 1

// Light
HAL_GPIO_PIN(RED, A, 20)
HAL_GPIO_PIN(GREEN, A, 21)
HAL_GPIO_PIN(LED, A, 20) // Default to red LED for blinky tests

// Sound
HAL_GPIO_PIN(BUZZER, A, 27)

// Buttons
HAL_GPIO_PIN(BTN_LIGHT, A, 22)
HAL_GPIO_PIN(BTN_MODE, A, 23)
HAL_GPIO_PIN(BTN_ALARM, A, 2)

// Segment LCD
HAL_GPIO_PIN(SLCD0, B, 6)
HAL_GPIO_PIN(SLCD1, B, 7)
HAL_GPIO_PIN(SLCD2, B, 8)
HAL_GPIO_PIN(SLCD3, B, 9)
HAL_GPIO_PIN(SLCD4, A, 5)
HAL_GPIO_PIN(SLCD5, A, 4)
HAL_GPIO_PIN(SLCD6, A, 6)
HAL_GPIO_PIN(SLCD7, A, 7)
HAL_GPIO_PIN(SLCD8, A, 8)
HAL_GPIO_PIN(SLCD9, A, 9)
HAL_GPIO_PIN(SLCD10, A, 10)
HAL_GPIO_PIN(SLCD11, A, 11)
HAL_GPIO_PIN(SLCD12, B, 11)
HAL_GPIO_PIN(SLCD13, B, 12)
HAL_GPIO_PIN(SLCD14, B, 13)
HAL_GPIO_PIN(SLCD15, B, 14)
HAL_GPIO_PIN(SLCD16, B, 15)
HAL_GPIO_PIN(SLCD17, A, 12)
HAL_GPIO_PIN(SLCD18, A, 13)
HAL_GPIO_PIN(SLCD19, A, 14)
HAL_GPIO_PIN(SLCD20, A, 15)
HAL_GPIO_PIN(SLCD21, A, 16)
HAL_GPIO_PIN(SLCD22, A, 17)
HAL_GPIO_PIN(SLCD23, A, 18)
HAL_GPIO_PIN(SLCD24, A, 19)
HAL_GPIO_PIN(SLCD25, B, 16)
HAL_GPIO_PIN(SLCD26, B, 17)
6 changes: 6 additions & 0 deletions boards/sensorwatch_red/board.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
CHIP = saml22
LDSCRIPT = saml22n18

DEFINES += \
-D__SAML22J18A__ \
-DWATCH_INVERT_LED_POLARITY \
64 changes: 64 additions & 0 deletions boards/sensorwatch_red/pins.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#pragma once

#include "hal_gpio.h"


// Analog pins (hard-wired to board features on Sensor Watch Lite)
HAL_GPIO_PIN(A0, B, 4) // Redefined below, hard-wired to temperature sensor enable
HAL_GPIO_PIN(A1, B, 1) // Redefined below, hard-wired to UART RX
HAL_GPIO_PIN(A2, B, 2) // Redefined below, hard-wired to temperature sensor
HAL_GPIO_PIN(A3, B, 3) // Not connected on Lite
HAL_GPIO_PIN(A4, B, 0) // Redefined below, hard-wired to UART TX

// UART
HAL_GPIO_PIN(TX, B, 0)
HAL_GPIO_PIN(RX, B, 1)
#define UART_SERCOM 0
#define UART_SERCOM_TXPO UART_TXPO_2
#define UART_SERCOM_RXPO UART_RXPO_3

// Temperature sensor
HAL_GPIO_PIN(TS_ENABLE, B, 4)
HAL_GPIO_PIN(TEMPSENSE, B, 2)

// Light
HAL_GPIO_PIN(RED, A, 20)
HAL_GPIO_PIN(GREEN, A, 21)
HAL_GPIO_PIN(LED, A, 20) // Default to red LED for blinky tests

// Sound
HAL_GPIO_PIN(BUZZER, A, 27)

// Buttons
HAL_GPIO_PIN(BTN_LIGHT, A, 22)
HAL_GPIO_PIN(BTN_MODE, A, 23)
HAL_GPIO_PIN(BTN_ALARM, A, 2)

// Segment LCD
HAL_GPIO_PIN(SLCD0, B, 6)
HAL_GPIO_PIN(SLCD1, B, 7)
HAL_GPIO_PIN(SLCD2, B, 8)
HAL_GPIO_PIN(SLCD3, B, 9)
HAL_GPIO_PIN(SLCD4, A, 5)
HAL_GPIO_PIN(SLCD5, A, 4)
HAL_GPIO_PIN(SLCD6, A, 6)
HAL_GPIO_PIN(SLCD7, A, 7)
HAL_GPIO_PIN(SLCD8, A, 8)
HAL_GPIO_PIN(SLCD9, A, 9)
HAL_GPIO_PIN(SLCD10, A, 10)
HAL_GPIO_PIN(SLCD11, A, 11)
HAL_GPIO_PIN(SLCD12, B, 11)
HAL_GPIO_PIN(SLCD13, B, 12)
HAL_GPIO_PIN(SLCD14, B, 13)
HAL_GPIO_PIN(SLCD15, B, 14)
HAL_GPIO_PIN(SLCD16, B, 15)
HAL_GPIO_PIN(SLCD17, A, 12)
HAL_GPIO_PIN(SLCD18, A, 13)
HAL_GPIO_PIN(SLCD19, A, 14)
HAL_GPIO_PIN(SLCD20, A, 15)
HAL_GPIO_PIN(SLCD21, A, 16)
HAL_GPIO_PIN(SLCD22, A, 17)
HAL_GPIO_PIN(SLCD23, A, 18)
HAL_GPIO_PIN(SLCD24, A, 19)
HAL_GPIO_PIN(SLCD25, B, 16)
HAL_GPIO_PIN(SLCD26, B, 17)

0 comments on commit efba273

Please sign in to comment.