Subversion Repositories Code-Repo

Compare Revisions

No changes between revisions

Ignore whitespace Rev 341 → Rev 342

/PIC Projects/PICX_12F1840_Clock/I2C1.c
0,0 → 1,318
#include "defines.h"
#include "I2C1.h"
 
extern I2C1_DATA i2c_data;
 
// Set up the data structures for the base_I2C.code
// Should be called once before any i2c routines are called
void I2C1_Init(void) {
I2C_1_CLK_TRIS = 1;
I2C_1_DAT_TRIS = 1;
i2c_data.buffer_in_len = 0;
i2c_data.buffer_in_read_ind = 0;
i2c_data.buffer_in_write_ind = 0;
i2c_data.operating_state = I2C_IDLE;
i2c_data.return_status = 0;
 
i2c_data.master_dest_addr = 0;
i2c_data.master_status = I2C_MASTER_IDLE;
// Enable I2C interrupt
PIE1bits.SSP1IE = 1;
}
 
// Setup the PIC to operate as a master.
void I2C1_Configure_Master(uint8_t speed) {
SSP1STAT = 0x0;
SSP1CON1 = 0x0;
SSP1CON2 = 0x0;
SSP1CON3 = 0x0;
SSP1CON1bits.SSPM = 0x8; // I2C Master Mode
if (speed == 0x01) {
SSP1ADD = 0x13; // Operate at 400KHz (32MHz)
SSP1STATbits.SMP = 1; // Disable Slew Rate Control
} else if (speed == 0x02) {
SSP1ADD = 0x07; // Operate at 1Mhz (32Mhz)
SSP1STATbits.SMP = 1; // Disable Slew Rate Control
} else {
SSP1ADD = 0x4F; // Operate at 100KHz (32MHz)
SSP1STATbits.SMP = 0; // Enable Slew Rate Control
}
SSP1CON1bits.SSPEN = 1; // Enable MSSP1 Module
}
 
// Sends length number of bytes in msg to specified address (no R/W bit)
void I2C1_Master_Send(uint8_t address, uint8_t length, uint8_t *msg) {
if (length == 0)
return;
// Copy message to send into buffer and save length/address
for (uint8_t i = 0; i < length; i++) {
i2c_data.buffer_in[i] = msg[i];
}
i2c_data.buffer_in_len = length;
i2c_data.master_dest_addr = address;
i2c_data.buffer_in_read_ind = 0;
i2c_data.buffer_in_write_ind = 0;
 
// Change status to 'next' operation
i2c_data.operating_state = I2C_SEND_ADDR;
i2c_data.master_status = I2C_MASTER_SEND;
// Generate start condition
SSP1CON2bits.SEN = 1;
}
 
// Reads length number of bytes from address (no R/W bit)
void I2C1_Master_Recv(uint8_t address, uint8_t length) {
if (length == 0)
return;
 
// Save length and address to get data from
i2c_data.buffer_in_len = length;
i2c_data.master_dest_addr = address;
i2c_data.buffer_in_read_ind = 0;
i2c_data.buffer_in_write_ind = 0;
 
// Change status to 'next' operation
i2c_data.operating_state = I2C_SEND_ADDR;
i2c_data.master_status = I2C_MASTER_RECV;
// Generate start condition
SSP1CON2bits.SEN = 1;
}
 
// Writes msg to address then reads length number of bytes from address
void I2C1_Master_Restart(uint8_t address, uint8_t msg, uint8_t length) {
uint8_t c;
if (length == 0) {
c = msg;
I2C1_Master_Send(address, 1, &c);
return;
}
 
// Save length and address to get data from
i2c_data.buffer_in[0] = msg;
i2c_data.buffer_in_len = length;
i2c_data.master_dest_addr = address;
i2c_data.buffer_in_read_ind = 0;
i2c_data.buffer_in_write_ind = 0;
 
// Change status to 'next' operation
i2c_data.operating_state = I2C_SEND_ADDR;
i2c_data.master_status = I2C_MASTER_RESTART;
 
// Generate start condition
SSP1CON2bits.SEN = 1;
}
 
void I2C1_Interrupt_Handler() {
// If we are in the middle of sending data
if (i2c_data.master_status == I2C_MASTER_SEND) {
switch (i2c_data.operating_state) {
case I2C_IDLE:
break;
case I2C_SEND_ADDR:
// Send the address with read bit set
i2c_data.operating_state = I2C_CHECK_ACK_SEND;
SSP1BUF = (i2c_data.master_dest_addr << 1) | 0x0;
break;
case I2C_CHECK_ACK_SEND:
// Check if ACK is received or not
if (!SSP1CON2bits.ACKSTAT) {
// If an ACK is received, send next byte of data
if (i2c_data.buffer_in_read_ind < i2c_data.buffer_in_len) {
SSP1BUF = i2c_data.buffer_in[i2c_data.buffer_in_read_ind];
i2c_data.buffer_in_read_ind++;
} else {
// If no more data is to be sent, send stop bit
i2c_data.operating_state = I2C_IDLE;
SSP1CON2bits.PEN = 1;
i2c_data.master_status = I2C_MASTER_IDLE;
i2c_data.return_status = I2C_SEND_OK;
}
} else {
// If a NACK is received, stop transmission and send error
i2c_data.operating_state = I2C_IDLE;
SSP1CON2bits.PEN = 1;
i2c_data.master_status = I2C_MASTER_IDLE;
i2c_data.return_status = I2C_SEND_FAIL;
}
break;
}
// If we are in the middle of receiving data
} else if (i2c_data.master_status == I2C_MASTER_RECV) {
switch (i2c_data.operating_state) {
case I2C_IDLE:
break;
case I2C_SEND_ADDR:
// Send address with write bit set
i2c_data.operating_state = I2C_CHECK_ACK_RECV;
uint8_t tmp = (i2c_data.master_dest_addr << 1);
tmp |= 0x01;
SSP1BUF = tmp;
break;
case I2C_CHECK_ACK_RECV:
// Check if ACK is received
if (!SSP1CON2bits.ACKSTAT) {
// If an ACK is received, set module to receive 1 byte of data
i2c_data.operating_state = I2C_RCV_DATA;
SSP1CON2bits.RCEN = 1;
} else {
// If a NACK is received, stop transmission and send error
i2c_data.operating_state = I2C_IDLE;
SSP1CON2bits.PEN = 1;
i2c_data.master_status = I2C_MASTER_IDLE;
i2c_data.return_status = I2C_RECV_FAIL;
}
break;
case I2C_RCV_DATA:
// On receive, save byte into buffer
// TODO: Handle I2C buffer overflow
i2c_data.buffer_in[i2c_data.buffer_in_write_ind] = SSP1BUF;
i2c_data.buffer_in_write_ind++;
if (i2c_data.buffer_in_write_ind < i2c_data.buffer_in_len) {
// If we still need to read, send an ACK to the slave
i2c_data.operating_state = I2C_REQ_DATA;
SSP1CON2bits.ACKDT = 0; // ACK
SSP1CON2bits.ACKEN = 1;
} else {
// If we are done reading, send an NACK to the slave
i2c_data.operating_state = I2C_SEND_STOP;
SSP1CON2bits.ACKDT = 1; // NACK
SSP1CON2bits.ACKEN = 1;
}
break;
case I2C_REQ_DATA:
// Set module to receive one byte of data
i2c_data.operating_state = I2C_RCV_DATA;
SSP1CON2bits.RCEN = 1;
break;
case I2C_SEND_STOP:
// Send the stop bit and copy message to send to Main()
i2c_data.operating_state = I2C_IDLE;
SSP1CON2bits.PEN = 1;
i2c_data.master_status = I2C_MASTER_IDLE;
i2c_data.return_status = I2C_RECV_OK;
break;
}
} else if (i2c_data.master_status == I2C_MASTER_RESTART) {
switch (i2c_data.operating_state) {
case I2C_IDLE:
break;
case I2C_SEND_ADDR:
// Send the address with read bit set
i2c_data.operating_state = I2C_CHECK_ACK_SEND;
SSP1BUF = (i2c_data.master_dest_addr << 1) | 0x0;
break;
case I2C_CHECK_ACK_SEND:
// Check if ACK is received or not
if (!SSP1CON2bits.ACKSTAT) {
// If an ACK is received, send first byte of data
SSP1BUF = i2c_data.buffer_in[0];
i2c_data.operating_state = I2C_CHECK_ACK_RESTART;
} else {
// If a NACK is received, stop transmission and send error
i2c_data.operating_state = I2C_IDLE;
SSP1CON2bits.PEN = 1;
i2c_data.master_status = I2C_MASTER_IDLE;
i2c_data.return_status = I2C_SEND_FAIL;
}
break;
case I2C_CHECK_ACK_RESTART:
if (!SSP1CON2bits.ACKSTAT) {
SSP1CON2bits.RSEN = 1;
i2c_data.operating_state = I2C_SEND_ADDR_2;
} else {
// If a NACK is received, stop transmission and send error
i2c_data.operating_state = I2C_IDLE;
SSP1CON2bits.PEN = 1;
i2c_data.master_status = I2C_MASTER_IDLE;
i2c_data.return_status = I2C_SEND_FAIL;
}
break;
case I2C_SEND_ADDR_2:
// Send the address with read bit set
i2c_data.operating_state = I2C_CHECK_ACK_RECV;
uint8_t tmp = (i2c_data.master_dest_addr << 1);
tmp |= 0x01;
SSP1BUF = tmp;
break;
case I2C_CHECK_ACK_RECV:
// Check if ACK is received
if (!SSP1CON2bits.ACKSTAT) {
// If an ACK is received, set module to receive 1 byte of data
i2c_data.operating_state = I2C_RCV_DATA;
SSP1CON2bits.RCEN = 1;
} else {
// If a NACK is received, stop transmission and send error
i2c_data.operating_state = I2C_IDLE;
SSP1CON2bits.PEN = 1;
i2c_data.master_status = I2C_MASTER_IDLE;
i2c_data.return_status = I2C_RECV_FAIL;
}
break;
case I2C_RCV_DATA:
// On receive, save byte into buffer
// TODO: Handle I2C buffer overflow
i2c_data.buffer_in[i2c_data.buffer_in_write_ind] = SSP1BUF;
i2c_data.buffer_in_write_ind++;
if (i2c_data.buffer_in_write_ind < i2c_data.buffer_in_len) {
// If we still need to read, send an ACK to the slave
i2c_data.operating_state = I2C_REQ_DATA;
SSP1CON2bits.ACKDT = 0; // ACK
SSP1CON2bits.ACKEN = 1;
} else {
// If we are done reading, send an NACK to the slave
i2c_data.operating_state = I2C_SEND_STOP;
SSP1CON2bits.ACKDT = 1; // NACK
SSP1CON2bits.ACKEN = 1;
}
break;
case I2C_REQ_DATA:
// Set module to receive one byte of data
i2c_data.operating_state = I2C_RCV_DATA;
SSP1CON2bits.RCEN = 1;
break;
case I2C_SEND_STOP:
// Send the stop bit
i2c_data.operating_state = I2C_IDLE;
SSP1CON2bits.PEN = 1;
i2c_data.master_status = I2C_MASTER_IDLE;
i2c_data.return_status = I2C_RECV_OK;
break;
}
}
}
 
/* Returns 0 if I2C module is currently busy, otherwise returns status code */
uint8_t I2C1_Get_Status() {
// if (i2c_data.operating_mode == I2C_MODE_MASTER) {
if (i2c_data.master_status != I2C_MASTER_IDLE || i2c_data.buffer_in_len == 0) {
return 0;
} else {
return i2c_data.return_status;
}
}
 
uint8_t I2C1_Buffer_Len() {
return i2c_data.buffer_in_len;
}
 
/* Returns 0 if I2C module is currently busy, otherwise returns buffer length */
uint8_t I2C1_Read_Buffer(uint8_t *buffer) {
uint8_t i = 0;
while (i2c_data.buffer_in_len != 0) {
buffer[i] = i2c_data.buffer_in[i2c_data.buffer_in_read_ind];
i++;
if (i2c_data.buffer_in_read_ind == MAXI2C1BUF-1) {
i2c_data.buffer_in_read_ind = 0;
} else {
i2c_data.buffer_in_read_ind++;
}
i2c_data.buffer_in_len--;
}
return i;
}
/PIC Projects/PICX_12F1840_Clock/NEOPIXEL.c
0,0 → 1,167
#include "defines.h"
#include "NEOPIXEL.h"
 
extern NEOPIXEL_DATA neopixel_data;
 
void NeoPixel_Init(void) {
 
// Clear buffer
for (uint8_t i = 0; i < NEOPIXEL_LENGTH * 3; i++) {
neopixel_data.values[i] = 0x0;
}
 
neopixel_data.offset = 0;
 
// Output pin initially blocked
NEOPIXEL_TRIS = 1;
 
/* Initialize PWM module */
PR2 = 0x09; // 1.25us @ 32MHz
CCP1CONbits.P1M = 0b00; // Single output, P1A modulated only
CCP1CONbits.CCP1M = 0b1100; // PWM mode, P1A active-high, P1B active-high
 
// Idle the output till width is specified
CCPR1L = 0x00;
CCP1CONbits.DC1B = 0b00;
 
/* Initialize Timer 2 */
PIR1bits.TMR2IF = 0; // Clear the interrupt flag for Timer 2
T2CONbits.T2CKPS = 0b00; // Set a prescaler of 1:1
T2CONbits.TMR2ON = 1; // Enable the timer
 
// Wait for the timer to overflow before enabling output
while (!PIR1bits.TMR2IF);
NEOPIXEL_TRIS = 0;
}
 
void NeoPixel_Offet(uint8_t value) {
neopixel_data.offset = value;
}
 
void NeoPixel_Clear(void) {
// Clear buffer
for (uint8_t i = 0; i < NEOPIXEL_LENGTH * 3; i++) {
neopixel_data.values[i] = 0x0;
}
}
 
void NeoPixel_Set(uint8_t index, uint8_t R, uint8_t G, uint8_t B, uint8_t multiplier) {
uint8_t i = ((index + neopixel_data.offset) % NEOPIXEL_LENGTH);
if (G == 0)
neopixel_data.values[(i * 3) + 0] = 0;
else
neopixel_data.values[(i * 3) + 0] = (G * multiplier) - 1;
if (R == 0)
neopixel_data.values[(i * 3) + 1] = 0;
else
neopixel_data.values[(i * 3) + 1] = (R * multiplier) - 1;
if (B == 0)
neopixel_data.values[(i * 3) + 2] = 0;
else
neopixel_data.values[(i * 3) + 2] = (B * multiplier) - 1;
}
 
void NeoPixel_Or(uint8_t index, uint8_t R, uint8_t G, uint8_t B, uint8_t multiplier) {
uint8_t i = ((index + neopixel_data.offset) % NEOPIXEL_LENGTH);
 
if (G != 0)
neopixel_data.values[(i * 3) + 0] |= (G * multiplier) - 1;
if (R != 0)
neopixel_data.values[(i * 3) + 1] |= (R * multiplier) - 1;
if (B != 0)
neopixel_data.values[(i * 3) + 2] |= (B * multiplier) - 1;
}
 
void NeoPixel_Write_All(void) {
for (uint8_t i = 0; i < NEOPIXEL_LENGTH * 3; i++) {
NeoPixel_Write_One(neopixel_data.values[i]);
}
// Delay for 50us to latch data
__delay_us(50);
}
 
void NeoPixel_Write_One(uint8_t value) {
// Enable timer and wait for it to overflow
T2CONbits.TMR2ON = 1;
while (!PIR1bits.TMR2IF);
 
// Set pulse width for bit 7
if (value & 0x80) {
CCPR1L = NEOPIXEL_LOGIC_1; // ~800ns high, ~450ns low (logic 1)
} else {
CCPR1L = NEOPIXEL_LOGIC_0; // ~400ns high, ~850ns low (logic 0)
}
while (!PIR1bits.TMR2IF);
 
// Set pulse width for bit 6
if (value & 0x40) {
CCPR1L = NEOPIXEL_LOGIC_1; // ~800ns high, ~450ns low (logic 1)
} else {
CCPR1L = NEOPIXEL_LOGIC_0; // ~400ns high, ~850ns low (logic 0)
}
while (!PIR1bits.TMR2IF);
 
// Set pulse width for bit 5
if (value & 0x20) {
CCPR1L = NEOPIXEL_LOGIC_1; // ~800ns high, ~450ns low (logic 1)
} else {
CCPR1L = NEOPIXEL_LOGIC_0; // ~400ns high, ~850ns low (logic 0)
}
while (!PIR1bits.TMR2IF);
 
// Set pulse width for bit 4
if (value & 0x10) {
CCPR1L = NEOPIXEL_LOGIC_1; // ~800ns high, ~450ns low (logic 1)
} else {
CCPR1L = NEOPIXEL_LOGIC_0; // ~400ns high, ~850ns low (logic 0)
}
while (!PIR1bits.TMR2IF);
 
// Set pulse width for bit 3
if (value & 0x08) {
CCPR1L = NEOPIXEL_LOGIC_1; // ~800ns high, ~450ns low (logic 1)
} else {
CCPR1L = NEOPIXEL_LOGIC_0; // ~400ns high, ~850ns low (logic 0)
}
while (!PIR1bits.TMR2IF);
 
// Set pulse width for bit 2
if (value & 0x04) {
CCPR1L = NEOPIXEL_LOGIC_1; // ~800ns high, ~450ns low (logic 1)
} else {
CCPR1L = NEOPIXEL_LOGIC_0; // ~400ns high, ~850ns low (logic 0)
}
while (!PIR1bits.TMR2IF);
 
// Set pulse width for bit 1
if (value & 0x02) {
CCPR1L = NEOPIXEL_LOGIC_1; // ~800ns high, ~450ns low (logic 1)
} else {
CCPR1L = NEOPIXEL_LOGIC_0; // ~400ns high, ~850ns low (logic 0)
}
while (!PIR1bits.TMR2IF);
 
// Set pulse width for bit 0
if (value & 0x01) {
CCPR1L = NEOPIXEL_LOGIC_1; // ~800ns high, ~450ns low (logic 1)
} else {
CCPR1L = NEOPIXEL_LOGIC_0; // ~400ns high, ~850ns low (logic 0)
}
 
// Idle line low
while (!PIR1bits.TMR2IF);
asm("NOP");
asm("NOP");
asm("NOP");
asm("NOP");
asm("NOP");
CCPR1L = 0b00000000;
 
// Disable and reset timer
while (!PIR1bits.TMR2IF);
asm("NOP");
asm("NOP");
T2CONbits.TMR2ON = 0;
TMR2 = 0x0;
}
/PIC Projects/PICX_12F1840_Clock/NEOPIXEL.h
0,0 → 1,34
#ifndef NEOPIXEL_H
#define NEOPIXEL_H
 
#define NEOPIXEL_LENGTH 60
 
#define NEOPIXEL_LOGIC_1 0b00000110
#define NEOPIXEL_LOGIC_0 0b00000011
 
// Color Definitions (base of 16 levels)
#define CLEAR 0x00,0x00,0x00
#define RED 0x10,0x00,0x00
#define ORANGE 0x08,0x02,0x00
#define YELLOW 0x08,0x08,0x00
#define GREEN 0x00,0x10,0x00
#define TEAL 0x00,0x08,0x04
#define BLUE 0x00,0x00,0x10
#define PURPLE 0x08,0x00,0x08
#define WHITE 0x08,0x08,0x08
 
typedef struct {
uint8_t values[NEOPIXEL_LENGTH * 3];
uint8_t offset;
} NEOPIXEL_DATA;
 
void NeoPixel_Init(void);
void NeoPixel_Offet(uint8_t value);
void NeoPixel_Clear(void);
void NeoPixel_Set(uint8_t index, uint8_t R, uint8_t G, uint8_t B, uint8_t multiplier);
void NeoPixel_Or(uint8_t index, uint8_t R, uint8_t G, uint8_t B, uint8_t multiplier);
void NeoPixel_Write_All(void);
void NeoPixel_Write_One(uint8_t value);
 
#endif /* NEOPIXEL_H */
 
/PIC Projects/PICX_12F1840_Clock/TSL2561.c
0,0 → 1,216
#include "defines.h"
#include "I2C1.h"
#include "TSL2561.h"
 
extern TSL2561_DATA tsl2561_data;
 
void TSL2561_Init(uint8_t address) {
tsl2561_data.address = address;
tsl2561_data.integration = TSL2561_INTEGRATIONTIME_13MS;
tsl2561_data.gain = TSL2561_GAIN_16X;
 
uint8_t buffer[1];
I2C1_Master_Restart(tsl2561_data.address, TSL2561_REGISTER_ID, 1);
while (!I2C1_Get_Status());
I2C1_Read_Buffer(buffer);
 
// Set default integration time and gain
TSL2561_Set_Timing(tsl2561_data.integration);
TSL2561_Set_Gain(tsl2561_data.gain);
 
// Start the chip in power-down mode
TSL2561_Disable();
}
 
void TSL2561_Enable() {
TSL2561_Write_2_Bytes(TSL2561_COMMAND_BIT | TSL2561_REGISTER_CONTROL, TSL2561_CONTROL_POWERON);
}
 
void TSL2561_Disable() {
TSL2561_Write_2_Bytes(TSL2561_COMMAND_BIT | TSL2561_REGISTER_CONTROL, TSL2561_CONTROL_POWEROFF);
}
 
void TSL2561_Set_Gain(tsl2561Gain_t gain) {
TSL2561_Enable();
tsl2561_data.gain = gain;
TSL2561_Write_2_Bytes(TSL2561_COMMAND_BIT | TSL2561_REGISTER_TIMING,
tsl2561_data.integration | tsl2561_data.gain);
TSL2561_Disable();
}
 
void TSL2561_Set_Timing(tsl2561IntegrationTime_t integration) {
TSL2561_Enable();
tsl2561_data.integration = integration;
TSL2561_Write_2_Bytes(TSL2561_COMMAND_BIT | TSL2561_REGISTER_TIMING,
tsl2561_data.integration | tsl2561_data.gain);
TSL2561_Disable();
}
 
uint32_t TSL2561_Calculate_Lux(uint16_t ch0, uint16_t ch1) {
uint32_t chScale, channel0, channel1, ratio1, ratio, temp, lux;
uint16_t b, m;
 
switch (tsl2561_data.integration) {
case TSL2561_INTEGRATIONTIME_13MS:
chScale = TSL2561_LUX_CHSCALE_TINT0;
break;
case TSL2561_INTEGRATIONTIME_101MS:
chScale = TSL2561_LUX_CHSCALE_TINT1;
break;
default: // No scaling ... integration time = 402ms
chScale = (1 << TSL2561_LUX_CHSCALE);
break;
}
 
// Scale for gain (1x or 16x)
if (!tsl2561_data.gain)
chScale = chScale << 4;
 
// scale the channel values
channel0 = (ch0 * chScale) >> TSL2561_LUX_CHSCALE;
channel1 = (ch1 * chScale) >> TSL2561_LUX_CHSCALE;
 
// find the ratio of the channel values (Channel1/Channel0)
ratio1 = 0;
if (channel0 != 0)
ratio1 = (channel1 << (TSL2561_LUX_RATIOSCALE+1)) / channel0;
 
// round the ratio value
ratio = (ratio1 + 1) >> 1;
 
#ifdef TSL2561_PACKAGE_CS
if ((ratio >= 0) && (ratio <= TSL2561_LUX_K1C)) {
b = TSL2561_LUX_B1C; m = TSL2561_LUX_M1C;
} else if (ratio <= TSL2561_LUX_K2C) {
b = TSL2561_LUX_B2C; m = TSL2561_LUX_M2C;
} else if (ratio <= TSL2561_LUX_K3C) {
b = TSL2561_LUX_B3C; m = TSL2561_LUX_M3C;
} else if (ratio <= TSL2561_LUX_K4C) {
b = TSL2561_LUX_B4C; m = TSL2561_LUX_M4C;
} else if (ratio <= TSL2561_LUX_K5C) {
b = TSL2561_LUX_B5C; m = TSL2561_LUX_M5C;
} else if (ratio <= TSL2561_LUX_K6C) {
b = TSL2561_LUX_B6C; m = TSL2561_LUX_M6C;
} else if (ratio <= TSL2561_LUX_K7C) {
b = TSL2561_LUX_B7C; m = TSL2561_LUX_M7C;
} else if (ratio > TSL2561_LUX_K8C) {
b = TSL2561_LUX_B8C; m = TSL2561_LUX_M8C;
}
#else
// if ((ratio >= 0) && (ratio <= TSL2561_LUX_K1T)) {
if ((ratio <= TSL2561_LUX_K1T)) {
b = TSL2561_LUX_B1T; m = TSL2561_LUX_M1T;
} else if (ratio <= TSL2561_LUX_K2T) {
b = TSL2561_LUX_B2T; m = TSL2561_LUX_M2T;
} else if (ratio <= TSL2561_LUX_K3T) {
b = TSL2561_LUX_B3T; m = TSL2561_LUX_M3T;
} else if (ratio <= TSL2561_LUX_K4T) {
b = TSL2561_LUX_B4T; m = TSL2561_LUX_M4T;
} else if (ratio <= TSL2561_LUX_K5T) {
b = TSL2561_LUX_B5T; m = TSL2561_LUX_M5T;
} else if (ratio <= TSL2561_LUX_K6T) {
b = TSL2561_LUX_B6T; m = TSL2561_LUX_M6T;
} else if (ratio <= TSL2561_LUX_K7T) {
b = TSL2561_LUX_B7T; m = TSL2561_LUX_M7T;
} else if (ratio > TSL2561_LUX_K8T) {
b = TSL2561_LUX_B8T; m = TSL2561_LUX_M8T;
}
#endif
// temp = ((channel0 * b) - (channel1 * m));
// TODO: Change this back once they fix compiler
temp = (channel0 * b);
temp -= (channel1 * m);
 
// // do not allow negative lux value
// if (temp < 0)
// temp = 0;
 
// round lsb (2^(LUX_SCALE-1))
temp += (1 << (TSL2561_LUX_LUXSCALE-1));
 
// strip off fractional portion
lux = temp >> TSL2561_LUX_LUXSCALE;
 
return lux;
}
 
uint32_t TSL2561_Get_Full_Luminosity() {
uint32_t x;
 
// Enable the device by setting the control bit to 0x03
TSL2561_Enable();
 
// Wait x ms for ADC to complete
switch (tsl2561_data.integration) {
case TSL2561_INTEGRATIONTIME_13MS:
__delay_ms(15);
break;
case TSL2561_INTEGRATIONTIME_101MS:
__delay_ms(105);
break;
default:
__delay_ms(405);
break;
}
 
x = TSL2561_Read_2_Bytes(TSL2561_COMMAND_BIT | TSL2561_WORD_BIT | TSL2561_REGISTER_CHAN1_LOW);
x <<= 16;
x |= TSL2561_Read_2_Bytes(TSL2561_COMMAND_BIT | TSL2561_WORD_BIT | TSL2561_REGISTER_CHAN0_LOW);
 
TSL2561_Disable();
 
return x;
}
 
uint16_t TSL2561_Get_Luminosity(uint8_t channel) {
// Enable the device by setting the control bit to 0x03
TSL2561_Enable();
 
// Wait x ms for ADC to complete
switch (tsl2561_data.integration) {
case TSL2561_INTEGRATIONTIME_13MS:
__delay_ms(15);
break;
case TSL2561_INTEGRATIONTIME_101MS:
__delay_ms(105);
break;
default:
__delay_ms(405);
break;
}
 
if (channel == 0) {
// Reads two byte value from channel 0 (visible + infrared)
return TSL2561_Read_2_Bytes(TSL2561_COMMAND_BIT | TSL2561_WORD_BIT | TSL2561_REGISTER_CHAN0_LOW);
} else if (channel == 1) {
// Reads two byte value from channel 1 (infrared)
return TSL2561_Read_2_Bytes(TSL2561_COMMAND_BIT | TSL2561_WORD_BIT | TSL2561_REGISTER_CHAN1_LOW);
}
 
TSL2561_Disable();
 
// Unknown channel!
return 0;
}
 
void TSL2561_Write_2_Bytes(uint8_t reg, uint8_t value) {
uint8_t buffer[2];
buffer[0] = reg;
buffer[1] = value;
I2C1_Master_Send(tsl2561_data.address, 2, buffer);
while (!I2C1_Get_Status());
}
 
uint16_t TSL2561_Read_2_Bytes(uint8_t reg) {
uint8_t buffer[2];
uint16_t ret;
 
I2C1_Master_Restart(tsl2561_data.address, reg, 2);
while (!I2C1_Get_Status());
I2C1_Read_Buffer(buffer);
ret = buffer[1] << 8;
ret |= buffer[0];
 
return ret;
}
/PIC Projects/PICX_12F1840_Clock/funclist
0,0 → 1,35
___awdiv: CODE, 1571 0 84
_DS3231_Init: CODE, 4000 0 29
_I2C1_Init: CODE, 3834 0 18
_I2C1_Read_Buffer: CODE, 4058 0 38
_TSL2561_Set_Timing: CODE, 3874 0 22
_I2C1_Master_Restart: CODE, 1930 0 45
___awmod: CODE, 1655 0 72
_TSL2561_Disable: CODE, 3751 0 6
_main: CODE, 19 0 394
_Interrupt_Enable: CODE, 3748 0 3
_InterruptHandler: CODE, 4 0 13
_TSL2561_Write_2_Bytes: CODE, 4029 0 29
__initialization: CODE, 3919 0 21
_DS3231_Get_Status: CODE, 3896 0 23
___lwdiv: CODE, 1727 0 55
_I2C1_Configure_Master: CODE, 3971 0 29
_TSL2561_Read_2_Bytes: CODE, 1882 0 48
_NeoPixel_Or: CODE, 1066 0 158
_DS3231_Get_Time: CODE, 1224 0 155
_NeoPixel_Set: CODE, 804 0 262
_I2C1_Master_Send: CODE, 1782 0 50
_I2C1_Interrupt_Handler: CODE, 413 0 391
_NeoPixel_Init: CODE, 1832 0 50
_TSL2561_Init: CODE, 1975 0 44
_NeoPixel_Clear: CODE, 3817 0 17
_TSL2561_Set_Gain: CODE, 3852 0 22
_NeoPixel_Offet: CODE, 3766 0 10
_NeoPixel_Write_One: CODE, 1379 0 101
_I2C1_Get_Status: CODE, 3776 0 12
___wmul: CODE, 2019 0 29
_NeoPixel_Write_All: CODE, 3943 0 28
_TSL2561_Get_Luminosity: CODE, 1480 0 91
___bmul: CODE, 3800 0 17
_TSL2561_Enable: CODE, 3757 0 9
Total: 2375
/PIC Projects/PICX_12F1840_Clock/l.obj
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/PIC Projects/PICX_12F1840_Clock/l.obj
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/PIC Projects/PICX_12F1840_Clock/main.c
0,0 → 1,114
#include "defines.h"
#include "INTERRUPTS.h"
#include "I2C1.h"
#include "NEOPIXEL.h"
#include "DS3231.h"
#include "TSL2561.h"
 
// <editor-fold defaultstate="collapsed" desc="Configuration Registers">
/* Config Register CONFIGL @ 0x8007 */
#pragma config CPD = OFF // Data memory code protection is disabled
#pragma config BOREN = OFF // Brown-out Reset disabled
#pragma config IESO = OFF // Internal/External Switchover mode is disabled
#pragma config FOSC = INTOSC // INTOSC oscillator: I/O function on CLKIN pin
#pragma config FCMEN = OFF // Fail-Safe Clock Monitor is disabled
#pragma config MCLRE = ON // MCLR/VPP pin function is MCLR
#pragma config WDTE = OFF // WDT disabled
#pragma config CP = OFF // Program memory code protection is disabled
#pragma config PWRTE = ON // PWRT enabled
#pragma config CLKOUTEN = OFF // CLKOUT function is disabled. I/O or oscillator function on the CLKOUT pin
 
/* Config Register CONFIG2 @ 0x8008 */
#pragma config PLLEN = ON // 4x PLL disabled
#pragma config WRT = OFF // Write protection off
#pragma config STVREN = OFF // Stack Overflow or Underflow will not cause a Reset
#pragma config BORV = HI // Brown-out Reset Voltage (Vbor), high trip point selected.
#pragma config LVP = OFF // High-voltage on MCLR/VPP must be used for programming
// </editor-fold>
 
I2C1_DATA i2c_data;
NEOPIXEL_DATA neopixel_data;
TSL2561_DATA tsl2561_data;
DS3231_TIME time;
 
int main() {
// Oscillator configuration (32Mhz HFINTOSC)
OSCCONbits.SCS = 0b00;
OSCCONbits.IRCF = 0b1110;
ANSELA = 0x00; // All pins set to digital I/O
APFCONbits.CCP1SEL = 1; // Switch CCP1 from RA2 to RA5
WPUA = 0x00; // Disable weak pull-ups
 
// Wait for HFINTOSC to be within 0.5% of target 32Mhz
while (!OSCSTATbits.HFIOFS);
 
Interrupt_Enable();
 
I2C1_Init();
I2C1_Configure_Master(I2C_1MHZ);
 
NeoPixel_Init();
NeoPixel_Offet(30);
 
DS3231_Init();
 
TSL2561_Init(TSL2561_ADDR_FLOAT);
 
// You can change the gain on the fly, to adapt to brighter/dimmer light situations
// TSL2561_Set_Gain(TSL2561_GAIN_0X); // set no gain (for bright situtations)
TSL2561_Set_Gain(TSL2561_GAIN_16X); // set 16x gain (for dim situations)
 
// Changing the integration time gives you a longer time over which to sense light
// longer timelines are slower, but are good in very low light situtations!
// TSL2561_Set_Timing(TSL2561_INTEGRATIONTIME_13MS); // shortest integration time (bright light)
TSL2561_Set_Timing(TSL2561_INTEGRATIONTIME_101MS); // medium integration time (medium light)
// TSL2561_Set_Timing(TSL2561_INTEGRATIONTIME_402MS); // longest integration time (dim light)
 
uint16_t full;
uint8_t multiplier, multiplier_2;
 
// time.sec = 0;
// time.min = 16;
// time.hour = 7;
// time.h_mil = 0;
// time.h_am_pm = 1;
//
// DS3231_Set_Time(&time);
 
while(1) {
// ~37200 seems to be the max value at 16X gain, 101ms period
full = TSL2561_Get_Luminosity(0);
multiplier = (full / 3100) + 1; // 12 levels (1-12)
multiplier_2 = (multiplier / 7) + 1; // 2 levels (1-2)
 
// NeoPixel_Clear();
// for (uint8_t i = 0; i < multiplier; i++) {
// NeoPixel_Set(i, 0x10, 0x00, 0x00, 1);
// }
// NeoPixel_Write_All();
 
DS3231_Get_Time(&time);
NeoPixel_Clear();
 
// Draw markers
NeoPixel_Set(00, RED, multiplier_2);
NeoPixel_Set(30, RED, multiplier_2);
NeoPixel_Set(05, ORANGE, multiplier_2);
NeoPixel_Set(35, ORANGE, multiplier_2);
NeoPixel_Set(10, YELLOW, multiplier_2);
NeoPixel_Set(40, YELLOW, multiplier_2);
NeoPixel_Set(15, GREEN, multiplier_2);
NeoPixel_Set(45, GREEN, multiplier_2);
NeoPixel_Set(20, BLUE, multiplier_2);
NeoPixel_Set(50, BLUE, multiplier_2);
NeoPixel_Set(25, PURPLE, multiplier_2);
NeoPixel_Set(55, PURPLE, multiplier_2);
 
// Draw time
NeoPixel_Or((time.hour * 5) % 60, BLUE, multiplier + 4);
NeoPixel_Or(time.min, GREEN, multiplier + 4);
NeoPixel_Or(time.sec, RED, multiplier + 4);
NeoPixel_Write_All();
}
}
/PIC Projects/PICX_12F1840_Clock/nbproject/Makefile-genesis.properties
0,0 → 1,8
#
#Sun Mar 30 17:07:11 EDT 2014
default.languagetoolchain.dir=C\:\\Program Files (x86)\\Microchip\\xc8\\v1.20\\bin
com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=1f98a0eed69cb2a45c12981fa9470927
default.languagetoolchain.version=1.20
host.platform=windows
conf.ids=default
default.com-microchip-mplab-nbide-toolchainXC8-XC8LanguageToolchain.md5=52258db7536b2d1fec300cefc7ed9230
/PIC Projects/PICX_12F1840_Clock/nbproject/Makefile-default.mk
0,0 → 1,220
#
# Generated Makefile - do not edit!
#
# Edit the Makefile in the project folder instead (../Makefile). Each target
# has a -pre and a -post target defined where you can add customized code.
#
# This makefile implements configuration specific macros and targets.
 
 
# Include project Makefile
ifeq "${IGNORE_LOCAL}" "TRUE"
# do not include local makefile. User is passing all local related variables already
else
include Makefile
# Include makefile containing local settings
ifeq "$(wildcard nbproject/Makefile-local-default.mk)" "nbproject/Makefile-local-default.mk"
include nbproject/Makefile-local-default.mk
endif
endif
 
# Environment
MKDIR=gnumkdir -p
RM=rm -f
MV=mv
CP=cp
 
# Macros
CND_CONF=default
ifeq ($(TYPE_IMAGE), DEBUG_RUN)
IMAGE_TYPE=debug
OUTPUT_SUFFIX=elf
DEBUGGABLE_SUFFIX=elf
FINAL_IMAGE=dist/${CND_CONF}/${IMAGE_TYPE}/PICX_12F1840_Clock.${IMAGE_TYPE}.${OUTPUT_SUFFIX}
else
IMAGE_TYPE=production
OUTPUT_SUFFIX=hex
DEBUGGABLE_SUFFIX=elf
FINAL_IMAGE=dist/${CND_CONF}/${IMAGE_TYPE}/PICX_12F1840_Clock.${IMAGE_TYPE}.${OUTPUT_SUFFIX}
endif
 
# Object Directory
OBJECTDIR=build/${CND_CONF}/${IMAGE_TYPE}
 
# Distribution Directory
DISTDIR=dist/${CND_CONF}/${IMAGE_TYPE}
 
# Source Files Quoted if spaced
SOURCEFILES_QUOTED_IF_SPACED=main.c NEOPIXEL.c INTERRUPTS.c I2C1.c DS3231.c TSL2561.c
 
# Object Files Quoted if spaced
OBJECTFILES_QUOTED_IF_SPACED=${OBJECTDIR}/main.p1 ${OBJECTDIR}/NEOPIXEL.p1 ${OBJECTDIR}/INTERRUPTS.p1 ${OBJECTDIR}/I2C1.p1 ${OBJECTDIR}/DS3231.p1 ${OBJECTDIR}/TSL2561.p1
POSSIBLE_DEPFILES=${OBJECTDIR}/main.p1.d ${OBJECTDIR}/NEOPIXEL.p1.d ${OBJECTDIR}/INTERRUPTS.p1.d ${OBJECTDIR}/I2C1.p1.d ${OBJECTDIR}/DS3231.p1.d ${OBJECTDIR}/TSL2561.p1.d
 
# Object Files
OBJECTFILES=${OBJECTDIR}/main.p1 ${OBJECTDIR}/NEOPIXEL.p1 ${OBJECTDIR}/INTERRUPTS.p1 ${OBJECTDIR}/I2C1.p1 ${OBJECTDIR}/DS3231.p1 ${OBJECTDIR}/TSL2561.p1
 
# Source Files
SOURCEFILES=main.c NEOPIXEL.c INTERRUPTS.c I2C1.c DS3231.c TSL2561.c
 
 
CFLAGS=
ASFLAGS=
LDLIBSOPTIONS=
 
############# Tool locations ##########################################
# If you copy a project from one host to another, the path where the #
# compiler is installed may be different. #
# If you open this project with MPLAB X in the new host, this #
# makefile will be regenerated and the paths will be corrected. #
#######################################################################
# fixDeps replaces a bunch of sed/cat/printf statements that slow down the build
FIXDEPS=fixDeps
 
.build-conf: ${BUILD_SUBPROJECTS}
${MAKE} ${MAKE_OPTIONS} -f nbproject/Makefile-default.mk dist/${CND_CONF}/${IMAGE_TYPE}/PICX_12F1840_Clock.${IMAGE_TYPE}.${OUTPUT_SUFFIX}
 
MP_PROCESSOR_OPTION=12F1840
# ------------------------------------------------------------------------------------
# Rules for buildStep: compile
ifeq ($(TYPE_IMAGE), DEBUG_RUN)
${OBJECTDIR}/main.p1: main.c nbproject/Makefile-${CND_CONF}.mk
@${MKDIR} ${OBJECTDIR}
@${RM} ${OBJECTDIR}/main.p1.d
@${RM} ${OBJECTDIR}/main.p1
${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G -D__DEBUG=1 --debugger=pickit3 --double=24 --float=24 --opt=default,+asm,+asmfile,+speed,-space,-debug --addrqual=ignore --mode=free -P -N255 --warn=0 --asmlist --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,+osccal,-resetbits,-download,-stackcall,+clib --output=-mcof,+elf "--errformat=%%f:%%l: error: (%%n) %%s" "--warnformat=%%f:%%l: warning: (%%n) %%s" "--msgformat=%%f:%%l: advisory: (%%n) %%s" -o${OBJECTDIR}/main.p1 main.c
@-${MV} ${OBJECTDIR}/main.d ${OBJECTDIR}/main.p1.d
@${FIXDEPS} ${OBJECTDIR}/main.p1.d $(SILENT) -rsi ${MP_CC_DIR}../
${OBJECTDIR}/NEOPIXEL.p1: NEOPIXEL.c nbproject/Makefile-${CND_CONF}.mk
@${MKDIR} ${OBJECTDIR}
@${RM} ${OBJECTDIR}/NEOPIXEL.p1.d
@${RM} ${OBJECTDIR}/NEOPIXEL.p1
${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G -D__DEBUG=1 --debugger=pickit3 --double=24 --float=24 --opt=default,+asm,+asmfile,+speed,-space,-debug --addrqual=ignore --mode=free -P -N255 --warn=0 --asmlist --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,+osccal,-resetbits,-download,-stackcall,+clib --output=-mcof,+elf "--errformat=%%f:%%l: error: (%%n) %%s" "--warnformat=%%f:%%l: warning: (%%n) %%s" "--msgformat=%%f:%%l: advisory: (%%n) %%s" -o${OBJECTDIR}/NEOPIXEL.p1 NEOPIXEL.c
@-${MV} ${OBJECTDIR}/NEOPIXEL.d ${OBJECTDIR}/NEOPIXEL.p1.d
@${FIXDEPS} ${OBJECTDIR}/NEOPIXEL.p1.d $(SILENT) -rsi ${MP_CC_DIR}../
${OBJECTDIR}/INTERRUPTS.p1: INTERRUPTS.c nbproject/Makefile-${CND_CONF}.mk
@${MKDIR} ${OBJECTDIR}
@${RM} ${OBJECTDIR}/INTERRUPTS.p1.d
@${RM} ${OBJECTDIR}/INTERRUPTS.p1
${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G -D__DEBUG=1 --debugger=pickit3 --double=24 --float=24 --opt=default,+asm,+asmfile,+speed,-space,-debug --addrqual=ignore --mode=free -P -N255 --warn=0 --asmlist --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,+osccal,-resetbits,-download,-stackcall,+clib --output=-mcof,+elf "--errformat=%%f:%%l: error: (%%n) %%s" "--warnformat=%%f:%%l: warning: (%%n) %%s" "--msgformat=%%f:%%l: advisory: (%%n) %%s" -o${OBJECTDIR}/INTERRUPTS.p1 INTERRUPTS.c
@-${MV} ${OBJECTDIR}/INTERRUPTS.d ${OBJECTDIR}/INTERRUPTS.p1.d
@${FIXDEPS} ${OBJECTDIR}/INTERRUPTS.p1.d $(SILENT) -rsi ${MP_CC_DIR}../
${OBJECTDIR}/I2C1.p1: I2C1.c nbproject/Makefile-${CND_CONF}.mk
@${MKDIR} ${OBJECTDIR}
@${RM} ${OBJECTDIR}/I2C1.p1.d
@${RM} ${OBJECTDIR}/I2C1.p1
${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G -D__DEBUG=1 --debugger=pickit3 --double=24 --float=24 --opt=default,+asm,+asmfile,+speed,-space,-debug --addrqual=ignore --mode=free -P -N255 --warn=0 --asmlist --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,+osccal,-resetbits,-download,-stackcall,+clib --output=-mcof,+elf "--errformat=%%f:%%l: error: (%%n) %%s" "--warnformat=%%f:%%l: warning: (%%n) %%s" "--msgformat=%%f:%%l: advisory: (%%n) %%s" -o${OBJECTDIR}/I2C1.p1 I2C1.c
@-${MV} ${OBJECTDIR}/I2C1.d ${OBJECTDIR}/I2C1.p1.d
@${FIXDEPS} ${OBJECTDIR}/I2C1.p1.d $(SILENT) -rsi ${MP_CC_DIR}../
${OBJECTDIR}/DS3231.p1: DS3231.c nbproject/Makefile-${CND_CONF}.mk
@${MKDIR} ${OBJECTDIR}
@${RM} ${OBJECTDIR}/DS3231.p1.d
@${RM} ${OBJECTDIR}/DS3231.p1
${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G -D__DEBUG=1 --debugger=pickit3 --double=24 --float=24 --opt=default,+asm,+asmfile,+speed,-space,-debug --addrqual=ignore --mode=free -P -N255 --warn=0 --asmlist --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,+osccal,-resetbits,-download,-stackcall,+clib --output=-mcof,+elf "--errformat=%%f:%%l: error: (%%n) %%s" "--warnformat=%%f:%%l: warning: (%%n) %%s" "--msgformat=%%f:%%l: advisory: (%%n) %%s" -o${OBJECTDIR}/DS3231.p1 DS3231.c
@-${MV} ${OBJECTDIR}/DS3231.d ${OBJECTDIR}/DS3231.p1.d
@${FIXDEPS} ${OBJECTDIR}/DS3231.p1.d $(SILENT) -rsi ${MP_CC_DIR}../
${OBJECTDIR}/TSL2561.p1: TSL2561.c nbproject/Makefile-${CND_CONF}.mk
@${MKDIR} ${OBJECTDIR}
@${RM} ${OBJECTDIR}/TSL2561.p1.d
@${RM} ${OBJECTDIR}/TSL2561.p1
${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G -D__DEBUG=1 --debugger=pickit3 --double=24 --float=24 --opt=default,+asm,+asmfile,+speed,-space,-debug --addrqual=ignore --mode=free -P -N255 --warn=0 --asmlist --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,+osccal,-resetbits,-download,-stackcall,+clib --output=-mcof,+elf "--errformat=%%f:%%l: error: (%%n) %%s" "--warnformat=%%f:%%l: warning: (%%n) %%s" "--msgformat=%%f:%%l: advisory: (%%n) %%s" -o${OBJECTDIR}/TSL2561.p1 TSL2561.c
@-${MV} ${OBJECTDIR}/TSL2561.d ${OBJECTDIR}/TSL2561.p1.d
@${FIXDEPS} ${OBJECTDIR}/TSL2561.p1.d $(SILENT) -rsi ${MP_CC_DIR}../
else
${OBJECTDIR}/main.p1: main.c nbproject/Makefile-${CND_CONF}.mk
@${MKDIR} ${OBJECTDIR}
@${RM} ${OBJECTDIR}/main.p1.d
@${RM} ${OBJECTDIR}/main.p1
${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G --double=24 --float=24 --opt=default,+asm,+asmfile,+speed,-space,-debug --addrqual=ignore --mode=free -P -N255 --warn=0 --asmlist --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,+osccal,-resetbits,-download,-stackcall,+clib --output=-mcof,+elf "--errformat=%%f:%%l: error: (%%n) %%s" "--warnformat=%%f:%%l: warning: (%%n) %%s" "--msgformat=%%f:%%l: advisory: (%%n) %%s" -o${OBJECTDIR}/main.p1 main.c
@-${MV} ${OBJECTDIR}/main.d ${OBJECTDIR}/main.p1.d
@${FIXDEPS} ${OBJECTDIR}/main.p1.d $(SILENT) -rsi ${MP_CC_DIR}../
${OBJECTDIR}/NEOPIXEL.p1: NEOPIXEL.c nbproject/Makefile-${CND_CONF}.mk
@${MKDIR} ${OBJECTDIR}
@${RM} ${OBJECTDIR}/NEOPIXEL.p1.d
@${RM} ${OBJECTDIR}/NEOPIXEL.p1
${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G --double=24 --float=24 --opt=default,+asm,+asmfile,+speed,-space,-debug --addrqual=ignore --mode=free -P -N255 --warn=0 --asmlist --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,+osccal,-resetbits,-download,-stackcall,+clib --output=-mcof,+elf "--errformat=%%f:%%l: error: (%%n) %%s" "--warnformat=%%f:%%l: warning: (%%n) %%s" "--msgformat=%%f:%%l: advisory: (%%n) %%s" -o${OBJECTDIR}/NEOPIXEL.p1 NEOPIXEL.c
@-${MV} ${OBJECTDIR}/NEOPIXEL.d ${OBJECTDIR}/NEOPIXEL.p1.d
@${FIXDEPS} ${OBJECTDIR}/NEOPIXEL.p1.d $(SILENT) -rsi ${MP_CC_DIR}../
${OBJECTDIR}/INTERRUPTS.p1: INTERRUPTS.c nbproject/Makefile-${CND_CONF}.mk
@${MKDIR} ${OBJECTDIR}
@${RM} ${OBJECTDIR}/INTERRUPTS.p1.d
@${RM} ${OBJECTDIR}/INTERRUPTS.p1
${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G --double=24 --float=24 --opt=default,+asm,+asmfile,+speed,-space,-debug --addrqual=ignore --mode=free -P -N255 --warn=0 --asmlist --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,+osccal,-resetbits,-download,-stackcall,+clib --output=-mcof,+elf "--errformat=%%f:%%l: error: (%%n) %%s" "--warnformat=%%f:%%l: warning: (%%n) %%s" "--msgformat=%%f:%%l: advisory: (%%n) %%s" -o${OBJECTDIR}/INTERRUPTS.p1 INTERRUPTS.c
@-${MV} ${OBJECTDIR}/INTERRUPTS.d ${OBJECTDIR}/INTERRUPTS.p1.d
@${FIXDEPS} ${OBJECTDIR}/INTERRUPTS.p1.d $(SILENT) -rsi ${MP_CC_DIR}../
${OBJECTDIR}/I2C1.p1: I2C1.c nbproject/Makefile-${CND_CONF}.mk
@${MKDIR} ${OBJECTDIR}
@${RM} ${OBJECTDIR}/I2C1.p1.d
@${RM} ${OBJECTDIR}/I2C1.p1
${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G --double=24 --float=24 --opt=default,+asm,+asmfile,+speed,-space,-debug --addrqual=ignore --mode=free -P -N255 --warn=0 --asmlist --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,+osccal,-resetbits,-download,-stackcall,+clib --output=-mcof,+elf "--errformat=%%f:%%l: error: (%%n) %%s" "--warnformat=%%f:%%l: warning: (%%n) %%s" "--msgformat=%%f:%%l: advisory: (%%n) %%s" -o${OBJECTDIR}/I2C1.p1 I2C1.c
@-${MV} ${OBJECTDIR}/I2C1.d ${OBJECTDIR}/I2C1.p1.d
@${FIXDEPS} ${OBJECTDIR}/I2C1.p1.d $(SILENT) -rsi ${MP_CC_DIR}../
${OBJECTDIR}/DS3231.p1: DS3231.c nbproject/Makefile-${CND_CONF}.mk
@${MKDIR} ${OBJECTDIR}
@${RM} ${OBJECTDIR}/DS3231.p1.d
@${RM} ${OBJECTDIR}/DS3231.p1
${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G --double=24 --float=24 --opt=default,+asm,+asmfile,+speed,-space,-debug --addrqual=ignore --mode=free -P -N255 --warn=0 --asmlist --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,+osccal,-resetbits,-download,-stackcall,+clib --output=-mcof,+elf "--errformat=%%f:%%l: error: (%%n) %%s" "--warnformat=%%f:%%l: warning: (%%n) %%s" "--msgformat=%%f:%%l: advisory: (%%n) %%s" -o${OBJECTDIR}/DS3231.p1 DS3231.c
@-${MV} ${OBJECTDIR}/DS3231.d ${OBJECTDIR}/DS3231.p1.d
@${FIXDEPS} ${OBJECTDIR}/DS3231.p1.d $(SILENT) -rsi ${MP_CC_DIR}../
${OBJECTDIR}/TSL2561.p1: TSL2561.c nbproject/Makefile-${CND_CONF}.mk
@${MKDIR} ${OBJECTDIR}
@${RM} ${OBJECTDIR}/TSL2561.p1.d
@${RM} ${OBJECTDIR}/TSL2561.p1
${MP_CC} --pass1 $(MP_EXTRA_CC_PRE) --chip=$(MP_PROCESSOR_OPTION) -Q -G --double=24 --float=24 --opt=default,+asm,+asmfile,+speed,-space,-debug --addrqual=ignore --mode=free -P -N255 --warn=0 --asmlist --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,+osccal,-resetbits,-download,-stackcall,+clib --output=-mcof,+elf "--errformat=%%f:%%l: error: (%%n) %%s" "--warnformat=%%f:%%l: warning: (%%n) %%s" "--msgformat=%%f:%%l: advisory: (%%n) %%s" -o${OBJECTDIR}/TSL2561.p1 TSL2561.c
@-${MV} ${OBJECTDIR}/TSL2561.d ${OBJECTDIR}/TSL2561.p1.d
@${FIXDEPS} ${OBJECTDIR}/TSL2561.p1.d $(SILENT) -rsi ${MP_CC_DIR}../
endif
 
# ------------------------------------------------------------------------------------
# Rules for buildStep: assemble
ifeq ($(TYPE_IMAGE), DEBUG_RUN)
else
endif
 
# ------------------------------------------------------------------------------------
# Rules for buildStep: link
ifeq ($(TYPE_IMAGE), DEBUG_RUN)
dist/${CND_CONF}/${IMAGE_TYPE}/PICX_12F1840_Clock.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk
@${MKDIR} dist/${CND_CONF}/${IMAGE_TYPE}
${MP_CC} $(MP_EXTRA_LD_PRE) --chip=$(MP_PROCESSOR_OPTION) -G -mdist/${CND_CONF}/${IMAGE_TYPE}/PICX_12F1840_Clock.${IMAGE_TYPE}.map -D__DEBUG=1 --debugger=pickit3 --double=24 --float=24 --opt=default,+asm,+asmfile,+speed,-space,-debug --addrqual=ignore --mode=free -P -N255 --warn=0 --asmlist --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,+osccal,-resetbits,-download,-stackcall,+clib --output=-mcof,+elf "--errformat=%%f:%%l: error: %%s" "--warnformat=%%f:%%l: warning: (%%n) %%s" "--msgformat=%%f:%%l: advisory: (%%n) %%s" --ram=default,-160-16f -odist/${CND_CONF}/${IMAGE_TYPE}/PICX_12F1840_Clock.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED}
@${RM} dist/${CND_CONF}/${IMAGE_TYPE}/PICX_12F1840_Clock.${IMAGE_TYPE}.hex
else
dist/${CND_CONF}/${IMAGE_TYPE}/PICX_12F1840_Clock.${IMAGE_TYPE}.${OUTPUT_SUFFIX}: ${OBJECTFILES} nbproject/Makefile-${CND_CONF}.mk
@${MKDIR} dist/${CND_CONF}/${IMAGE_TYPE}
${MP_CC} $(MP_EXTRA_LD_PRE) --chip=$(MP_PROCESSOR_OPTION) -G -mdist/${CND_CONF}/${IMAGE_TYPE}/PICX_12F1840_Clock.${IMAGE_TYPE}.map --double=24 --float=24 --opt=default,+asm,+asmfile,+speed,-space,-debug --addrqual=ignore --mode=free -P -N255 --warn=0 --asmlist --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,+osccal,-resetbits,-download,-stackcall,+clib --output=-mcof,+elf "--errformat=%%f:%%l: error: %%s" "--warnformat=%%f:%%l: warning: (%%n) %%s" "--msgformat=%%f:%%l: advisory: (%%n) %%s" -odist/${CND_CONF}/${IMAGE_TYPE}/PICX_12F1840_Clock.${IMAGE_TYPE}.${DEBUGGABLE_SUFFIX} ${OBJECTFILES_QUOTED_IF_SPACED}
endif
 
 
# Subprojects
.build-subprojects:
 
 
# Subprojects
.clean-subprojects:
 
# Clean Targets
.clean-conf: ${CLEAN_SUBPROJECTS}
${RM} -r build/default
${RM} -r dist/default
 
# Enable dependency checking
.dep.inc: .depcheck-impl
 
DEPFILES=$(shell mplabwildcard ${POSSIBLE_DEPFILES})
ifneq (${DEPFILES},)
include ${DEPFILES}
endif
/PIC Projects/PICX_12F1840_Clock/nbproject/configurations.xml
0,0 → 1,169
<?xml version="1.0" encoding="UTF-8"?>
<configurationDescriptor version="62">
<logicalFolder name="root" displayName="root" projectFiles="true">
<logicalFolder name="HeaderFiles"
displayName="Header Files"
projectFiles="true">
<itemPath>defines.h</itemPath>
<itemPath>NEOPIXEL.h</itemPath>
<itemPath>INTERRUPTS.h</itemPath>
<itemPath>I2C1.h</itemPath>
<itemPath>DS3231.h</itemPath>
<itemPath>TSL2561.h</itemPath>
</logicalFolder>
<logicalFolder name="LinkerScript"
displayName="Linker Files"
projectFiles="true">
</logicalFolder>
<logicalFolder name="SourceFiles"
displayName="Source Files"
projectFiles="true">
<itemPath>main.c</itemPath>
<itemPath>NEOPIXEL.c</itemPath>
<itemPath>INTERRUPTS.c</itemPath>
<itemPath>I2C1.c</itemPath>
<itemPath>DS3231.c</itemPath>
<itemPath>TSL2561.c</itemPath>
</logicalFolder>
<logicalFolder name="ExternalFiles"
displayName="Important Files"
projectFiles="false">
<itemPath>Makefile</itemPath>
</logicalFolder>
</logicalFolder>
<projectmakefile>Makefile</projectmakefile>
<confs>
<conf name="default" type="2">
<toolsSet>
<developmentServer>localhost</developmentServer>
<targetDevice>PIC12F1840</targetDevice>
<targetHeader></targetHeader>
<targetPluginBoard></targetPluginBoard>
<platformTool>PICkit3PlatformTool</platformTool>
<languageToolchain>XC8</languageToolchain>
<languageToolchainVersion>1.20</languageToolchainVersion>
<platform>3</platform>
</toolsSet>
<compileType>
<linkerTool>
<linkerLibItems>
</linkerLibItems>
</linkerTool>
<loading>
<useAlternateLoadableFile>false</useAlternateLoadableFile>
<alternateLoadableFile></alternateLoadableFile>
</loading>
</compileType>
<makeCustomizationType>
<makeCustomizationPreStepEnabled>false</makeCustomizationPreStepEnabled>
<makeCustomizationPreStep></makeCustomizationPreStep>
<makeCustomizationPostStepEnabled>false</makeCustomizationPostStepEnabled>
<makeCustomizationPostStep></makeCustomizationPostStep>
<makeCustomizationPutChecksumInUserID>false</makeCustomizationPutChecksumInUserID>
<makeCustomizationEnableLongLines>false</makeCustomizationEnableLongLines>
<makeCustomizationNormalizeHexFile>false</makeCustomizationNormalizeHexFile>
</makeCustomizationType>
<HI-TECH-COMP>
<property key="asmlist" value="true"/>
<property key="define-macros" value=""/>
<property key="extra-include-directories" value=""/>
<property key="identifier-length" value="255"/>
<property key="operation-mode" value="free"/>
<property key="opt-xc8-compiler-strict_ansi" value="false"/>
<property key="optimization-assembler" value="true"/>
<property key="optimization-assembler-files" value="true"/>
<property key="optimization-debug" value="false"/>
<property key="optimization-global" value="true"/>
<property key="optimization-level" value="9"/>
<property key="optimization-set" value="default"/>
<property key="optimization-speed" value="true"/>
<property key="preprocess-assembler" value="true"/>
<property key="undefine-macros" value=""/>
<property key="use-cci" value="false"/>
<property key="use-iar" value="false"/>
<property key="verbose" value="false"/>
<property key="warning-level" value="0"/>
<property key="what-to-do" value="ignore"/>
</HI-TECH-COMP>
<HI-TECH-LINK>
<property key="additional-options-checksum" value=""/>
<property key="additional-options-code-offset" value=""/>
<property key="additional-options-command-line" value=""/>
<property key="additional-options-errata" value=""/>
<property key="additional-options-extend-address" value="false"/>
<property key="additional-options-trace-type" value=""/>
<property key="additional-options-use-response-files" value="false"/>
<property key="backup-reset-condition-flags" value="false"/>
<property key="calibrate-oscillator" value="true"/>
<property key="calibrate-oscillator-value" value=""/>
<property key="clear-bss" value="true"/>
<property key="code-model-external" value="wordwrite"/>
<property key="code-model-rom" value=""/>
<property key="create-html-files" value="false"/>
<property key="data-model-ram" value=""/>
<property key="data-model-size-of-double" value="24"/>
<property key="data-model-size-of-float" value="24"/>
<property key="display-class-usage" value="false"/>
<property key="display-hex-usage" value="false"/>
<property key="display-overall-usage" value="true"/>
<property key="display-psect-usage" value="false"/>
<property key="fill-flash-options-addr" value=""/>
<property key="fill-flash-options-const" value=""/>
<property key="fill-flash-options-how" value="0"/>
<property key="fill-flash-options-inc-const" value="1"/>
<property key="fill-flash-options-increment" value=""/>
<property key="fill-flash-options-seq" value=""/>
<property key="fill-flash-options-what" value="0"/>
<property key="format-hex-file-for-download" value="false"/>
<property key="initialize-data" value="true"/>
<property key="keep-generated-startup.as" value="false"/>
<property key="link-in-c-library" value="true"/>
<property key="link-in-peripheral-library" value="true"/>
<property key="managed-stack" value="false"/>
<property key="opt-xc8-linker-file" value="false"/>
<property key="opt-xc8-linker-link_startup" value="false"/>
<property key="opt-xc8-linker-serial" value=""/>
<property key="program-the-device-with-default-config-words" value="true"/>
</HI-TECH-LINK>
<PICkit3PlatformTool>
<property key="AutoSelectMemRanges" value="auto"/>
<property key="Freeze Peripherals" value="true"/>
<property key="SecureSegment.SegmentProgramming" value="FullChipProgramming"/>
<property key="ToolFirmwareFilePath"
value="Press to browse for a specific firmware version"/>
<property key="ToolFirmwareOption.UseLatestFirmware" value="true"/>
<property key="hwtoolclock.frcindebug" value="false"/>
<property key="memories.aux" value="false"/>
<property key="memories.bootflash" value="false"/>
<property key="memories.configurationmemory" value="false"/>
<property key="memories.eeprom" value="false"/>
<property key="memories.flashdata" value="true"/>
<property key="memories.id" value="false"/>
<property key="memories.programmemory" value="true"/>
<property key="memories.programmemory.end" value="0xfff"/>
<property key="memories.programmemory.start" value="0x0"/>
<property key="poweroptions.powerenable" value="true"/>
<property key="programmertogo.imagename" value=""/>
<property key="programoptions.eraseb4program" value="true"/>
<property key="programoptions.pgmspeed" value="2"/>
<property key="programoptions.preserveeeprom" value="false"/>
<property key="programoptions.preserveprogramrange" value="false"/>
<property key="programoptions.preserveprogramrange.end" value="0xfff"/>
<property key="programoptions.preserveprogramrange.start" value="0x0"/>
<property key="programoptions.preserveuserid" value="false"/>
<property key="programoptions.testmodeentrymethod" value="VDDFirst"/>
<property key="programoptions.usehighvoltageonmclr" value="false"/>
<property key="programoptions.uselvpprogramming" value="false"/>
<property key="voltagevalue" value="5.0"/>
</PICkit3PlatformTool>
<XC8-config-global>
<property key="advanced-elf" value="true"/>
<property key="output-file-format" value="-mcof,+elf"/>
<property key="stack-size-high" value="auto"/>
<property key="stack-size-low" value="auto"/>
<property key="stack-size-main" value="auto"/>
<property key="stack-type" value="compiled"/>
</XC8-config-global>
</conf>
</confs>
</configurationDescriptor>
/PIC Projects/PICX_12F1840_Clock/nbproject/Makefile-impl.mk
0,0 → 1,69
#
# Generated Makefile - do not edit!
#
# Edit the Makefile in the project folder instead (../Makefile). Each target
# has a pre- and a post- target defined where you can add customization code.
#
# This makefile implements macros and targets common to all configurations.
#
# NOCDDL
 
 
# Building and Cleaning subprojects are done by default, but can be controlled with the SUB
# macro. If SUB=no, subprojects will not be built or cleaned. The following macro
# statements set BUILD_SUB-CONF and CLEAN_SUB-CONF to .build-reqprojects-conf
# and .clean-reqprojects-conf unless SUB has the value 'no'
SUB_no=NO
SUBPROJECTS=${SUB_${SUB}}
BUILD_SUBPROJECTS_=.build-subprojects
BUILD_SUBPROJECTS_NO=
BUILD_SUBPROJECTS=${BUILD_SUBPROJECTS_${SUBPROJECTS}}
CLEAN_SUBPROJECTS_=.clean-subprojects
CLEAN_SUBPROJECTS_NO=
CLEAN_SUBPROJECTS=${CLEAN_SUBPROJECTS_${SUBPROJECTS}}
 
 
# Project Name
PROJECTNAME=PICX_12F1840_Clock
 
# Active Configuration
DEFAULTCONF=default
CONF=${DEFAULTCONF}
 
# All Configurations
ALLCONFS=default
 
 
# build
.build-impl: .build-pre
${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .build-conf
 
 
# clean
.clean-impl: .clean-pre
${MAKE} -f nbproject/Makefile-${CONF}.mk SUBPROJECTS=${SUBPROJECTS} .clean-conf
 
# clobber
.clobber-impl: .clobber-pre .depcheck-impl
${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=default clean
 
 
 
# all
.all-impl: .all-pre .depcheck-impl
${MAKE} SUBPROJECTS=${SUBPROJECTS} CONF=default build
 
 
 
# dependency checking support
.depcheck-impl:
# @echo "# This code depends on make tool being used" >.dep.inc
# @if [ -n "${MAKE_VERSION}" ]; then \
# echo "DEPFILES=\$$(wildcard \$$(addsuffix .d, \$${OBJECTFILES}))" >>.dep.inc; \
# echo "ifneq (\$${DEPFILES},)" >>.dep.inc; \
# echo "include \$${DEPFILES}" >>.dep.inc; \
# echo "endif" >>.dep.inc; \
# else \
# echo ".KEEP_STATE:" >>.dep.inc; \
# echo ".KEEP_STATE_FILE:.make.state.\$${CONF}" >>.dep.inc; \
# fi
/PIC Projects/PICX_12F1840_Clock/nbproject/Makefile-local-default.mk
0,0 → 1,37
#
# Generated Makefile - do not edit!
#
#
# This file contains information about the location of compilers and other tools.
# If you commmit this file into your revision control server, you will be able to
# to checkout the project and build it from the command line with make. However,
# if more than one person works on the same project, then this file might show
# conflicts since different users are bound to have compilers in different places.
# In that case you might choose to not commit this file and let MPLAB X recreate this file
# for each user. The disadvantage of not commiting this file is that you must run MPLAB X at
# least once so the file gets created and the project can be built. Finally, you can also
# avoid using this file at all if you are only building from the command line with make.
# You can invoke make with the values of the macros:
# $ makeMP_CC="/opt/microchip/mplabc30/v3.30c/bin/pic30-gcc" ...
#
SHELL=cmd.exe
PATH_TO_IDE_BIN=C:/Program Files (x86)/Microchip/MPLABX/mplab_ide/mplab_ide/modules/../../bin/
# Adding MPLAB X bin directory to path.
PATH:=C:/Program Files (x86)/Microchip/MPLABX/mplab_ide/mplab_ide/modules/../../bin/:$(PATH)
# Path to java used to run MPLAB X when this makefile was created
MP_JAVA_PATH="C:\Program Files (x86)\Microchip\MPLABX\sys\java\jre1.7.0_25-windows-x64\java-windows/bin/"
OS_CURRENT="$(shell uname -s)"
MP_CC="C:\Program Files (x86)\Microchip\xc8\v1.20\bin\xc8.exe"
# MP_CPPC is not defined
# MP_BC is not defined
# MP_AS is not defined
# MP_LD is not defined
# MP_AR is not defined
DEP_GEN=${MP_JAVA_PATH}java -jar "C:/Program Files (x86)/Microchip/MPLABX/mplab_ide/mplab_ide/modules/../../bin/extractobjectdependencies.jar"
MP_CC_DIR="C:\Program Files (x86)\Microchip\xc8\v1.20\bin"
# MP_CPPC_DIR is not defined
# MP_BC_DIR is not defined
# MP_AS_DIR is not defined
# MP_LD_DIR is not defined
# MP_AR_DIR is not defined
# MP_BC_DIR is not defined
/PIC Projects/PICX_12F1840_Clock/nbproject/Makefile-variables.mk
0,0 → 1,13
#
# Generated - do not edit!
#
# NOCDDL
#
CND_BASEDIR=`pwd`
# default configuration
CND_ARTIFACT_DIR_default=dist/default/production
CND_ARTIFACT_NAME_default=PICX_12F1840_Clock.production.hex
CND_ARTIFACT_PATH_default=dist/default/production/PICX_12F1840_Clock.production.hex
CND_PACKAGE_DIR_default=${CND_DISTDIR}/default/package
CND_PACKAGE_NAME_default=picx12f1840clock.tar
CND_PACKAGE_PATH_default=${CND_DISTDIR}/default/package/picx12f1840clock.tar
/PIC Projects/PICX_12F1840_Clock/nbproject/Package-default.bash
0,0 → 1,73
#!/bin/bash -x
 
#
# Generated - do not edit!
#
 
# Macros
TOP=`pwd`
CND_CONF=default
CND_DISTDIR=dist
TMPDIR=build/${CND_CONF}/${IMAGE_TYPE}/tmp-packaging
TMPDIRNAME=tmp-packaging
OUTPUT_PATH=dist/${CND_CONF}/${IMAGE_TYPE}/PICX_12F1840_Clock.${IMAGE_TYPE}.${OUTPUT_SUFFIX}
OUTPUT_BASENAME=PICX_12F1840_Clock.${IMAGE_TYPE}.${OUTPUT_SUFFIX}
PACKAGE_TOP_DIR=picx12f1840clock/
 
# Functions
function checkReturnCode
{
rc=$?
if [ $rc != 0 ]
then
exit $rc
fi
}
function makeDirectory
# $1 directory path
# $2 permission (optional)
{
mkdir -p "$1"
checkReturnCode
if [ "$2" != "" ]
then
chmod $2 "$1"
checkReturnCode
fi
}
function copyFileToTmpDir
# $1 from-file path
# $2 to-file path
# $3 permission
{
cp "$1" "$2"
checkReturnCode
if [ "$3" != "" ]
then
chmod $3 "$2"
checkReturnCode
fi
}
 
# Setup
cd "${TOP}"
mkdir -p ${CND_DISTDIR}/${CND_CONF}/package
rm -rf ${TMPDIR}
mkdir -p ${TMPDIR}
 
# Copy files and create directories and links
cd "${TOP}"
makeDirectory ${TMPDIR}/picx12f1840clock/bin
copyFileToTmpDir "${OUTPUT_PATH}" "${TMPDIR}/${PACKAGE_TOP_DIR}bin/${OUTPUT_BASENAME}" 0755
 
 
# Generate tar file
cd "${TOP}"
rm -f ${CND_DISTDIR}/${CND_CONF}/package/picx12f1840clock.tar
cd ${TMPDIR}
tar -vcf ../../../../${CND_DISTDIR}/${CND_CONF}/package/picx12f1840clock.tar *
checkReturnCode
 
# Cleanup
cd "${TOP}"
rm -rf ${TMPDIR}
/PIC Projects/PICX_12F1840_Clock/nbproject/private/SuppressibleMessageMemo.properties
0,0 → 1,3
#
#Mon Mar 10 00:43:05 EDT 2014
pk3/CHECK_4_HIGH_VOLTAGE_VPP=true
/PIC Projects/PICX_12F1840_Clock/nbproject/private/configurations.xml
0,0 → 1,25
<?xml version="1.0" encoding="UTF-8"?>
<configurationDescriptor version="62">
<projectmakefile>Makefile</projectmakefile>
<defaultConf>0</defaultConf>
<confs>
<conf name="default" type="2">
<platformToolSN>:=MPLABComm-USB-Microchip:=&lt;vid>04D8:=&lt;pid>900A:=&lt;rev>0002:=&lt;man>Microchip Technology Inc.:=&lt;prod>PICkit 3:=&lt;sn>BUR114189291:=&lt;drv>x:=&lt;xpt>h:=end</platformToolSN>
<languageToolchainDir>C:\Program Files (x86)\Microchip\xc8\v1.20\bin</languageToolchainDir>
<mdbdebugger version="1">
<placeholder1>place holder 1</placeholder1>
<placeholder2>place holder 2</placeholder2>
</mdbdebugger>
<runprofile version="6">
<args></args>
<rundir></rundir>
<buildfirst>true</buildfirst>
<console-type>0</console-type>
<terminal-type>0</terminal-type>
<remove-instrumentation>0</remove-instrumentation>
<environment>
</environment>
</runprofile>
</conf>
</confs>
</configurationDescriptor>
/PIC Projects/PICX_12F1840_Clock/nbproject/private/private.xml
0,0 → 1,3
<?xml version="1.0" encoding="UTF-8"?><project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
</project-private>
/PIC Projects/PICX_12F1840_Clock/nbproject/project.properties
--- nbproject/project.xml (nonexistent)
+++ nbproject/project.xml (revision 342)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://www.netbeans.org/ns/project/1">
+ <type>com.microchip.mplab.nbide.embedded.makeproject</type>
+ <configuration>
+ <data xmlns="http://www.netbeans.org/ns/make-project/1">
+ <name>PICX_12F1840_Clock</name>
+ <creation-uuid>7fe93e92-3ae3-42d5-9338-2afa3dbfcf6b</creation-uuid>
+ <make-project-type>0</make-project-type>
+ <c-extensions>c</c-extensions>
+ <cpp-extensions/>
+ <header-extensions>h</header-extensions>
+ <sourceEncoding>ISO-8859-1</sourceEncoding>
+ <asminc-extensions/>
+ <make-dep-projects/>
+ </data>
+ </configuration>
+</project>
/PIC Projects/PICX_12F1840_Clock/DS3231.c
0,0 → 1,113
#include "defines.h"
#include "DS3231.h"
#include "I2C1.h"
 
void DS3231_Init() {
uint8_t reg[3];
reg[0] = DS3231_CONTROL;
/* Control Register (0x0E)
* Bit 7 - !EOSC
* Bit 6 - BBSQW
* Bit 5 - CONV
* Bit 4 - RS2
* Bit 3 - RS1
* Bit 2 - INTCN
* Bit 1 - A2IE
* Bit 0 - A1IE
*/
reg[1] = 0x04;
 
/* Control Register 2 (0x0F)
* Bit 3 = EN32kHZ
*/
reg[2] = 0x00;
 
// Set the configuration registers
I2C1_Master_Send(DS3231_ADDRESS, 3, reg);
while (!I2C1_Get_Status());
}
 
uint8_t DS3231_Get_Status(void) {
/* Status Register (0x0F)
* Bit 7 - OSF
* Bit 3 - EN32kHz
* Bit 2 - BSY
* Bit 1 - A2F
* Bit 0 - A1F
*/
uint8_t value;
I2C1_Master_Restart(DS3231_ADDRESS, 0x0F, 1);
while (!I2C1_Get_Status());
I2C1_Read_Buffer(&value);
return value;
}
 
void DS3231_Set_Time(DS3231_TIME *time) {
 
// Format the data in a way that the chip expects
#ifndef DS3231_TIME_ONLY
uint8_t output[8];
#else
uint8_t output[4];
#endif
output[0] = DS3231_SECONDS;
output[1] = ((time->sec / 10) << 4) | (time->sec % 10);
output[2] = ((time->min / 10) << 4) | (time->min % 10);
output[3] = ((time->hour / 10) << 4) | (time->hour % 10);
#ifndef DS3231_TIME_ONLY
if (!time->h_mil) {
output[3] |= (time->h_am_pm) ? 0x60 : 0x40;
}
output[4] = time->day;
output[5] = ((time->date / 10) << 4) | (time->date % 10);
output[6] = ((time->month / 10) << 4) | (time->month % 10);
output[7] = ((time->year / 10) << 4) | (time->year % 10);
#endif
 
// Check the status to make sure that it isnt currently busy
while (DS3231_Get_Status() & 0x04);
 
// Write the data to the chip
#ifndef DS3231_TIME_ONLY
I2C1_Master_Send(DS3231_ADDRESS, 8, output);
#else
I2C1_Master_Send(DS3231_ADDRESS, 4, output);
#endif
while (!I2C1_Get_Status());
}
 
void DS3231_Get_Time(DS3231_TIME *time) {
 
// Check the status to make sure that it isnt currently busy
while (DS3231_Get_Status() & 0x04);
 
// Request time data from the chip
#ifndef DS3231_TIME_ONLY
uint8_t input[7];
I2C1_Master_Restart(DS3231_ADDRESS, 0x00, 7);
#else
uint8_t input[3];
I2C1_Master_Restart(DS3231_ADDRESS, 0x00, 3);
#endif
while (!I2C1_Get_Status());
I2C1_Read_Buffer(input);
 
// Parse BCD format into decimal and return
time->sec = ((input[0] >> 4) * 10) + (input[0] & 0x0F);
time->min = ((input[1] >> 4) * 10) + (input[1] & 0x0F);
if (input[2] & 0x40) {
time->h_mil = 0;
time->h_am_pm = (input[2] & 0x20) ? 1 : 0;
time->hour = (((input[2] >> 4) & 0x01) * 10) + (input[2] & 0x0F);
} else {
time->h_mil = 1;
time->hour = ((input[2] >> 4) * 10) + (input[2] & 0x0F);
}
#ifndef DS3231_TIME_ONLY
time->day = input[3];
time->date = ((input[4] >> 4) * 10) + (input[4] & 0x0F);
time->month = ((input[5] >> 4) * 10) + (input[5] & 0x0F);
time->year = ((input[6] >> 4) * 10) + (input[6] & 0x0F);
#endif
}
/PIC Projects/PICX_12F1840_Clock/DS3231.h
0,0 → 1,54
#ifndef RTC_DS3231_H
#define RTC_DS3231_H
 
#define DS3231_ADDRESS 0x68
 
#define DS3231_SECONDS 0x00
#define DS3231_MINUTES 0x01
#define DS3231_HOUR 0x02
#define DS3231_DAY 0x03
#define DS3231_DATE 0x04
#define DS3231_MONTH 0x05
#define DS3231_YEAR 0x06
 
#define DS3231_ALARM1_SECONDS 0x07
#define DS3231_ALARM1_MINUTES 0x08
#define DS3231_ALARM1_HOUR 0x09
#define DS3231_ALARM1_DAY_DATE 0x0A
 
#define DS3231_ALARM2_MINUTES 0x0B
#define DS3231_ALARM2_HOUR 0x0C
#define DS3231_ALARM2_DAY_DATE 0x0D
 
#define DS3231_CONTROL 0x0E
#define DS3231_STATUS 0x0F
 
#define DS3231_TIME_ONLY
 
typedef struct {
uint8_t sec;
uint8_t min;
uint8_t hour;
uint8_t h_mil;
uint8_t h_am_pm;
#ifndef DS3231_TIME_ONLY
uint8_t day;
uint8_t date;
uint8_t month;
uint8_t year;
#endif
} DS3231_TIME;
 
void DS3231_Init(void);
 
uint8_t DS3231_Get_Status(void);
 
void DS3231_Set_Time(DS3231_TIME *time);
 
void DS3231_Get_Time(DS3231_TIME *time);
 
//void DS3231_Set_Alarm1(uint8_t sec, uint8_t min, uint8_t hour, uint8_t date, bit mil, bit am_pm, bit dt_dy);
//void DS3231_Set_Alarm2(uint8_t min, uint8_t hour, uint8_t date, bit mil, bit am_pm, bit dt_dy);
 
#endif
 
/PIC Projects/PICX_12F1840_Clock/I2C1.h
0,0 → 1,69
#ifndef I2C1_H
#define I2C1_H
 
#define MAXI2C1BUF 8
 
// I2C Operating Speed
#define I2C_100KHZ 0x0
#define I2C_400KHZ 0x1
#define I2C_1MHZ 0x2
 
// Operating State
#define I2C_IDLE 0x1
#define I2C_STARTED 0x2
#define I2C_RCV_DATA 0x3
#define I2C_SEND_DATA 0x4
#define I2C_SEND_ADDR 0x5
#define I2C_SEND_ADDR_2 0x6
#define I2C_CHECK_ACK_SEND 0x7
#define I2C_CHECK_ACK_RECV 0x8
#define I2C_CHECK_ACK_RESTART 0x9
#define I2C_REQ_DATA 0xA
#define I2C_SEND_STOP 0xB
#define I2C_SEND_START 0xC
 
// Operating Mode
#define I2C_MODE_SLAVE 0x10
#define I2C_MODE_MASTER 0x11
 
// Master Status
#define I2C_MASTER_SEND 0x20
#define I2C_MASTER_RECV 0x21
#define I2C_MASTER_RESTART 0x22
#define I2C_MASTER_IDLE 0x23
 
// Return Status
#define I2C_SEND_OK 0x30
#define I2C_SEND_FAIL 0x31
#define I2C_RECV_OK 0x32
#define I2C_RECV_FAIL 0x33
#define I2C_DATA_AVAL 0x34
#define I2C_ERR_NOADDR 0x35
#define I2C_ERR_OVERRUN 0x36
#define I2C_ERR_NODATA 0x37
#define I2C_ERR_BUFFER_OVERRUN 0x38
 
typedef struct {
uint8_t buffer_in[MAXI2C1BUF];
uint8_t buffer_in_len;
uint8_t buffer_in_read_ind;
uint8_t buffer_in_write_ind;
uint8_t operating_state;
uint8_t return_status;
 
uint8_t master_dest_addr;
uint8_t master_status;
} I2C1_DATA;
 
void I2C1_Init(void);
void I2C1_Interrupt_Handler(void);
void I2C1_Configure_Master(uint8_t speed);
void I2C1_Master_Send(uint8_t address, uint8_t length, uint8_t *msg);
void I2C1_Master_Recv(uint8_t address, uint8_t length);
void I2C1_Master_Restart(uint8_t address, uint8_t msg, uint8_t length);
uint8_t I2C1_Get_Status(void);
uint8_t I2C1_Buffer_Len(void);
uint8_t I2C1_Read_Buffer(uint8_t *buffer);
 
#endif
/PIC Projects/PICX_12F1840_Clock/INTERRUPTS.c
0,0 → 1,41
#include "defines.h"
#include "INTERRUPTS.h"
#include "I2C1.h"
 
void Interrupt_Enable() {
INTCONbits.GIE = 1;
INTCONbits.PEIE = 1;
}
 
void Interrupt_Disable() {
INTCONbits.GIE = 0;
INTCONbits.PEIE = 0;
}
 
void interrupt InterruptHandler(void) {
// Check to see if we have an I2C1 interrupt
if (PIR1bits.SSP1IF) {
I2C1_Interrupt_Handler();
PIR1bits.SSP1IF = 0;
}
 
//#ifndef UART_TX_ONLY
// // Check to see if we have an interrupt on USART1 RX
// if (PIR1bits.RCIF) {
// UART_Recv_Interrupt_Handler();
// PIR1bits.RCIF = 0;
// if (INTCONbits.TMR0IF)
// tmr0_rollover = 1;
// }
//#endif
 
// // Check to see if we have an interrupt on USART1 TX
// if (PIR1bits.TXIF) {
// UART_Send_Interrupt_Handler();
//// PIR1bits.TXIF = 0;
// if (INTCONbits.TMR0IF)
// tmr0_rollover = 1;
// }
 
}
/PIC Projects/PICX_12F1840_Clock/TSL2561.h
0,0 → 1,131
#ifndef LUX_TSL2561_H
#define LUX_TSL2561_H
 
#define TSL2561_VISIBLE 2 // channel 0 - channel 1
#define TSL2561_INFRARED 1 // channel 1
#define TSL2561_FULLSPECTRUM 0 // channel 0
 
// 3 i2c address options!
#define TSL2561_ADDR_LOW 0x29
#define TSL2561_ADDR_FLOAT 0x39
#define TSL2561_ADDR_HIGH 0x49
 
// Lux calculations differ slightly for CS package
//#define TSL2561_PACKAGE_CS
#define TSL2561_PACKAGE_T_FN_CL
 
#define TSL2561_READBIT (0x01)
 
#define TSL2561_COMMAND_BIT (0x80) // Must be 1
#define TSL2561_CLEAR_BIT (0x40) // Clears any pending interrupt (write 1 to clear)
#define TSL2561_WORD_BIT (0x20) // 1 = read/write word (rather than byte)
#define TSL2561_BLOCK_BIT (0x10) // 1 = using block read/write
 
#define TSL2561_CONTROL_POWERON (0x03)
#define TSL2561_CONTROL_POWEROFF (0x00)
 
#define TSL2561_LUX_LUXSCALE (14) // Scale by 2^14
#define TSL2561_LUX_RATIOSCALE (9) // Scale ratio by 2^9
#define TSL2561_LUX_CHSCALE (10) // Scale channel values by 2^10
#define TSL2561_LUX_CHSCALE_TINT0 (0x7517) // 322/11 * 2^TSL2561_LUX_CHSCALE
#define TSL2561_LUX_CHSCALE_TINT1 (0x0FE7) // 322/81 * 2^TSL2561_LUX_CHSCALE
 
// T, FN and CL package values
#define TSL2561_LUX_K1T (0x0040) // 0.125 * 2^RATIO_SCALE
#define TSL2561_LUX_B1T (0x01f2) // 0.0304 * 2^LUX_SCALE
#define TSL2561_LUX_M1T (0x01be) // 0.0272 * 2^LUX_SCALE
#define TSL2561_LUX_K2T (0x0080) // 0.250 * 2^RATIO_SCALE
#define TSL2561_LUX_B2T (0x0214) // 0.0325 * 2^LUX_SCALE
#define TSL2561_LUX_M2T (0x02d1) // 0.0440 * 2^LUX_SCALE
#define TSL2561_LUX_K3T (0x00c0) // 0.375 * 2^RATIO_SCALE
#define TSL2561_LUX_B3T (0x023f) // 0.0351 * 2^LUX_SCALE
#define TSL2561_LUX_M3T (0x037b) // 0.0544 * 2^LUX_SCALE
#define TSL2561_LUX_K4T (0x0100) // 0.50 * 2^RATIO_SCALE
#define TSL2561_LUX_B4T (0x0270) // 0.0381 * 2^LUX_SCALE
#define TSL2561_LUX_M4T (0x03fe) // 0.0624 * 2^LUX_SCALE
#define TSL2561_LUX_K5T (0x0138) // 0.61 * 2^RATIO_SCALE
#define TSL2561_LUX_B5T (0x016f) // 0.0224 * 2^LUX_SCALE
#define TSL2561_LUX_M5T (0x01fc) // 0.0310 * 2^LUX_SCALE
#define TSL2561_LUX_K6T (0x019a) // 0.80 * 2^RATIO_SCALE
#define TSL2561_LUX_B6T (0x00d2) // 0.0128 * 2^LUX_SCALE
#define TSL2561_LUX_M6T (0x00fb) // 0.0153 * 2^LUX_SCALE
#define TSL2561_LUX_K7T (0x029a) // 1.3 * 2^RATIO_SCALE
#define TSL2561_LUX_B7T (0x0018) // 0.00146 * 2^LUX_SCALE
#define TSL2561_LUX_M7T (0x0012) // 0.00112 * 2^LUX_SCALE
#define TSL2561_LUX_K8T (0x029a) // 1.3 * 2^RATIO_SCALE
#define TSL2561_LUX_B8T (0x0000) // 0.000 * 2^LUX_SCALE
#define TSL2561_LUX_M8T (0x0000) // 0.000 * 2^LUX_SCALE
 
// CS package values
#define TSL2561_LUX_K1C (0x0043) // 0.130 * 2^RATIO_SCALE
#define TSL2561_LUX_B1C (0x0204) // 0.0315 * 2^LUX_SCALE
#define TSL2561_LUX_M1C (0x01ad) // 0.0262 * 2^LUX_SCALE
#define TSL2561_LUX_K2C (0x0085) // 0.260 * 2^RATIO_SCALE
#define TSL2561_LUX_B2C (0x0228) // 0.0337 * 2^LUX_SCALE
#define TSL2561_LUX_M2C (0x02c1) // 0.0430 * 2^LUX_SCALE
#define TSL2561_LUX_K3C (0x00c8) // 0.390 * 2^RATIO_SCALE
#define TSL2561_LUX_B3C (0x0253) // 0.0363 * 2^LUX_SCALE
#define TSL2561_LUX_M3C (0x0363) // 0.0529 * 2^LUX_SCALE
#define TSL2561_LUX_K4C (0x010a) // 0.520 * 2^RATIO_SCALE
#define TSL2561_LUX_B4C (0x0282) // 0.0392 * 2^LUX_SCALE
#define TSL2561_LUX_M4C (0x03df) // 0.0605 * 2^LUX_SCALE
#define TSL2561_LUX_K5C (0x014d) // 0.65 * 2^RATIO_SCALE
#define TSL2561_LUX_B5C (0x0177) // 0.0229 * 2^LUX_SCALE
#define TSL2561_LUX_M5C (0x01dd) // 0.0291 * 2^LUX_SCALE
#define TSL2561_LUX_K6C (0x019a) // 0.80 * 2^RATIO_SCALE
#define TSL2561_LUX_B6C (0x0101) // 0.0157 * 2^LUX_SCALE
#define TSL2561_LUX_M6C (0x0127) // 0.0180 * 2^LUX_SCALE
#define TSL2561_LUX_K7C (0x029a) // 1.3 * 2^RATIO_SCALE
#define TSL2561_LUX_B7C (0x0037) // 0.00338 * 2^LUX_SCALE
#define TSL2561_LUX_M7C (0x002b) // 0.00260 * 2^LUX_SCALE
#define TSL2561_LUX_K8C (0x029a) // 1.3 * 2^RATIO_SCALE
#define TSL2561_LUX_B8C (0x0000) // 0.000 * 2^LUX_SCALE
#define TSL2561_LUX_M8C (0x0000) // 0.000 * 2^LUX_SCALE
 
enum {
TSL2561_REGISTER_CONTROL = 0x00,
TSL2561_REGISTER_TIMING = 0x01,
TSL2561_REGISTER_THRESHHOLDL_LOW = 0x02,
TSL2561_REGISTER_THRESHHOLDL_HIGH = 0x03,
TSL2561_REGISTER_THRESHHOLDH_LOW = 0x04,
TSL2561_REGISTER_THRESHHOLDH_HIGH = 0x05,
TSL2561_REGISTER_INTERRUPT = 0x06,
TSL2561_REGISTER_CRC = 0x08,
TSL2561_REGISTER_ID = 0x0A,
TSL2561_REGISTER_CHAN0_LOW = 0x0C,
TSL2561_REGISTER_CHAN0_HIGH = 0x0D,
TSL2561_REGISTER_CHAN1_LOW = 0x0E,
TSL2561_REGISTER_CHAN1_HIGH = 0x0F
};
 
typedef enum {
TSL2561_INTEGRATIONTIME_13MS = 0x00, // 13.7ms
TSL2561_INTEGRATIONTIME_101MS = 0x01, // 101ms
TSL2561_INTEGRATIONTIME_402MS = 0x02 // 402ms
} tsl2561IntegrationTime_t;
 
typedef enum {
TSL2561_GAIN_0X = 0x00, // No gain
TSL2561_GAIN_16X = 0x10 // 16x gain
} tsl2561Gain_t;
 
typedef struct __TSL25611_DATA {
uint8_t address;
tsl2561IntegrationTime_t integration;
tsl2561Gain_t gain;
} TSL2561_DATA;
 
void TSL2561_Init(uint8_t address);
void TSL2561_Enable(void);
void TSL2561_Disable(void);
void TSL2561_Set_Timing(tsl2561IntegrationTime_t integration);
void TSL2561_Set_Gain(tsl2561Gain_t gain);
uint32_t TSL2561_Calculate_Lux(uint16_t ch0, uint16_t ch1);
uint32_t TSL2561_Get_Full_Luminosity(void);
uint16_t TSL2561_Get_Luminosity(uint8_t channel);
 
void TSL2561_Write_2_Bytes(uint8_t reg, uint8_t value);
uint16_t TSL2561_Read_2_Bytes(uint8_t reg);
 
#endif /* LUX_TSL2561_H */
 
/PIC Projects/PICX_12F1840_Clock/defines.h
0,0 → 1,15
#ifndef DEFINES_H
#define DEFINES_H
 
#include <xc.h>
#include <stdint.h>
 
// Preprocessor define for __delay_ms() and __delay_us()
#define _XTAL_FREQ 32000000
 
#define NEOPIXEL_TRIS TRISAbits.TRISA5
#define I2C_1_CLK_TRIS TRISAbits.TRISA1
#define I2C_1_DAT_TRIS TRISAbits.TRISA2
 
#endif /* DEFINES_H */
 
/PIC Projects/PICX_12F1840_Clock/INTERRUPTS.h
0,0 → 1,12
#ifndef INTERRUPTS_H
#define INTERRUPTS_H
 
// Enable all interrupts (high and low priority)
void Interrupt_Enable(void);
 
// Disable all interrupts (high and low priority)
void Interrupt_Disable(void);
 
void interrupt InterruptHandlerHigh(void);
 
#endif
/PIC Projects/PICX_12F1840_Clock/Makefile
0,0 → 1,108
#
# There exist several targets which are by default empty and which can be
# used for execution of your targets. These targets are usually executed
# before and after some main targets. They are:
#
# .build-pre: called before 'build' target
# .build-post: called after 'build' target
# .clean-pre: called before 'clean' target
# .clean-post: called after 'clean' target
# .clobber-pre: called before 'clobber' target
# .clobber-post: called after 'clobber' target
# .all-pre: called before 'all' target
# .all-post: called after 'all' target
# .help-pre: called before 'help' target
# .help-post: called after 'help' target
#
# Targets beginning with '.' are not intended to be called on their own.
#
# Main targets can be executed directly, and they are:
#
# build build a specific configuration
# clean remove built files from a configuration
# clobber remove all built files
# all build all configurations
# help print help mesage
#
# Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
# .help-impl are implemented in nbproject/makefile-impl.mk.
#
# Available make variables:
#
# CND_BASEDIR base directory for relative paths
# CND_DISTDIR default top distribution directory (build artifacts)
# CND_BUILDDIR default top build directory (object files, ...)
# CONF name of current configuration
# CND_ARTIFACT_DIR_${CONF} directory of build artifact (current configuration)
# CND_ARTIFACT_NAME_${CONF} name of build artifact (current configuration)
# CND_ARTIFACT_PATH_${CONF} path to build artifact (current configuration)
# CND_PACKAGE_DIR_${CONF} directory of package (current configuration)
# CND_PACKAGE_NAME_${CONF} name of package (current configuration)
# CND_PACKAGE_PATH_${CONF} path to package (current configuration)
#
# NOCDDL
 
 
# Environment
MKDIR=mkdir
CP=cp
CCADMIN=CCadmin
RANLIB=ranlib
 
 
# build
build: .build-post
 
.build-pre:
# Add your pre 'build' code here...
 
.build-post: .build-impl
# Add your post 'build' code here...
 
 
# clean
clean: .clean-post
 
.clean-pre:
# Add your pre 'clean' code here...
 
.clean-post: .clean-impl
# Add your post 'clean' code here...
 
 
# clobber
clobber: .clobber-post
 
.clobber-pre:
# Add your pre 'clobber' code here...
 
.clobber-post: .clobber-impl
# Add your post 'clobber' code here...
 
 
# all
all: .all-post
 
.all-pre:
# Add your pre 'all' code here...
 
.all-post: .all-impl
# Add your post 'all' code here...
 
 
# help
help: .help-post
 
.help-pre:
# Add your pre 'help' code here...
 
.help-post: .help-impl
# Add your post 'help' code here...
 
 
 
# include project implementation makefile
include nbproject/Makefile-impl.mk
 
# include project make variables
include nbproject/Makefile-variables.mk